case TYPE_ENUM:
firm_type = create_enum_type(&type->enumt);
break;
- case TYPE_BUILTIN:
- firm_type = get_ir_type(type->builtin.real_type);
- break;
case TYPE_BITFIELD:
firm_type = create_bitfield_type(&type->bitfield);
break;
/* gcc classifies the referenced type */
case TYPE_REFERENCE: type = type->reference.refers_to; continue;
- case TYPE_BUILTIN:
/* typedef/typeof should be skipped already */
case TYPE_TYPEDEF:
case TYPE_TYPEOF:
panic("invalid type encountered while mangling");
case TYPE_ERROR:
panic("error type encountered while mangling");
- case TYPE_BUILTIN:
case TYPE_TYPEDEF:
case TYPE_TYPEOF:
panic("typeref not resolved while manging?!?");
(is_type_atomic(type_left, ATOMIC_TYPE_BOOL)
&& is_type_pointer(type_right))) {
return ASSIGN_SUCCESS;
- } else if ((is_type_compound(type_left) && is_type_compound(type_right))
- || (is_type_builtin(type_left) && is_type_builtin(type_right))) {
+ } else if (is_type_compound(type_left) && is_type_compound(type_right)) {
type_t *const unqual_type_left = get_unqualified_type(type_left);
type_t *const unqual_type_right = get_unqualified_type(type_right);
if (types_compatible(unqual_type_left, unqual_type_right)) {
SPECIFIER_IMAGINARY = 1 << 18,
} specifiers_t;
-static type_t *create_builtin_type(symbol_t *const symbol,
- type_t *const real_type)
-{
- type_t *type = allocate_type_zero(TYPE_BUILTIN);
- type->builtin.symbol = symbol;
- type->builtin.real_type = real_type;
- return identify_new_type(type);
-}
-
static type_t *get_typedef_type(symbol_t *symbol)
{
entity_t *entity = get_entity(symbol, NAMESPACE_NORMAL);
init_expression_parsers();
obstack_init(&temp_obst);
-
- symbol_t *const va_list_sym = symbol_table_insert("__builtin_va_list");
- type_valist = create_builtin_type(va_list_sym, type_void_ptr);
}
/**
[TYPE_FUNCTION] = sizeof(function_type_t),
[TYPE_POINTER] = sizeof(pointer_type_t),
[TYPE_ARRAY] = sizeof(array_type_t),
- [TYPE_BUILTIN] = sizeof(builtin_type_t),
[TYPE_TYPEDEF] = sizeof(typedef_type_t),
[TYPE_TYPEOF] = sizeof(typeof_type_t),
};
case TYPE_COMPOUND_UNION:
print_compound_type(&type->compound);
return;
- case TYPE_BUILTIN:
- print_string(type->builtin.symbol->string);
- return;
case TYPE_FUNCTION:
print_function_type_pre(&type->function);
return;
case TYPE_ENUM:
case TYPE_COMPOUND_STRUCT:
case TYPE_COMPOUND_UNION:
- case TYPE_BUILTIN:
case TYPE_TYPEOF:
case TYPE_TYPEDEF:
break;
{
assert(!is_typeref(type));
- switch (type->kind) {
- case TYPE_POINTER: return true;
- case TYPE_BUILTIN: return is_type_scalar(type->builtin.real_type);
- default: break;
- }
+ if (type->kind == TYPE_POINTER)
+ return true;
return is_type_arithmetic(type);
}
case TYPE_FUNCTION:
case TYPE_POINTER:
case TYPE_REFERENCE:
- case TYPE_BUILTIN:
case TYPE_ERROR:
return false;
return !is_type_function(type) && !is_type_incomplete(type);
}
-bool is_builtin_va_list(type_t *type)
-{
- type_t *tp = skip_typeref(type);
-
- return tp->kind == type_valist->kind &&
- tp->builtin.symbol == type_valist->builtin.symbol;
-}
-
/**
* Check if two function types are compatible.
*/
break;
}
case TYPE_ENUM:
- case TYPE_BUILTIN:
/* TODO: not implemented */
break;
}
case TYPE_BITFIELD:
return 0;
- case TYPE_BUILTIN:
- return get_type_size(type->builtin.real_type);
case TYPE_TYPEDEF:
return get_type_size(type->typedeft.typedefe->type);
case TYPE_TYPEOF:
return get_type_alignment(type->array.element_type);
case TYPE_BITFIELD:
return 0;
- case TYPE_BUILTIN:
- return get_type_alignment(type->builtin.real_type);
case TYPE_TYPEDEF: {
il_alignment_t alignment
= get_type_alignment(type->typedeft.typedefe->type);
case TYPE_BITFIELD:
case TYPE_ARRAY:
return 0;
- case TYPE_BUILTIN:
- return get_type_modifiers(type->builtin.real_type);
case TYPE_TYPEDEF: {
decl_modifiers_t modifiers = type->typedeft.typedefe->modifiers;
modifiers |= get_type_modifiers(type->typedeft.typedefe->type);
bool is_type_object(const type_t *type);
-/**
- * returns true if teh type is the builtin va_list type.
- */
-bool is_builtin_va_list(type_t *type);
-
bool types_compatible(const type_t *type1, const type_t *type2);
type_t *get_unqualified_type(type_t *type);
case TYPE_ARRAY:
hash = hash_array_type(&type->array);
break;
- case TYPE_BUILTIN:
- hash = hash_ptr(type->builtin.symbol);
- break;
case TYPE_TYPEDEF:
hash = hash_ptr(type->typedeft.typedefe);
break;
return false;
}
-static bool builtin_types_equal(const builtin_type_t *type1,
- const builtin_type_t *type2)
-{
- return type1->symbol == type2->symbol;
-}
-
static bool compound_types_equal(const compound_type_t *type1,
const compound_type_t *type2)
{
return reference_types_equal(&type1->reference, &type2->reference);
case TYPE_ARRAY:
return array_types_equal(&type1->array, &type2->array);
- case TYPE_BUILTIN:
- return builtin_types_equal(&type1->builtin, &type2->builtin);
case TYPE_TYPEOF:
return typeof_types_equal(&type1->typeoft, &type2->typeoft);
case TYPE_TYPEDEF:
TYPE_REFERENCE,
TYPE_ARRAY,
TYPE_BITFIELD,
- TYPE_BUILTIN,
TYPE_TYPEDEF,
TYPE_TYPEOF,
} type_kind_t;
atomic_type_kind_t akind;
};
-struct builtin_type_t {
- type_base_t base;
- symbol_t *symbol;
- type_t *real_type;
-};
-
struct pointer_type_t {
type_base_t base;
type_t *points_to;
atomic_type_t atomic;
complex_type_t complex;
imaginary_type_t imaginary;
- builtin_type_t builtin;
pointer_type_t pointer;
reference_type_t reference;
array_type_t array;
return type->kind == TYPE_COMPOUND_STRUCT;
}
-static inline bool is_type_builtin(const type_t *type)
-{
- assert(!is_typeref(type));
- return type->kind == TYPE_BUILTIN;
-}
-
static inline bool is_type_compound(const type_t *type)
{
assert(!is_typeref(type));
type_long_long_ptr = make_pointer_type(type_long_long, TYPE_QUALIFIER_NONE);
type_char_ptr_ptr = make_pointer_type(type_char_ptr, TYPE_QUALIFIER_NONE);
+ type_valist = type_void_ptr;
/* const character types */
type_const_char = make_atomic_type(ATOMIC_TYPE_CHAR, TYPE_QUALIFIER_CONST);
case TYPE_ENUM:
write_enum_type(&type->enumt);
return;
- case TYPE_BUILTIN:
- write_type(type->builtin.real_type);
- return;
case TYPE_ERROR:
case TYPE_INVALID:
case TYPE_TYPEOF: