3 * File name: ir/tr/tpop.h
4 * Purpose: Opcode of types.
5 * Author: Goetz Lindenmaier
9 * Copyright: (c) 2001-2003 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
21 * This module specifies the kinds of types available in firm.
23 * @author Goetz Lindenmaier
25 * They are called type opcodes. These include classes, structs, methods, unions,
26 * arrays, enumerations, pointers and primitive types.
30 * an enum for the type kinds.
31 * For each type kind exists a typecode to identify it.
46 * A structure containing information about a kind of type.
47 * A structure containing information about a kind of type. So far
48 * this is only the kind name, an enum for case-switching and some
51 * @see get_tpop_name(), get_tpop_code(), get_tpop_ident()
53 typedef struct tp_op tp_op;
57 * Returns the string for the type opcode.
59 * @param op The type opcode to get the string from.
60 * @return a string. (@todo Null terminated???)
62 const char *get_tpop_name (tp_op *op);
65 * Returns an enum for the type opcode.
67 * @param op The type opcode to get the enum from.
70 tp_opcode get_tpop_code (tp_op *op);
73 * Returns the ident for the type opcode.
75 * @param op The type opcode to get the ident from.
78 ident *get_tpop_ident (tp_op *op);
81 * This type opcode marks that the corresponding type is a class type.
83 * Consequently the type refers to supertypes, subtypes and entities.
84 * Entities can be any fields, but also methods.
85 * @@@ value class or not???
86 * This struct is dynamically allocated but constant for the lifetime
89 extern tp_op *type_class;
90 tp_op *get_type_class(void);
93 * This type opcode marks that the corresponding type is a compound type
96 * Consequently the type refers to a list of entities
97 * which may not be methods (but pointers to methods).
98 * This struct is dynamically allocated but constant for the lifetime
101 extern tp_op *type_struct;
102 tp_op *get_type_struct(void);
105 * This type opcode marks that the corresponding type is a method type.
107 * Consequently it refers to a list of arguments and results.
108 * This struct is dynamically allocated but constant for the lifetime
111 extern tp_op *type_method;
112 tp_op *get_type_method(void);
115 * This type opcode marks that the corresponding type is a union type.
117 * Consequently it refers to a list of unioned types.
118 * This struct is dynamically allocated but constant for the lifetime
121 extern tp_op *type_union;
122 tp_op *get_type_union(void);
125 * This type opcode marks that the corresponding type is an array type.
127 * Consequently it contains a list of dimensions (lower and upper bounds)
128 * and an element type.
129 * This struct is dynamically allocated but constant for the lifetime
132 extern tp_op *type_array;
133 tp_op *get_type_array(void);
136 * This type opcode marks that the corresponding type is an enumeration type.
138 * Consequently it contains a list of idents for the enumeration identifiers
139 * and a list of tarbet values that are the constants used to implement
141 * This struct is dynamically allocated but constant for the lifetime
144 extern tp_op *type_enumeration;
145 tp_op *get_type_enumeration(void);
148 * This type opcode marks that the corresponding type is a pointer type.
150 * It contains a reference to the type the pointer points to.
151 * This struct is dynamically allocated but constant for the lifetime
154 extern tp_op *type_pointer;
155 tp_op *get_type_pointer(void);
158 * This type opcode marks that the corresponding type is a primitive type.
160 * Primitive types are types that are directly mapped to target machine
162 * This struct is dynamically allocated but constant for the lifetime
165 extern tp_op *type_primitive;
166 tp_op *get_type_primitive(void);
169 * This type opcode is an auxiliary opcode dedicated to support transformations
170 * of the type structure.
172 * If a type is changed to another type with another
173 * opcode the new type will be allocated with new memory. All nodes refering
174 * to the old type need to be changed to refer the new one. This is simplified
175 * by turning the old type into an id type that merely forwards to the new type
176 * that now replaces the old one.
177 * type_ids should never be visible out of the type module. All access routines
178 * should automatically check for type_id and eventually follow the forward in
179 * type_id. Two types are exchanged by a call to exchange_types.
180 * If a type_id is visible externally report this as bug. If it is assured that
181 * this never happens this extern variable can be moved to tpop_t.h.
182 * This struct is dynamically allocated but constant for the lifetime
185 extern tp_op *type_id;
186 tp_op *get_type_id(void);
188 # endif /*_TYPEOP_H_ */