Commit d5180400 authored by Matthias Braun's avatar Matthias Braun
Browse files

Put unknown entity and jumptables into a dummy owner type

- This way we can keep up the invariant that all entities are childs to
  a compound type
parent e7c0c928
......@@ -1145,8 +1145,9 @@ static ir_node *gen_Switch(ir_node *node)
const ir_switch_table *table = get_Switch_table(node);
unsigned n_outs = get_Switch_n_outs(node);
ir_type *const utype = get_unknown_type();
ir_entity *const entity = new_entity(utype, id_unique("TBL%u"), utype);
ir_type *const utype = get_unknown_type();
ir_entity *const entity
= new_entity(irp->dummy_owner, id_unique("TBL%u"), utype);
set_entity_visibility(entity, ir_visibility_private);
add_entity_linkage(entity, IR_LINKAGE_CONSTANT);
......
......@@ -2749,8 +2749,9 @@ static ir_node *gen_Switch(ir_node *node)
if (get_mode_size_bits(sel_mode) < 32)
new_sel = transform_upconv(sel, node);
ir_type *const utype = get_unknown_type();
ir_entity *const entity = new_entity(utype, id_unique("TBL%u"), utype);
ir_type *const utype = get_unknown_type();
ir_entity *const entity
= new_entity(irp->dummy_owner, id_unique("TBL%u"), utype);
set_entity_visibility(entity, ir_visibility_private);
add_entity_linkage(entity, IR_LINKAGE_CONSTANT);
......
......@@ -1479,8 +1479,9 @@ static ir_node *gen_Switch(ir_node *node)
/* switch with smaller mode not implemented yet */
assert(get_mode_size_bits(get_irn_mode(selector)) == 32);
ir_type *const utype = get_unknown_type();
ir_entity *const entity = new_entity(utype, id_unique("TBL%u"), utype);
ir_type *const utype = get_unknown_type();
ir_entity *const entity
= new_entity(irp->dummy_owner, id_unique("TBL%u"), utype);
set_entity_visibility(entity, ir_visibility_private);
add_entity_linkage(entity, IR_LINKAGE_CONSTANT);
......
......@@ -106,8 +106,6 @@ void free_ir_prog(void)
for (size_t i = get_irp_n_types(); i > 0;)
free_type_entities(get_irp_type(--i));
ir_finish_entity(irp);
for (size_t i = get_irp_n_types(); i > 0;)
free_type(get_irp_type(--i));
......
......@@ -585,6 +585,7 @@ struct ir_prog {
ir_type **types; /**< A list of all types in the ir. */
ir_type *code_type; /**< unique 'code'-type */
ir_type *unknown_type; /**< unique 'unknown'-type */
ir_type *dummy_owner; /**< owner for internal entities */
ir_type *byte_type; /**< type for a 'byte' */
ident **global_asms; /**< An array of global ASM insertions. */
......
......@@ -52,8 +52,7 @@ static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
#endif
/* Remember entity in its owner. */
if (is_compound_type(owner))
add_compound_member(owner, res);
add_compound_member(owner, res);
res->visit = 0;
return res;
......@@ -936,13 +935,9 @@ void ir_init_entity(ir_prog *irp)
{
ident *const id = new_id_from_str(UNKNOWN_ENTITY_NAME);
ir_type *const utype = get_unknown_type();
irp->unknown_entity = intern_new_entity(utype, IR_ENTITY_UNKNOWN, id, utype);
irp->unknown_entity = intern_new_entity(irp->dummy_owner, IR_ENTITY_UNKNOWN,
id, utype);
set_entity_visibility(irp->unknown_entity, ir_visibility_external);
set_entity_ld_ident(irp->unknown_entity, id);
hook_new_entity(irp->unknown_entity);
}
void ir_finish_entity(ir_prog *irp)
{
free_entity(irp->unknown_entity);
}
......@@ -219,8 +219,6 @@ struct ir_entity {
/** Initialize the entity module. */
void ir_init_entity(ir_prog *irp);
/** Cleanup entity module */
void ir_finish_entity(ir_prog *irp);
/**
* Creates an entity corresponding to the start address of a basic block
......
......@@ -68,6 +68,8 @@ void ir_init_type(ir_prog *irp)
irp->unknown_type = new_type(tpop_unknown, mode_ANY);
set_type_state (irp->unknown_type, layout_fixed);
irp->dummy_owner = new_type_struct(new_id_from_str("$dummy_owner$"));
}
void ir_finish_type(ir_prog *irp)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment