Commit 6acfa2a5 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

*** empty log message ***

[r49]
parent 7fe7a673
......@@ -3,6 +3,15 @@
**
** Authors: Christian Schaefer
**
irmode.h Modes for ir operators.
This module specifies the modes that type the firm nodes. See
UKA tech report 1999-44 for more information about modes.
@@@ This file is at the level of the original fiasco. It needs to be ported
to the version of the tech report!!! This will be done with the reimplementation
of the tarval module.
*/
# ifndef _IRMODE_H_
......@@ -12,10 +21,10 @@
# define target_bits 8
#define NUM_MODES 20
# define NUM_MODES 20
typedef enum { /* irm is short for `ir mode' */
irm_T, // former irm_N
irm_T, /* former irm_N */
irm_f, irm_d, /* irm_e, */
irm_c, irm_C, irm_h, irm_H, irm_i, irm_I, irm_l, irm_L,
irm_B, irm_b,
......@@ -38,14 +47,14 @@ typedef enum { /* irm is short for `ir mode' */
typedef struct {
modecode code;
ident *name;
int size;
int ld_align; /* ld means log2 */
struct tarval *min;
struct tarval *max;
struct tarval *null;
unsigned fsigned:1;
unsigned ffloat:1;
ident *name; /* Name of this mode */
int size; /* size of the mode in Bytes. */
int ld_align; /* ld means log2 */
struct tarval *min; /* largest value to be represented by this mode */
struct tarval *max; /* smallest value to be represented by this mode */
struct tarval *null; /* Representation of zero in this mode */
unsigned fsigned:1; /* signedness of this mode */
unsigned ffloat:1; /* true if this is a float */
} ir_mode;
extern ir_mode *mode_T; /* tuple (none) */
......@@ -60,45 +69,45 @@ extern ir_mode *mode_i; /* signed integer */
extern ir_mode *mode_I; /* unsigned integer */
extern ir_mode *mode_l; /* signed long integer */
extern ir_mode *mode_L; /* unsigned long integer */
extern ir_mode *mode_B; /* bits */ // oblivious
extern ir_mode *mode_B; /* bits */ /* oblivious */
/* extern ir_mode *mode_c; * char */
extern ir_mode *mode_p; /* pointer */
extern ir_mode *mode_b; /* internal boolean */
extern ir_mode *mode_s; // oblivious
extern ir_mode *mode_S; // oblivious
extern ir_mode *mode_s; /* oblivious */
extern ir_mode *mode_S; /* oblivious */
extern ir_mode *mode_X; /* execution */
extern ir_mode *mode_M; /* memory */
extern ir_mode *mode_R; /* block */
extern ir_mode *mode_Z; /* infinit integers */ // oblivious
extern ir_mode *mode_Z; /* infinit integers */ /* oblivious */
extern ir_mode *mode_T; /* tuple (none) */
void init_mode (void);
modecode get_modecode_of_mode (ir_mode *mode);
// void set_modecode_of_mode (ir_mode *mode, modecode code);
/* void set_modecode_of_mode (ir_mode *mode, modecode code); */
ident *get_ident_of_mode (ir_mode *mode);
ident *get_mode_ident (ir_mode *mode);
// void set_ident_of_mode (ir_mode *mode, ident *name);
/* void set_ident_of_mode (ir_mode *mode, ident *name); */
int get_size_of_mode (ir_mode *mode);
// void set_size_of_mode (ir_mode *mode, int size);
/* void set_size_of_mode (ir_mode *mode, int size); */
int get_ld_align_of_mode (ir_mode *mode);
// void set_ld_align_of_mode (ir_mode *mode, int ld_align);
/* void set_ld_align_of_mode (ir_mode *mode, int ld_align); */
struct tarval *get_min_of_mode (ir_mode *mode);
// void set_min_of_mode (ir_mode *mode, struct tarval *min);
/* void set_min_of_mode (ir_mode *mode, struct tarval *min); */
struct tarval *get_max_of_mode (ir_mode *mode);
// void set_max_of_mode (ir_mode *mode, struct tarval *max);
/* void set_max_of_mode (ir_mode *mode, struct tarval *max); */
struct tarval *get_null_of_mode (ir_mode *mode);
// void set_null_of_mode (ir_mode *mode, struct tarval *null);
/* void set_null_of_mode (ir_mode *mode, struct tarval *null); */
unsigned get_fsigned_of_mode (ir_mode *mode);
// void set_fsigned_of_mode (ir_mode *mode, unsigned fsigned);
/* void set_fsigned_of_mode (ir_mode *mode, unsigned fsigned); */
unsigned get_ffloat_of_mode (ir_mode *mode);
// void set_ffloat_of_mode (ir_mode *mode, unsigned ffloat);
/* void set_ffloat_of_mode (ir_mode *mode, unsigned ffloat); */
int mode_is_signed (ir_mode *mode);
int mode_is_float (ir_mode *mode);
int mode_is_int (ir_mode *mode);
# define is_chilCHIL(m) ((m) <= irm_L && (m) >= irm_c) // old
# define is_chilCHIL(m) ((m) <= irm_L && (m) >= irm_c) /* old */
int mode_is_num (ir_mode *mode);
int mode_is_data (ir_mode *mode);
int mode_is_datab (ir_mode *mode);
......
......@@ -286,9 +286,9 @@ inline void set_SymConst_ptrinfo (ir_node *node, ident *ptrinfo);
inline ir_node *get_Sel_mem (ir_node *node);
inline void set_Sel_mem (ir_node *node, ir_node *mem);
inline ir_node *get_Sel_ptr (ir_node *node); /* ptr to the object to select from */
inline void set_Sel_ptr (ir_node *node, ir_node *ptr);
inline void set_Sel_ptr (ir_node *node, ir_node *ptr);
inline ir_node **get_Sel_index_arr (ir_node *node);
inline int get_Sel_n_index (ir_node *node);
inline int get_Sel_n_index (ir_node *node);
/*inline void set_Sel_n_index (ir_node *node, int n_index); */
inline ir_node *get_Sel_index (ir_node *node, int pos);
inline void set_Sel_index (ir_node *node, int pos, ir_node *index);
......@@ -304,10 +304,10 @@ inline void set_Call_ptr (ir_node *node, ir_node *ptr);
inline ir_node **get_Call_param_arr (ir_node *node);
inline int get_Call_arity (ir_node *node);
/* inline void set_Call_arity (ir_node *node, ir_node *arity); */
inline ir_node *get_Call_param (ir_node *node, int pos);
inline void set_Call_param (ir_node *node, int pos, ir_node *param);
inline ir_node *get_Call_param (ir_node *node, int pos);
inline void set_Call_param (ir_node *node, int pos, ir_node *param);
inline type_method *get_Call_type (ir_node *node);
inline void set_Call_type (ir_node *node, type_method *type);
inline void set_Call_type (ir_node *node, type_method *type);
/* For unary and binary arithmetic operations the access to the
operands can be factored out. Left is the first, right the
......
/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
** All rights reserved.
/*
** Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
** All rights reserved.
**
** Authors: Christian Schaefer
** Authors: Christian Schaefer
**
** irop.h operators of firm nodes
**
** This module specifies the opcodes possible for ir nodes. Their
** definition is close to the operations specified in UKA Tech-Report 1999-44
**
*/
......@@ -9,7 +15,6 @@
# define _IROP_H_
# include "ident.h"
# include "type.h"
typedef enum {
iro_Block,
......@@ -82,6 +87,8 @@ extern ir_op *op_Bad;
/* create a new ir operation */
ir_op * new_ir_op (opcode code, ident *name, size_t attr_size, int labeled);
/* initialize the irop module */
void init_op (void);
# endif /* _IROP_H_ */
......@@ -4,7 +4,177 @@
** Authors: Martin Trapp, Christian Schaefer &
** Goetz Lindenmaier
**
** type.h: datastructures to hold type information.
@@@@@@@ Improve documentation: distinguish fields that are
set by the frontend and contain knowledge specified by the source
program from fields containing information derived by analysis/optimization
or lowering phases.
** type.h: datastructures to hold type information.
**
** This module supplies datastructures to represent all types
** known in the compiled program. This includes types specified
** in the program as well as types defined by the language. In the
** view of the intermediate representation there is no difference
** between these types.
** Types are different from the modes defined in irmode: Types are
** on the level of the programming language, modes at the level of
** the target processor.
**
**
** General datastructure
** =====================
**
** Firm distinguishes several different type constructs. These are
** implemented as structs. A union of the individual structs constructs
** the firm node "type".
**
** All type constructs have the following fields:
**
** kind A firm_kind tag containing k_type_class. This is useful
** for dynamically checking the sort of a type. Automatically
** generated.
**
** name An identifier specifying the type name. Set by the frontend.
**
** visit A counter for walks of the type information.
**
**
** General functionality
** =====================
**
** is_type(t) Returns true if t is a type node, else false.
**
**
** type_class
** ==========
**
** Type_class represents class types. A list of fields and
** methods is associated with a class. Further a class can
** inherit from and bequest to other classes.
**
** fields:
** -------
**
** **member All entities belonging to this class. This are methodes
** which have type_method or fields that can have any of the
** following types: k_type_class, k_type_strct, k_type_union,
** k_type_array, k_type_enumeration, k_type_pointer, k_type_primitive.
**
** **subtypes A list of direct subclasses.
**
** **supertypes A list of direct superclasses.
**
**
** type_strct
** ==========
**
** Type_strct represents aggregate types that consist of a list
** of fields.
**
** fields:
** -------
**
** **member All entities belonging to this class. This are the fields
** that can have any of the following types: k_type_class,
** k_type_strct, k_type_union, k_type_array, k_type_enumeration,
** k_type_pointer, k_type_primitive.
**
** type_method
** ===========
**
** Type_method represents method, function and procedure types.
**
** fields:
** -------
**
** arity Number of parameters to the procedure. @@@ better n_params
** A procedure in FIRM has only call by value parameters.
**
** **param_type A list with the types of parameters. This list is ordered.
** The nth type in this list corresponds to the nth element
** in the parameter tuple that is a result of the start node.
** (See ircons.h for more information.)
**
** n_res The number of results of the method. In general, procedures
** have zero results, functions one.
**
** **res_type A list with the types of parameters. This list is ordered.
** The nth type in this list corresponds to the nth input to
** Return nodes. (See ircons.h for more information.)
**
**
** type_union
** ==========
**
** Type_union represents union types.
**
** fields:
** -------
**
** **unioned_type A list of unioned types.
**
**
** type_array
** ==========
**
** Type_array represents rectangular multi dimensional arrays.
**
** fields:
** -------
**
** n_dimensions Number of array dimensions.
**
** *lower_bound Lower bounds of dimensions. Mostly all 0.
**
** *upper_bound Upper bounds or dimensions.
**
** *element_type The type of the array elements.
**
**
** type_enumeration
** ================
**
** Enumeration types. These need not necessarily be represented explicitly
** by Firm types, as the frontend can lower them to integer constants as
** well. For debugging purposes or similar tasks this information is useful.
**
** fields:
** -------
**
** **enum The target values representing the constants used to
** represent individual enumerations.
**
** **enum_name Idents containing the source program name of the enumeration
** constants
**
** type_pointer
** ============
**
** Pointer types.
**
** fields:
** -------
**
** *mode The mode used to implement a pointer. @@@ So far this field
** is constant and set to mode_P. Maybe we will move this
** to a global constant (irprog), or are there processors
** that require a set of different pointer modes?
**
** *points_to The type of the entity this pointer points to.
**
** type_primitive
** ==============
**
** Primitive types are types that represent indivisible data values that
** map directly to modes.
**
** fields:
** -------
**
** mode The mode to be used for this type.
**
*/
# ifndef _TYPE_H_
......@@ -29,7 +199,6 @@ typedef struct {
ident *name;
/** needs list with it's entities -- does it really??
Entities can be added during their creation.
int n_members; Use array stuff, get length from array. saves this explicit field.
entities **member; **/
/** to represent inheritance
type_class **subtypes; * direct subtypes *
......@@ -92,10 +261,8 @@ void set_strct_ident (type_strct *strct, ident* ident);
typedef struct {
firm_kind kind;
ident *name; /* do I need the name,
or is the name in entity sufficient?
No, there is no name for the type. Types have
only names if typedef's give them one. */
ident *name; /* Name of the method type. Usually method
types are not explicitly named (but the entity). */
int arity; /* number of parameters, better n_params */
type **param_type; /* code generation needs this information.
Should it be generated by the frontend,
......@@ -165,11 +332,9 @@ void set_union_unioned_type (type_union *union, int pos, type *type);
typedef struct {
firm_kind kind;
ident *name;
int n_dimensions; /* Extend Sel to select from multidimensional arrays. This */
int *lower_bound; /* will allow to generate explicit array index computations */
int *upper_bound; /* by replacing a single FIRM node. As long as this is not
done create arrays with arrays as elements. */
/* Should I use tarval? */
int n_dimensions;
int *lower_bound;
int *upper_bound;
type *element_type;
unsigned long visit; /* visited counter for walks of the type information */
} type_array;
......@@ -206,9 +371,12 @@ type *get_array_element_type (type_array *array);
typedef struct {
firm_kind kind;
ident *name;
/* int n_enums;
ir_node **enum * Contains all constant nodes that represent a member
of the enum -- enumerators. */
/*
tarval **enum * Contains all constant nodes that represent a member
of the enum -- enumerators. */
/*
ident **enum_name * Contains the names of the enum fields as specified by
the source program */
/* is ir_node the propper array member? */
unsigned long visit; /* visited counter for walks of the type information */
} type_enumeration;
......@@ -269,7 +437,7 @@ type *get_pointer_points_to_type (type_pointer *pointer);
typedef struct {
firm_kind kind;
ident *name;
ir_mode *mode; /* The mode to be used for this type */
ir_mode *mode; /* The mode to be used for this type */
unsigned long visit; /* visited counter for walks of the type information */
} type_primitive;
......
......@@ -27,7 +27,7 @@ main(void)
{
ir_graph *irg;
type_class *owner;
type_method *method;
type_method *method; /* the type of this method */
entity *ent;
ir_node *a, *b, *c, *d, *x;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment