14 * (C) 2001 by Universitaet Karlsruhe
18 * This module specifies the kinds of types available in firm. They are
19 * called type opcodes. These include classes, structs, methods, unions,
20 * arrays, enumerations, pointers and primitive types.
27 * typecode -- an enum for the type kinds
29 * For each type kind exists a typecode to identify it.
48 * tp_op - a structure containing information about a kind of type.
50 * A structure containing information about a kind of type. So far
51 * this is only the kind name, an enum for case-switching and some
54 * get_tpop_name, get_tpop_code, get_tpop_ident
57 typedef struct tp_op tp_op;
61 /****f* tpop/get_tpop_name
64 * get_tpop_name - Returns the string for the type opcode.
66 * const char *get_tpop_name (tp_op *op)
68 * op - The type opcode to get the string from.
70 * a string. (@@@ Null terminated???)
73 const char *get_tpop_name (tp_op *op);
75 /****f* tpop/get_tpop_code
78 * get_tpop_code - Returns an enum for the type opcode.
80 * tp_opcode get_tpop_code (tp_op *op);
82 * op - The type opcode to get the enum from.
87 tp_opcode get_tpop_code (tp_op *op);
89 /****f* tpop/get_tpop_ident
92 * get_tpop_ident - Returns the ident for the type opcode.
94 * ident *get_tpop_ident (tp_op *op);
96 * op - The type opcode to get the ident from.
101 ident *get_tpop_ident (tp_op *op);
103 /****d* tpop/type_class
108 * This type opcode marks that the corresponding type is a class type.
109 * Consequently the type refers to supertypes, subtypes and entities.
110 * Entities can be any fields, but also methods.
111 * @@@ value class or not???
113 * This struct is dynamically allocated but constant for the lifetime
117 extern tp_op *type_class;
118 tp_op *get_type_class();
121 /****d* tpop/type_struct
126 * This type opcode marks that the corresponding type is a compound type
127 * as a struct in C. Consequently the type refers to a list of entities
128 * which may not be methods (but pointers to methods).
130 * This struct is dynamically allocated but constant for the lifetime
134 extern tp_op *type_struct;
135 tp_op *get_type_struct();
138 /****d* tpop/type_method
143 * This type opcode marks that the corresponding type is a method type.
144 * Consequently it refers to a list of arguments and results.
146 * This struct is dynamically allocated but constant for the lifetime
150 extern tp_op *type_method;
151 tp_op *get_type_method();
154 /****d* tpop/type_union
159 * This type opcode marks that the corresponding type is a union type.
160 * Consequently it refers to a list of unioned types.
162 * This struct is dynamically allocated but constant for the lifetime
166 extern tp_op *type_union;
167 tp_op *get_type_union();
170 /****d* tpop/type_array
175 * This type opcode marks that the corresponding type is an array type.
176 * Consequently it contains a list of dimensions (lower and upper bounds)
177 * and an element type.
179 * This struct is dynamically allocated but constant for the lifetime
183 extern tp_op *type_array;
184 tp_op *get_type_array();
187 /****d* tpop/type_enumeration
192 * This type opcode marks that the corresponding type is an enumeration type.
193 * Consequently it contains a list of idents for the enumeration identifiers
194 * and a list of tarbet values that are the constants used to implement
197 * This struct is dynamically allocated but constant for the lifetime
201 extern tp_op *type_enumeration;
202 tp_op *get_type_enumeration();
205 /****d* tpop/type_pointer
210 * This type opcode marks that the corresponding type is a pointer type.
211 * It contains a reference to the type the pointer points to.
213 * This struct is dynamically allocated but constant for the lifetime
217 extern tp_op *type_pointer;
218 tp_op *get_type_pointer();
221 /****d* tpop/type_primitive
226 * This type opcode marks that the corresponding type is a primitive type.
227 * Primitive types are types that are directly mapped to target machine
230 * This struct is dynamically allocated but constant for the lifetime
234 extern tp_op *type_primitive;
235 tp_op *get_type_primitive();
243 * This type opcode is an auxiliary opcode dedicated to support transformations
244 * of the type structure. If a type is changed to another type with another
245 * opcode the new type will be allocated with new memory. All nodes refering
246 * to the old type need to be changed to refer the new one. This is simplified
247 * by turning the old type into an id type that merely forwards to the new type
248 * that now replaces the old one.
249 * type_ids should never be visible out of the type module. All access routines
250 * should automatically check for type_id and eventually follow the forward in
251 * type_id. Two types are exchanged by a call to exchange_types.
252 * If a type_id is visible externally report this as bug. If it is assured that
253 * this never happens this extern variable can be moved to tpop_t.h.
255 * This struct is dynamically allocated but constant for the lifetime
259 extern tp_op *type_id;
260 tp_op *get_type_id();
263 # endif /*_TYPEOP_H_ */