Commit 388843af authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ident: Use new_id_fmt() instead of snprintf() + new_id_from_str().

parent af027d18
......@@ -2820,9 +2820,7 @@ static void amd64_create_stacklayout(ir_graph *irg, const x86_cconv_t *cconv)
if (param->type == NULL)
continue;
char buf[128];
snprintf(buf, sizeof(buf), "param_%u", (unsigned)p);
ident *id = new_id_from_str(buf);
ident *const id = new_id_fmt("param_%u", (unsigned)p);
param->entity = new_entity(arg_type, id, param->type);
set_entity_offset(param->entity, param->offset);
}
......
......@@ -1721,9 +1721,7 @@ static void create_stacklayout(ir_graph *irg)
if (param->type == NULL)
continue;
char buf[128];
snprintf(buf, sizeof(buf), "param_%u", p);
ident *id = new_id_from_str(buf);
ident *const id = new_id_fmt("param_%u", p);
param->entity = new_entity(arg_type, id, param->type);
set_entity_offset(param->entity, param->offset);
}
......
......@@ -73,9 +73,5 @@ void finish_ident(void)
ident *id_unique(const char *tag)
{
static unsigned unique_id = 0;
char buf[256];
snprintf(buf, sizeof(buf), tag, unique_id);
unique_id++;
return new_id_from_str(buf);
return new_id_fmt(tag, unique_id++);
}
......@@ -79,11 +79,8 @@ static void replace_with_call(ir_node *node)
ir_node *call_res;
ir_entity *entity;
ir_node *call;
ident *id;
char buf[64];
snprintf(buf, sizeof(buf), "__%s%s2", name, gcc_machmode);
id = new_id_from_str(buf);
ident *const id = new_id_fmt("__%s%s2", name, gcc_machmode);
entity = pmap_get(ir_entity, entities, id);
if (entity == NULL) {
......
......@@ -264,16 +264,11 @@ static ir_node *create_softfloat_address(const ir_node *n, const char *name)
assert(float_types <= 3);
assert(double_types <= 3);
char buf[16];
if (float_types + double_types > 1)
snprintf(buf, sizeof(buf), "__%s%s%s%s%u", name, first_param,
second_param, result, float_types + double_types);
else
snprintf(buf, sizeof(buf), "__%s%s%s%s", name, first_param,
second_param, result);
ident *const id = float_types + double_types > 1 ?
new_id_fmt("__%s%s%s%s%u", name, first_param, second_param, result, float_types + double_types) :
new_id_fmt("__%s%s%s%s", name, first_param, second_param, result);
ir_graph *const irg = get_irn_irg(n);
ident *const id = new_id_from_str(buf);
ir_entity *const ent = create_compilerlib_entity(id, method);
return new_r_Address(irg, ent);
}
......
......@@ -79,16 +79,9 @@ ir_entity *new_entity(ir_type *owner, ident *name, ir_type *type)
return res;
}
static ident *make_parameter_entity_name(size_t pos)
{
char buf[64];
snprintf(buf, sizeof(buf), "parameter.%lu", (unsigned long) pos);
return new_id_from_str(buf);
}
ir_entity *new_parameter_entity(ir_type *owner, size_t pos, ir_type *type)
{
ident *name = make_parameter_entity_name(pos);
ident *name = new_id_fmt("parameter.%lu", (unsigned long)pos);
ir_entity *res = intern_new_entity(owner, IR_ENTITY_PARAMETER, name, type);
res->attr.compound_member.offset = -1;
res->attr.parameter.number = pos;
......
......@@ -1252,9 +1252,7 @@ ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment,
if (irp->byte_type == NULL)
irp->byte_type = new_type_primitive(mode_Bu);
char buf[32];
snprintf(buf, sizeof(buf), "area%u", area_cnt++);
ident *name = new_id_from_str(buf);
ident *const name = new_id_fmt("area%u", area_cnt++);
ir_type *tp = new_type_array(irp->byte_type);
set_array_size_int(tp, size);
......
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