6 #include <libfirm/firm_types.h>
14 struct obstack *type_obst;
30 /* note that the constant values represent the rank of the types as defined
33 ATOMIC_TYPE_INVALID = 0,
45 ATOMIC_TYPE_ULONGLONG,
48 ATOMIC_TYPE_LONG_DOUBLE,
50 #ifdef PROVIDE_COMPLEX
51 ATOMIC_TYPE_FLOAT_COMPLEX,
52 ATOMIC_TYPE_DOUBLE_COMPLEX,
53 ATOMIC_TYPE_LONG_DOUBLE_COMPLEX,
54 ATOMIC_TYPE_FLOAT_IMAGINARY,
55 ATOMIC_TYPE_DOUBLE_IMAGINARY,
56 ATOMIC_TYPE_LONG_DOUBLE_IMAGINARY,
61 TYPE_QUALIFIER_NONE = 0,
62 TYPE_QUALIFIER_CONST = 1 << 0,
63 TYPE_QUALIFIER_RESTRICT = 1 << 1,
64 TYPE_QUALIFIER_VOLATILE = 1 << 2,
67 typedef unsigned int type_qualifiers_t;
71 type_qualifiers_t qualifiers;
76 struct atomic_type_t {
78 atomic_type_type_t atype;
81 struct builtin_type_t {
87 struct pointer_type_t {
100 struct function_parameter_t {
102 function_parameter_t *next;
105 struct function_type_t {
108 function_parameter_t *parameters;
110 bool unspecified_parameters;
113 struct compound_type_t {
115 /** the declaration of the compound type, its context field
116 * contains the compound entries. */
117 declaration_t *declaration;
122 /** the declaration of the enum type. You can find the enum entries by
123 * walking the declaration->next list until you don't find
124 * STORAGE_CLASS_ENUM_ENTRY declarations anymore */
125 declaration_t *declaration;
128 struct typedef_type_t {
130 declaration_t *declaration;
131 type_t *resolved_type;
134 struct typeof_type_t {
136 expression_t *expression;
138 type_t *resolved_type;
141 type_t *make_atomic_type(atomic_type_type_t type, type_qualifiers_t qualifiers);
142 type_t *make_pointer_type(type_t *points_to, type_qualifiers_t qualifiers);
144 static inline bool is_type_atomic(const type_t *type, atomic_type_type_t atype)
146 if(type->type != TYPE_ATOMIC)
148 const atomic_type_t *atomic_type = (const atomic_type_t*) type;
150 return atomic_type->atype == atype;
153 static inline bool is_type_pointer(const type_t *type)
155 return type->type == TYPE_POINTER;
158 static inline bool is_type_compound(const type_t *type)
160 return type->type == TYPE_COMPOUND_STRUCT
161 || type->type == TYPE_COMPOUND_UNION;