1 /* (C) 2001 by Universitaet Karlsruhe */
13 * This module specifies the kinds of types available in firm.
15 * @author Goetz Lindenmaier
17 * They are called type opcodes. These include classes, structs, methods, unions,
18 * arrays, enumerations, pointers and primitive types.
22 * an enum for the type kinds.
23 * For each type kind exists a typecode to identify it.
38 * A structure containing information about a kind of type.
39 * A structure containing information about a kind of type. So far
40 * this is only the kind name, an enum for case-switching and some
43 * @see get_tpop_name(), get_tpop_code(), get_tpop_ident()
45 typedef struct tp_op tp_op;
49 * Returns the string for the type opcode.
51 * @param op The type opcode to get the string from.
52 * @return a string. (@todo Null terminated???)
54 const char *get_tpop_name (tp_op *op);
57 * Returns an enum for the type opcode.
59 * @param op The type opcode to get the enum from.
62 tp_opcode get_tpop_code (tp_op *op);
65 * Returns the ident for the type opcode.
67 * @param op The type opcode to get the ident from.
70 ident *get_tpop_ident (tp_op *op);
73 * This type opcode marks that the corresponding type is a class type.
75 * Consequently the type refers to supertypes, subtypes and entities.
76 * Entities can be any fields, but also methods.
77 * @@@ value class or not???
78 * This struct is dynamically allocated but constant for the lifetime
81 extern tp_op *type_class;
82 tp_op *get_type_class(void);
85 * This type opcode marks that the corresponding type is a compound type
88 * Consequently the type refers to a list of entities
89 * which may not be methods (but pointers to methods).
90 * This struct is dynamically allocated but constant for the lifetime
93 extern tp_op *type_struct;
94 tp_op *get_type_struct(void);
97 * This type opcode marks that the corresponding type is a method type.
99 * Consequently it refers to a list of arguments and results.
100 * This struct is dynamically allocated but constant for the lifetime
103 extern tp_op *type_method;
104 tp_op *get_type_method(void);
107 * This type opcode marks that the corresponding type is a union type.
109 * Consequently it refers to a list of unioned types.
110 * This struct is dynamically allocated but constant for the lifetime
113 extern tp_op *type_union;
114 tp_op *get_type_union(void);
117 * This type opcode marks that the corresponding type is an array type.
119 * Consequently it contains a list of dimensions (lower and upper bounds)
120 * and an element type.
121 * This struct is dynamically allocated but constant for the lifetime
124 extern tp_op *type_array;
125 tp_op *get_type_array(void);
128 * This type opcode marks that the corresponding type is an enumeration type.
130 * Consequently it contains a list of idents for the enumeration identifiers
131 * and a list of tarbet values that are the constants used to implement
133 * This struct is dynamically allocated but constant for the lifetime
136 extern tp_op *type_enumeration;
137 tp_op *get_type_enumeration(void);
140 * This type opcode marks that the corresponding type is a pointer type.
142 * It contains a reference to the type the pointer points to.
143 * This struct is dynamically allocated but constant for the lifetime
146 extern tp_op *type_pointer;
147 tp_op *get_type_pointer(void);
150 * This type opcode marks that the corresponding type is a primitive type.
152 * Primitive types are types that are directly mapped to target machine
154 * This struct is dynamically allocated but constant for the lifetime
157 extern tp_op *type_primitive;
158 tp_op *get_type_primitive(void);
161 * This type opcode is an auxiliary opcode dedicated to support transformations
162 * of the type structure.
164 * If a type is changed to another type with another
165 * opcode the new type will be allocated with new memory. All nodes refering
166 * to the old type need to be changed to refer the new one. This is simplified
167 * by turning the old type into an id type that merely forwards to the new type
168 * that now replaces the old one.
169 * type_ids should never be visible out of the type module. All access routines
170 * should automatically check for type_id and eventually follow the forward in
171 * type_id. Two types are exchanged by a call to exchange_types.
172 * If a type_id is visible externally report this as bug. If it is assured that
173 * this never happens this extern variable can be moved to tpop_t.h.
174 * This struct is dynamically allocated but constant for the lifetime
177 extern tp_op *type_id;
178 tp_op *get_type_id(void);
180 # endif /*_TYPEOP_H_ */