1 /* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Martin Trapp, Christian Schaefer &
7 ** type.h: datastructures to hold type information.
17 /* for recursive type definiton */
18 typedef union type type;
20 /* visited flag to traverse the type information */
21 extern unsigned long type_visited;
23 /*******************************************************************/
25 /*******************************************************************/
30 /** needs list with it's entities -- does it really??
31 Entities can be added during their creation.
34 unsigned long visit; /* visited counter for walks of the type information */
38 /* create a new type_class */
39 type_class *new_type_class (ident *name);
41 /* manipulate fields of type_class */
42 char *get_class_name (type_class *clss);
43 ident *get_class_ident (type_class *clss);
45 void set_class_name (type_class *class, char *name);
46 void set_class_ident (type_class *class, ident* ident);
49 /*******************************************************************/
51 /*******************************************************************/
56 /** needs list with it's entities -- does it really??
57 Entities can be added during their creation.
60 unsigned long visit; /* visited counter for walks of the type information */
64 /* create a new type_strct */
65 type_strct *new_type_strct (ident *name);
67 /* manipulate fields of type_strct */
68 char *get_strct_name (type_strct *strct);
69 ident *get_strct_ident (type_strct *strct);
71 void set_strct_name (type_strct *strct, char *name);
72 void set_strct_ident (type_strct *strct, ident* ident);
76 /*******************************************************************/
78 /*******************************************************************/
82 ident *name; /* do I need the name,
83 or is the name in entity sufficient? */
84 int arity; /* number of parameters, better n_params */
85 type **param_type; /* code generation needs this information.
86 Should it be generated by the frontend,
87 or does this impose unnecessary work for
88 optimizatinos that change the parameters of
90 int n_res; /* number of results */
92 /** needs pointer to it's ir_graph ??
94 unsigned long visit; /* visited counter for walks of the type information */
97 /* create a new type_method */
98 type_method *new_type_method (ident *name, int arity, int n_res);
100 /* manipulate fields of type_method */
102 char *get_method_name (type_method *method);
103 ident *get_method_ident (type_method *method);
104 /* GL 9.2.2000: who commened these in?
105 I think it's not safe to have these methods.
106 Please add changes to Changes file.
107 void set_method_name (type_method *method, char *name);
108 void set_method_ident (type_method *method, ident* ident); */
110 inline int get_method_arity (type_method *method);
111 inline void set_method_arity (type_method *method, int arity);
112 inline type *get_method_param_type(type_method *method, int pos);
113 inline void set_method_param_type(type_method *method, int pos, type* type);
115 inline int get_method_n_res (type_method *method);
116 inline void set_method_n_res (type_method *method, int n_res);
117 inline type *get_method_res_type(type_method *method, int pos);
118 inline void set_method_res_type(type_method *method, int pos, type* type);
121 ir_graph *get_method_graph(type_method *method);
122 void *get_method_graph(type_method *method, ir_graph* graph);
125 /*******************************************************************/
127 /*******************************************************************/
131 ident *name; /* do I need a name? */
133 /* type **unioned_type; ... or something like that? */
134 unsigned long visit; /* visited counter for walks of the type information */
137 /* create a new type_union -- set unioned types by hand. */
138 type_union *new_type_union (ident *name, int n_types);
140 /* manipulate fields of type_union */
141 char *get_union_name (type_union *uni);
142 ident *get_union_ident (type_union *uni);
144 void set_union_name (type_union *union, char *name);
145 void set_union_ident (type_union *union, ident* ident);
148 int get_union_n_types (type_union *union);
149 void set_union_n_types (type_union *union, int n);
150 type *get_union_unioned_type (type_union *union, int pos);
151 void set_union_unioned_type (type_union *union, int pos, type *type);
154 /*******************************************************************/
156 /*******************************************************************/
158 /* multidimensional, polyhedric arrays */
162 int n_dimensions; /* Extend Sel to select from multidimensional arrays. This */
163 int *lower_bound; /* will allow to generate explicit array index computations */
164 int *upper_bound; /* by replacing a single FIRM node. As long as this is not
165 done create arrays with arrays as elements. */
166 /* Should I use tarval? */
168 unsigned long visit; /* visited counter for walks of the type information */
171 /* create a new type array -- set dimension sizes independently */
172 type_array *new_type_array (ident *name, int n_dimensions);
174 /* manipulate fields of type_array */
175 char *get_array_name (type_array *array);
176 ident *get_array_ident (type_array *array);
178 void set_array_name (type_array *array, char *name);
179 void set_array_ident (type_array *array, ident* ident);
181 void set_array_n_dimensions (type_array *array, int n);
182 int get_array_n_dimensions (type_array *array);
184 void set_array_bounds (type_array *array, int dimension, int lower_bound,
186 void set_array_lower_bound (type_array *array, int dimension, int lower_bound);
187 void set_array_upper_bound (type_array *array, int dimension, int upper_bound);
188 int get_array_lower_bound (type_array *array, int dimension);
189 int get_array_upper_bound (type_array *array, int dimension);
191 void set_array_element_type (type_array *array, type *type);
192 type *get_array_element_type (type_array *array);
194 /*******************************************************************/
195 /** TYPE_ENUMERATION **/
196 /*******************************************************************/
197 /** Enums are needed to keep debugging information. They can as well
198 be lowered to integers. **/
204 ir_node **enum * Contains all constant nodes that represent a member
205 of the enum -- enumerators. */
206 /* is ir_node the propper array member? */
207 unsigned long visit; /* visited counter for walks of the type information */
210 /* create a new type enumeration -- set the enumerators independently */
211 type_enumeration *new_type_enumeration (ident *name /* , int n_enums */);
213 /* manipulate fields of type_enumeration */
214 char *get_enumeration_name (type_enumeration *enumeration);
215 ident *get_enumeration_ident (type_enumeration *enumeration);
217 void set_enumeration_name (type_enumeration *enumeration, char *name);
218 void set_enumeration_ident (type_enumeration *enumeration, ident* ident);
221 void set_enumeration_n_enums (type_enumeration *enumeration, int n);
222 int *get_enumeration_n_enums (type_enumeration *enumeration);
223 void set_enumeration_enum (type_enumeration *enumeration, int pos,
225 ir_node *get_enumeration_enum (type_enumeration *enumeration, int pos);
228 /*******************************************************************/
230 /*******************************************************************/
235 /* ir_mode *mode; * The mode to be used for this type.
236 Not here as there might be several pointer types?
237 A method get_pointer_mode should read a unique,
240 unsigned long visit; /* visited counter for walks of the type information */
243 /* create a new type pointer */
244 type_pointer *new_type_pointer (ident *name, type *points_to);
246 /* manipulate fields of type_pointer */
247 char *get_pointer_name (type_pointer *pointer);
248 ident *get_pointer_ident (type_pointer *pointer);
250 void set_pointer_name (type_pointer *pointer, char *name);
251 void set_pointer_ident (type_pointer *pointer, ident* ident);
253 void set_pointer_points_to_type (type_pointer *pointer, type *type);
254 type *get_pointer_points_to_type (type_pointer *pointer);
256 /*******************************************************************/
257 /** TYPE_PRIMITIVE **/
258 /*******************************************************************/
260 /* primitive, language-defined types */
261 /* What is the type of an entity if it is atomic? Are alle basic data
262 types classses in Sather? Else this is needed. */
266 ir_mode *mode; /* The mode to be used for this type */
267 unsigned long visit; /* visited counter for walks of the type information */
270 /* create a new type primitive */
271 type_primitive *new_type_primitive (ident *name, ir_mode *mode);
273 /* manipulate fields of type_primitive */
274 char *get_primitive_name (type_primitive *primitive);
275 ident *get_primitive_ident (type_primitive *primitive);
277 void set_primitive_name (type_primitive *primitive, char *name);
278 void set_primitive_ident (type_primitive *primitive, ident* ident);
280 ir_mode *get_primitive_mode (type_primitive *primitive);
281 void set_primitive_mode (type_primitive *primitive, ir_mode *mode);
286 /*******************************************************************/
287 /** To manage all different types the same **/
288 /*******************************************************************/
296 type_union uni; /* union is keyword */
297 type_enumeration enumeration;
298 type_pointer pointer;
299 type_primitive primitive;
302 int is_type(void *thing);
307 # endif /* _TYPE_H_ */