3 * File name: ir/tr/type_t.h
4 * Purpose: Representation of types -- private header.
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 file contains the datatypes hidden in type.h.
23 * @author Goetz Lindenmaier
24 * @see type.h tpop_t.h tpop.h
27 /** class attributes */
29 entity **members; /**< fields and methods of this class */
30 type **subtypes; /**< direct subtypes */
31 type **supertypes; /**< direct supertypes */
32 peculiarity peculiarity;
33 int dfn; /**< number used for 'instanceof' operator */
36 /** struct attributs */
38 entity **members; /**< fields of this struct. No method entities
42 /** method attributes */
44 int n_params; /**< number of parameters */
45 type **param_type; /**< code generation needs this information. */
46 type *value_params; /**< A type whose entities represent copied value arguments. */
47 int n_res; /**< number of results */
48 type **res_type; /**< array with result types */
49 type *value_ress; /**< A type whose entities represent copied value results. */
50 variadicity variadicity; /**< variadicity of the method. */
51 int first_variadic_param; /**< index of the first variadic param or -1 if non-variadic .*/
54 /** union attributs */
57 /* type **unioned_type; * a list of unioned types. */
58 /* ident **delim_names; * names of the union delimiters. */
59 entity **members; /**< fields of this union. No method entities
64 /** array attributs */
66 int n_dimensions; /**< Number of array dimensions. */
67 ir_node **lower_bound; /**< Lower bounds of dimensions. Usually all 0. */
68 ir_node **upper_bound; /**< Upper bounds or dimensions. */
69 int *order; /**< Ordering of dimensions. */
70 type *element_type; /**< The type of the array elements. */
71 entity *element_ent; /**< Entity for the array elements, to be used for
72 element selection with Sel. */
77 int n_enums; /**< Number of enumerators. */
78 tarval **enumer; /**< Contains all constants that represent a member
79 of the enum -- enumerators. */
80 ident **enum_nameid;/**< Contains the names of the enum fields as specified by
84 /** pointer attributs */
86 type *points_to; /**< The type of the enitity the pointer points to. */
90 typedef struct { * No private attr yet! *
95 typedef struct { * No private attr, must be smaller than others! *
99 /** General type attributs. */
101 cls_attr ca; /**< attributes of a class type */
102 stc_attr sa; /**< attributes of a struct type */
103 mtd_attr ma; /**< attributes of a method type */
104 uni_attr ua; /**< attributes of an union type */
105 arr_attr aa; /**< attributes of an array type */
106 enm_attr ea; /**< attributes of an enumeration type */
107 ptr_attr pa; /**< attributes of a pointer type */
110 /** the structure of a type */
115 type_state state; /**< Represents the types state: layout undefined or
117 int size; /**< Size of an entity of this type. This is determined
118 when fixing the layout of this class. Size must be
120 ir_mode *mode; /**< The mode for atomic types */
121 unsigned long visit; /**< visited counter for walks of the type information */
122 void *link; /**< holds temporary data - like in irnode_t.h */
123 struct dbg_info* dbi; /**< A pointer to information for debug support. */
126 int nr; /**< a unique node number for each node to make output
129 tp_attr attr; /* type kind specific fields. This must be the last
130 entry in this struct! Varying size! */
134 * Creates a new type representation:
136 * @param type_op - the kind of this type. May not be type_id.
137 * @param mode - the mode to be used for this type, may be NULL
138 * @param name - an ident for the name of this type.
139 * @return a new type of the given type. The remaining private attributes are not
140 * @return initalized. The type is in state layout_undefined.
144 new_type(tp_op *type_op,
147 void free_type_attrs (type *tp);
149 INLINE void free_class_entities (type *clss);
150 INLINE void free_struct_entities (type *strct);
151 INLINE void free_method_entities (type *method);
152 INLINE void free_union_entities (type *uni);
153 INLINE void free_array_entities (type *array);
154 INLINE void free_enumeration_entities(type *enumeration);
155 INLINE void free_pointer_entities (type *pointer);
156 INLINE void free_primitive_entities (type *primitive);
158 INLINE void free_class_attrs (type *clss);
159 INLINE void free_struct_attrs (type *strct);
160 INLINE void free_method_attrs (type *method);
161 INLINE void free_union_attrs (type *uni);
162 INLINE void free_array_attrs (type *array);
163 INLINE void free_enumeration_attrs(type *enumeration);
164 INLINE void free_pointer_attrs (type *pointer);
165 INLINE void free_primitive_attrs (type *primitive);
168 /** initialize the type module */
169 void init_type (void);
171 # endif /* _TYPE_T_H_ */