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

Always use unique numbers for entities.

Do not use the entity address as number because that makes things
nondeterministic.

Patch submitted by Rich Felker <dalias@aerifal.cx>
parent 86c405f6
...@@ -46,9 +46,7 @@ static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind, ...@@ -46,9 +46,7 @@ static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
res->aligned = align_is_aligned; res->aligned = align_is_aligned;
res->usage = ir_usage_unknown; res->usage = ir_usage_unknown;
res->visibility = ir_visibility_external; res->visibility = ir_visibility_external;
#ifdef DEBUG_libfirm
res->nr = get_irp_new_node_nr(); res->nr = get_irp_new_node_nr();
#endif
/* Remember entity in its owner. */ /* Remember entity in its owner. */
add_compound_member(owner, res); add_compound_member(owner, res);
...@@ -166,9 +164,7 @@ static ir_entity *deep_entity_copy(ir_entity *old) ...@@ -166,9 +164,7 @@ static ir_entity *deep_entity_copy(ir_entity *old)
newe->overwrites = NULL; newe->overwrites = NULL;
newe->overwrittenby = NULL; newe->overwrittenby = NULL;
#ifdef DEBUG_libfirm
newe->nr = get_irp_new_node_nr(); newe->nr = get_irp_new_node_nr();
#endif
hook_new_entity(newe); hook_new_entity(newe);
return newe; return newe;
} }
...@@ -218,11 +214,7 @@ void free_entity(ir_entity *ent) ...@@ -218,11 +214,7 @@ void free_entity(ir_entity *ent)
long get_entity_nr(const ir_entity *ent) long get_entity_nr(const ir_entity *ent)
{ {
assert(ent->kind == k_entity); assert(ent->kind == k_entity);
#ifdef DEBUG_libfirm
return ent->nr; return ent->nr;
#else
return (long)PTR_TO_INT(ent);
#endif
} }
const char *(get_entity_name)(const ir_entity *ent) const char *(get_entity_name)(const ir_entity *ent)
......
...@@ -185,11 +185,7 @@ struct ir_entity { ...@@ -185,11 +185,7 @@ struct ir_entity {
ir_entity **overwrites; /**< A list of entities this entity overwrites. */ ir_entity **overwrites; /**< A list of entities this entity overwrites. */
ir_entity **overwrittenby; /**< A list of entities that overwrite this ir_entity **overwrittenby; /**< A list of entities that overwrite this
entity. */ entity. */
long nr; /**< A unique number for each entity. */
#ifdef DEBUG_libfirm
long nr; /**< A unique node number for each node to make output
readable. */
#endif
union { union {
/** attributes for normal entities */ /** attributes for normal entities */
......
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