Fixed comments and convert them to doxygen.
[libfirm] / ir / tr / tpop.h
1
2 /* $Id$ */
3
4 # ifndef _TYPEOP_H_
5 # define _TYPEOP_H_
6
7 #include "ident.h"
8
9 /**
10  *
11  *  file tpop.h
12  *   (C) 2001 by Universitaet Karlsruhe
13  *   Goetz Lindenmaier
14  *  This module specifies the kinds of types available in firm.  They are
15  *  called type opcodes. These include classes, structs, methods, unions,
16  *  arrays, enumerations, pointers and primitive types.
17  */
18
19 /**
20  *
21  *   - an enum for the type kinds
22  *   For each type kind exists a typecode to identify it.
23  */
24 typedef enum {
25   tpo_class,
26   tpo_struct,
27   tpo_method,
28   tpo_union,
29   tpo_array,
30   tpo_enumeration,
31   tpo_pointer,
32   tpo_primitive,
33   tpo_id
34 } tp_opcode;
35
36 /**
37  *
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
41  *   internal values.
42  * @see  get_tpop_name, get_tpop_code, get_tpop_ident
43  */
44 typedef struct tp_op tp_op;
45
46
47 /**
48  *
49  *   Returns the string for the type opcode.
50  *   @param op - The type opcode to get the string from.
51  *   @return a string.  (@@@ Null terminated???)
52  *
53  */
54 const char *get_tpop_name (tp_op *op);
55
56 /**
57  *
58  *   Returns an enum for the type opcode.
59  *   @param op - The type opcode to get the enum from.
60  *   @return the enum.
61  *
62  */
63 tp_opcode get_tpop_code (tp_op *op);
64
65 /**
66  *
67  *   Returns the ident for the type opcode.
68  *   @param op - The type opcode to get the ident from.
69  *   @return The ident.
70  *
71  */
72 ident *get_tpop_ident (tp_op *op);
73
74 /**
75  *
76  *
77  *   This type opcode marks that the corresponding type is a class type.
78  *   Consequently the type refers to supertypes, subtypes and entities.
79  *   Entities can be any fields, but also methods.
80  *   @@@ value class or not???
81  *   This struct is dynamically allocated but constant for the lifetime
82  *   of the library.
83  */
84 extern tp_op *type_class;
85 tp_op *get_type_class();
86
87 /**
88  *
89  *   type_struct
90  *   This type opcode marks that the corresponding type is a compound type
91  *   as a struct in C.  Consequently the type refers to a list of entities
92  *   which may not be methods (but pointers to methods).
93  *   This struct is dynamically allocated but constant for the lifetime
94  *   of the library.
95  */
96 extern tp_op *type_struct;
97 tp_op *get_type_struct();
98
99 /**
100  *
101  *   type_method
102  *   This type opcode marks that the corresponding type is a method type.
103  *   Consequently it refers to a list of arguments and results.
104  *   This struct is dynamically allocated but constant for the lifetime
105  *   of the library.
106  */
107 extern tp_op *type_method;
108 tp_op *get_type_method();
109
110 /**
111  *
112  *   type_union
113  *   This type opcode marks that the corresponding type is a union type.
114  *   Consequently it refers to a list of unioned types.
115  *   This struct is dynamically allocated but constant for the lifetime
116  *   of the library.
117  */
118 extern tp_op *type_union;
119 tp_op *get_type_union();
120
121 /**
122  *
123  *   type_array
124  *   This type opcode marks that the corresponding type is an array type.
125  *   Consequently it contains a list of dimensions (lower and upper bounds)
126  *   and an element type.
127  *   This struct is dynamically allocated but constant for the lifetime
128  *   of the library.
129  */
130 extern tp_op *type_array;
131 tp_op *get_type_array();
132
133 /**
134  *
135  *   type_enumeration
136  *   This type opcode marks that the corresponding type is an enumeration type.
137  *   Consequently it contains a list of idents for the enumeration identifiers
138  *   and a list of tarbet values that are the constants used to implement
139  *   the enumerators.
140  *   This struct is dynamically allocated but constant for the lifetime
141  *   of the library.
142  */
143 extern tp_op *type_enumeration;
144 tp_op *get_type_enumeration();
145
146 /**
147  *
148  *   type_pointer
149  *   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
152  *   of the library.
153  */
154 extern tp_op *type_pointer;
155 tp_op *get_type_pointer();
156
157 /**
158  *
159  *   type_primitive
160  *   This type opcode marks that the corresponding type is a primitive type.
161  *   Primitive types are types that are directly mapped to target machine
162  *   modes.
163  *   This struct is dynamically allocated but constant for the lifetime
164  *   of the library.
165  */
166 extern tp_op *type_primitive;
167 tp_op *get_type_primitive();
168
169 /**
170  *
171  *   type_id
172  *   This type opcode is an auxiliary opcode dedicated to support transformations
173  *   of the type structure.  If a type is changed to another type with another
174  *   opcode the new type will be allocated with new memory.  All nodes refering
175  *   to the old type need to be changed to refer the new one.  This is simplified
176  *   by turning the old type into an id type that merely forwards to the new type
177  *   that now replaces the old one.
178  *   type_ids should never be visible out of the type module.  All access routines
179  *   should automatically check for type_id and eventually follow the forward in
180  *   type_id.  Two types are exchanged by a call to exchange_types.
181  *   If a type_id is visible externally report this as bug.  If it is assured that
182  *   this never happens this extern variable can be moved to tpop_t.h.
183  *   This struct is dynamically allocated but constant for the lifetime
184  *   of the library.
185  */
186 extern tp_op *type_id;
187 tp_op *get_type_id();
188
189 # endif /*_TYPEOP_H_ */