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 */
53 /** union attributs */
56 /* type **unioned_type; * a list of unioned types. */
57 /* ident **delim_names; * names of the union delimiters. */
58 entity **members; /**< fields of this union. No method entities
63 /** array attributs */
65 int n_dimensions; /**< Number of array dimensions. */
66 ir_node **lower_bound; /**< Lower bounds of dimensions. Usually all 0. */
67 ir_node **upper_bound; /**< Upper bounds or dimensions. */
68 int *order; /**< Ordering of dimensions. */
69 type *element_type; /**< The type of the array elements. */
70 entity *element_ent; /**< Entity for the array elements, to be used for
71 element selection with Sel. */
76 int n_enums; /**< Number of enumerators. */
77 tarval **enumer; /**< Contains all constants that represent a member
78 of the enum -- enumerators. */
79 ident **enum_nameid;/**< Contains the names of the enum fields as specified by
83 /** pointer attributs */
85 type *points_to; /**< The type of the enitity the pointer points to. */
89 typedef struct { * No private attr yet! *
94 typedef struct { * No private attr, must be smaller than others! *
98 /** general type attributs */
109 /** the structure of a type */
114 type_state state; /**< Represents the types state: layout undefined or
116 int size; /**< Size of an entity of this type. This is determined
117 when fixing the layout of this class. Size must be
119 ir_mode *mode; /**< The mode for atomic types */
120 unsigned long visit; /**< visited counter for walks of the type information */
121 void *link; /**< holds temporary data - like in irnode_t.h */
122 struct dbg_info* dbi; /**< A pointer to information for debug support. */
125 int nr; /**< a unique node number for each node to make output
128 tp_attr attr; /* type kind specific fields. This must be the last
129 entry in this struct! Varying size! */
133 * Creates a new type representation:
135 * @param type_op - the kind of this type. May not be type_id.
136 * @param mode - the mode to be used for this type, may be NULL
137 * @param name - an ident for the name of this type.
138 * @return a new type of the given type. The remaining private attributes are not
139 * @return initalized. The type is in state layout_undefined.
143 new_type(tp_op *type_op,
146 void free_type_attrs (type *tp);
148 INLINE void free_class_attrs (type *clss);
149 INLINE void free_struct_attrs (type *strct);
150 INLINE void free_method_attrs (type *method);
151 INLINE void free_union_attrs (type *uni);
152 INLINE void free_array_attrs (type *array);
153 INLINE void free_enumeration_attrs(type *enumeration);
154 INLINE void free_pointer_attrs (type *pointer);
155 INLINE void free_primitive_attrs (type *primitive);
158 /** initialize the type module */
159 void init_type (void);
161 # endif /* _TYPE_T_H_ */