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

remove new_d_entity like functions

Entities need not be in their final form after the new_entity call, so
there is no need to have _d variants like we have with all the graph
nodes. You can easily use set_entity_dbg_info() after construction.
parent a2c0f19e
......@@ -191,18 +191,6 @@ FIRM_API int entity_has_definition(const ir_entity *entity);
*/
FIRM_API ir_entity *new_entity(ir_type *owner, ident *name, ir_type *tp);
/**
* Creates a new entity.
*
* Automatically inserts the entity as a member of owner.
* The entity is automatic allocated and uninitialized except if the type
* is type_method, then it is static allocated and constant. The constant
* value is a pointer to the method.
* Visibility is local, offset -1, and it is not volatile.
*/
FIRM_API ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *tp,
dbg_info *db);
/**
* Creates a new entity corresponding to a function parameter.
* This must be created on an irgs frame_type
......@@ -210,12 +198,6 @@ FIRM_API ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *tp,
FIRM_API ir_entity *new_parameter_entity(ir_type *owner, size_t pos,
ir_type *type);
/**
* Like new_parameter_entity() but with debug information.
*/
FIRM_API ir_entity *new_d_parameter_entity(ir_type *owner, size_t pos,
ir_type *type, dbg_info *dbgi);
/**
* Check an entity. Currently, we check only if initialized constants
* are build on the const irg graph.
......
......@@ -309,13 +309,14 @@ static void copy_parameter_entities(ir_node *call, ir_graph *called_graph)
dbg_info *entity_dbgi = get_entity_dbg_info(old_entity);
ident *name = get_entity_ident(old_entity);
name = id_mangle3("", name, "$inlined");
ir_entity *new_entity = new_d_entity(frame_type, name, old_type, entity_dbgi);
set_entity_link(old_entity, new_entity);
ir_entity *new_ent = new_entity(frame_type, name, old_type);
set_entity_dbg_info(new_ent, entity_dbgi);
set_entity_link(old_entity, new_ent);
size_t n_param_pos = get_entity_parameter_number(old_entity);
ir_node *param = get_Call_param(call, n_param_pos);
ir_node *nomem = get_irg_no_mem(irg);
ir_node *sel = new_rd_simpleSel(dbgi, block, nomem, frame, new_entity);
ir_node *sel = new_rd_simpleSel(dbgi, block, nomem, frame, new_ent);
ir_node *new_mem;
if (is_aggregate_type(old_type)) {
/* Copy the compound parameter */
......
......@@ -37,7 +37,7 @@ ir_entity *get_unknown_entity(void)
/*-----------------------------------------------------------------*/
static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
ident *name, ir_type *type, dbg_info *dbgi)
ident *name, ir_type *type)
{
assert(owner != NULL);
......@@ -61,19 +61,16 @@ static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
add_compound_member(owner, res);
res->visit = 0;
set_entity_dbg_info(res, dbgi);
return res;
}
ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *type,
dbg_info *db)
ir_entity *new_entity(ir_type *owner, ident *name, ir_type *type)
{
ir_entity *res;
if (is_Method_type(type)) {
ir_graph *irg = get_const_code_irg();
symconst_symbol sym;
res = intern_new_entity(owner, IR_ENTITY_METHOD, name, type, db);
res = intern_new_entity(owner, IR_ENTITY_METHOD, name, type);
sym.entity_p = res;
set_atomic_ent_value(res, new_r_SymConst(irg, mode_P_code, sym, symconst_addr_ent));
res->linkage = IR_LINKAGE_CONSTANT;
......@@ -83,21 +80,16 @@ ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *type,
res->attr.mtd_attr.param_weight = NULL;
res->attr.mtd_attr.irg = NULL;
} else if (is_compound_type(owner) && !(owner->flags & tf_segment)) {
res = intern_new_entity(owner, IR_ENTITY_COMPOUND_MEMBER, name, type, db);
res = intern_new_entity(owner, IR_ENTITY_COMPOUND_MEMBER, name, type);
res->attr.compound_member.offset = -1;
} else {
res = intern_new_entity(owner, IR_ENTITY_NORMAL, name, type, db);
res = intern_new_entity(owner, IR_ENTITY_NORMAL, name, type);
}
hook_new_entity(res);
return res;
}
ir_entity *new_entity(ir_type *owner, ident *name, ir_type *type)
{
return new_d_entity(owner, name, type, NULL);
}
static ident *make_parameter_entity_name(size_t pos)
{
char buf[64];
......@@ -105,40 +97,27 @@ static ident *make_parameter_entity_name(size_t pos)
return new_id_from_str(buf);
}
ir_entity *new_d_parameter_entity(ir_type *owner, size_t pos, ir_type *type,
dbg_info *dbgi)
ir_entity *new_parameter_entity(ir_type *owner, size_t pos, ir_type *type)
{
ident *name = make_parameter_entity_name(pos);
ir_entity *res
= intern_new_entity(owner, IR_ENTITY_PARAMETER, name, type, dbgi);
ir_entity *res = intern_new_entity(owner, IR_ENTITY_PARAMETER, name, type);
res->attr.compound_member.offset = -1;
res->attr.parameter.number = pos;
hook_new_entity(res);
return res;
}
ir_entity *new_parameter_entity(ir_type *owner, size_t pos, ir_type *type)
{
return new_d_parameter_entity(owner, pos, type, NULL);
}
ir_entity *new_d_label_entity(ir_label_t label, dbg_info *dbgi)
ir_entity *new_label_entity(ir_label_t label)
{
ident *name = id_unique("label_%u");
ir_type *global_type = get_glob_type();
ir_entity *res
= intern_new_entity(global_type, IR_ENTITY_LABEL, name, get_code_type(),
dbgi);
ir_entity *res = intern_new_entity(global_type, IR_ENTITY_LABEL, name,
get_code_type());
res->attr.code_attr.label = label;
hook_new_entity(res);
return res;
}
ir_entity *new_label_entity(ir_label_t label)
{
return new_d_label_entity(label, NULL);
}
/**
* Free entity attributes.
*
......@@ -907,7 +886,7 @@ 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, NULL);
irp->unknown_entity = intern_new_entity(utype, 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);
......
......@@ -207,11 +207,6 @@ void ir_finish_entity(ir_prog *irp);
*/
ir_entity *new_label_entity(ir_label_t label);
/**
* Like new_label_entity() but with debug information.
*/
ir_entity *new_d_label_entity(ir_label_t label, dbg_info *dbgi);
void set_entity_irg(ir_entity *ent, ir_graph *irg);
/* ----------------------- inline functions ------------------------ */
......
Supports Markdown
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