added debug support constructors
[libfirm] / ir / tr / tpop.h
1
2 /* $Id$ */
3
4 # ifndef _TYPEOP_H_
5 # define _TYPEOP_H_
6
7 #include "ident.h"
8
9 /****h* libfirm/tpop
10  *
11  * NAME
12  *  file tpop.h
13  * COPYRIGHT
14  *   (C) 2001 by Universitaet Karlsruhe
15  * AUTHORS
16  *   Goetz Lindenmaier
17  * NOTES
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.
21  *****
22  */
23
24 /****** tpop/typecode
25  *
26  * NAME
27  *   typecode -- an enum for the type kinds
28  * PURPOSE
29  *   For each type kind exists a typecode to identify it.
30  * SOURCE
31  */
32 typedef enum {
33   tpo_class,
34   tpo_struct,
35   tpo_method,
36   tpo_union,
37   tpo_array,
38   tpo_enumeration,
39   tpo_pointer,
40   tpo_primitive,
41   tpo_id
42 } tp_opcode;
43 /******/
44
45 /****s* tpop/tp_op
46  *
47  * NAME
48  *   tp_op  - a structure containing information about a kind of type.
49  * PURPOSE
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
52  *   internal values.
53  * SEE ALSO
54  *   get_tpop_name, get_tpop_code, get_tpop_ident
55  * SOURCE
56  */
57 typedef struct tp_op tp_op;
58 /******/
59
60
61 /****f* tpop/get_tpop_name
62  *
63  * NAME
64  *   get_tpop_name - Returns the string for the type opcode.
65  * SYNOPSIS
66  *   const char *get_tpop_name (tp_op *op)
67  * INPUTS
68  *   op - The type opcode to get the string from.
69  * RESULT
70  *   a string.  (@@@ Null terminated???)
71  ***
72  */
73 const char *get_tpop_name (tp_op *op);
74
75 /****f* tpop/get_tpop_code
76  *
77  * NAME
78  *   get_tpop_code - Returns an enum for the type opcode.
79  * SYNOPSIS
80  *   tp_opcode get_tpop_code (tp_op *op);
81  * INPUTS
82  *   op - The type opcode to get the enum from.
83  * RESULT
84  *   the enum.
85  ***
86  */
87 tp_opcode get_tpop_code (tp_op *op);
88
89 /****f* tpop/get_tpop_ident
90  *
91  * NAME
92  *   get_tpop_ident - Returns the ident for the type opcode.
93  * SYNOPSIS
94  *   ident *get_tpop_ident (tp_op *op);
95  * INPUTS
96  *   op - The type opcode to get the ident from.
97  * RESULT
98  *   The ident.
99  ***
100  */
101 ident *get_tpop_ident (tp_op *op);
102
103 /****d* tpop/type_class
104  *
105  * NAME
106  *   type_class  -
107  * PURPOSE
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???
112  * NOTES
113  *   This struct is dynamically allocated but constant for the lifetime
114  *   of the library.
115  * SOURCE
116  */
117 extern tp_op *type_class;
118 /******/
119
120 /****d* tpop/type_struct
121  *
122  * NAME
123  *   type_struct
124  * PURPOSE
125  *   This type opcode marks that the corresponding type is a compound type
126  *   as a struct in C.  Consequently the type refers to a list of entities
127  *   which may not be methods (but pointers to methods).
128  * NOTES
129  *   This struct is dynamically allocated but constant for the lifetime
130  *   of the library.
131  * SOURCE
132  */
133 extern tp_op *type_struct;
134 /******/
135
136 /****d* tpop/type_method
137  *
138  * NAME
139  *   type_method
140  * PURPOSE
141  *   This type opcode marks that the corresponding type is a method type.
142  *   Consequently it refers to a list of arguments and results.
143  * NOTES
144  *   This struct is dynamically allocated but constant for the lifetime
145  *   of the library.
146  * SOURCE
147  */
148 extern tp_op *type_method;
149 /******/
150
151 /****d* tpop/type_union
152  *
153  * NAME
154  *   type_union
155  * PURPOSE
156  *   This type opcode marks that the corresponding type is a union type.
157  *   Consequently it refers to a list of unioned types.
158  * NOTES
159  *   This struct is dynamically allocated but constant for the lifetime
160  *   of the library.
161  * SOURCE
162  */
163 extern tp_op *type_union;
164 /******/
165
166 /****d* tpop/type_array
167  *
168  * NAME
169  *   type_array
170  * PURPOSE
171  *   This type opcode marks that the corresponding type is an array type.
172  *   Consequently it contains a list of dimensions (lower and upper bounds)
173  *   and an element type.
174  * NOTES
175  *   This struct is dynamically allocated but constant for the lifetime
176  *   of the library.
177  * SOURCE
178  */
179 extern tp_op *type_array;
180 /******/
181
182 /****d* tpop/type_enumeration
183  *
184  * NAME
185  *   type_enumeration
186  * PURPOSE
187  *   This type opcode marks that the corresponding type is an enumeration type.
188  *   Consequently it contains a list of idents for the enumeration identifiers
189  *   and a list of tarbet values that are the constants used to implement
190  *   the enumerators.
191  * NOTES
192  *   This struct is dynamically allocated but constant for the lifetime
193  *   of the library.
194  * SOURCE
195  */
196 extern tp_op *type_enumeration;
197 /******/
198
199 /****d* tpop/type_pointer
200  *
201  * NAME
202  *   type_pointer
203  * PURPOSE
204  *   This type opcode marks that the corresponding type is a pointer type.
205  *   It contains a reference to the type the pointer points to.
206  * NOTES
207  *   This struct is dynamically allocated but constant for the lifetime
208  *   of the library.
209  * SOURCE
210  */
211 extern tp_op *type_pointer;
212 /******/
213
214 /****d* tpop/type_primitive
215  *
216  * NAME
217  *   type_primitive
218  * PURPOSE
219  *   This type opcode marks that the corresponding type is a primitive type.
220  *   Primitive types are types that are directly mapped to target machine
221  *   modes.
222  * NOTES
223  *   This struct is dynamically allocated but constant for the lifetime
224  *   of the library.
225  * SOURCE
226  */
227 extern tp_op *type_primitive;
228 /******/
229
230 /****d* tpop/type_id
231  *
232  * NAME
233  *   type_id
234  * PURPOSE
235  *   This type opcode is an auxiliary opcode dedicated to support transformations
236  *   of the type structure.  If a type is changed to another type with another
237  *   opcode the new type will be allocated with new memory.  All nodes refering
238  *   to the old type need to be changed to refer the new one.  This is simplified
239  *   by turning the old type into an id type that merely forwards to the new type
240  *   that now replaces the old one.
241  *   type_ids should never be visible out of the type module.  All access routines
242  *   should automatically check for type_id and eventually follow the forward in
243  *   type_id.  Two types are exchanged by a call to exchange_types.
244  *   If a type_id is visible externally report this as bug.  If it is assured that
245  *   this never happens this extern variable can be moved to tpop_t.h.
246  * NOTES
247  *   This struct is dynamically allocated but constant for the lifetime
248  *   of the library.
249  * SOURCE
250  */
251 extern tp_op *type_id;
252 /******/
253
254 # endif /*_TYPEOP_H_ */