static entity_t **inner_functions;
static ir_node *ijmp_list;
static bool constant_folding;
+static bool initializer_use_bitfield_basetype;
extern bool have_const_functions;
if (is_type_compound(initializer->value->base.type)) {
panic("initializer creation for compounds not implemented yet");
}
- ir_node *value = expression_to_firm(initializer->value);
- type_t *type = initializer->value->base.type;
+ type_t *type = initializer->value->base.type;
+ expression_t *expr = initializer->value;
+ if (initializer_use_bitfield_basetype) {
+ type_t *skipped = skip_typeref(type);
+ if (skipped->kind == TYPE_BITFIELD) {
+ /* remove the bitfield cast... */
+ assert(expr->kind == EXPR_UNARY_CAST_IMPLICIT);
+ expr = expr->unary.value;
+ type = skipped->bitfield.base_type;
+ }
+ }
+ ir_node *value = expression_to_firm(expr);
ir_mode *mode = get_ir_mode_storage(type);
value = create_conv(NULL, value, mode);
return create_initializer_const(value);
}
if (!is_constant_initializer(initializer)) {
+ bool old_initializer_use_bitfield_basetype
+ = initializer_use_bitfield_basetype;
+ initializer_use_bitfield_basetype = true;
ir_initializer_t *irinitializer
= create_ir_initializer(initializer, type);
+ initializer_use_bitfield_basetype
+ = old_initializer_use_bitfield_basetype;
create_dynamic_initializer(irinitializer, dbgi, entity);
return;
&expression->base.source_position);
initializer_t *const result = allocate_initializer_zero(INITIALIZER_VALUE);
-#if 0
- if (type->kind == TYPE_BITFIELD) {
- type = type->bitfield.base_type;
- }
-#endif
result->value.value = create_implicit_cast(expression, type);
return result;