Commit cd910e1f authored by Christoph Mallon's avatar Christoph Mallon
Browse files

tr: Remove the self-initialisation of method entities with its own address.

It is unused.
parent 964eae88
......@@ -185,8 +185,7 @@ FIRM_API int entity_has_definition(const ir_entity *entity);
*
* Automatically inserts the entity as a member of owner.
* 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.
* is type_method, then it is static_allocated and constant.
* Visibility is local, offset -1, and it is not volatile.
*/
FIRM_API ir_entity *new_entity(ir_type *owner, ident *name, ir_type *tp);
......
......@@ -430,13 +430,6 @@ static void add_method_address_inititializer(ir_initializer_t *initializer,
*/
static void add_method_address(ir_entity *ent, pset *set)
{
/* ignore methods: these of course reference their addresses
* TODO: remove this later once this incorrect self-initialisation is gone
*/
ir_type *tp = get_entity_type(ent);
if (is_Method_type(tp))
return;
if (ent->initializer != NULL) {
add_method_address_inititializer(get_entity_initializer(ent), set);
}
......
......@@ -773,13 +773,6 @@ static void check_initializer_nodes(ir_initializer_t *initializer)
*/
static void check_initializer(ir_entity *ent)
{
/* Beware: Methods are always initialized with "themself". This does not
* count as a taken address.
* TODO: this initialisation with "themself" is wrong and should be removed
*/
if (is_Method_type(get_entity_type(ent)))
return;
if (ent->initializer != NULL) {
check_initializer_nodes(ent->initializer);
}
......
......@@ -62,12 +62,9 @@ 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();
res = intern_new_entity(owner, IR_ENTITY_METHOD, name, type);
ir_node *const val = new_r_Address(irg, res);
set_atomic_ent_value(res, val);
res->linkage = IR_LINKAGE_CONSTANT;
res->attr.mtd_attr.properties = get_method_additional_properties(type);
res = intern_new_entity(owner, IR_ENTITY_METHOD, name, type);
res->linkage = IR_LINKAGE_CONSTANT;
res->attr.mtd_attr.properties = get_method_additional_properties(type);
res->attr.mtd_attr.vtable_number = IR_VTABLE_NUM_NOT_SET;
res->attr.mtd_attr.param_access = NULL;
res->attr.mtd_attr.param_weight = NULL;
......@@ -590,13 +587,12 @@ static void check_entity_initializer(ir_entity *entity)
case IR_INITIALIZER_COMPOUND:
assert(is_aggregate_type(entity_tp));
break;
case IR_INITIALIZER_CONST:
/* methods are initialized by an Address */
assert(is_atomic_type(entity_tp) || is_Method_type(entity_tp));
break;
case IR_INITIALIZER_TARVAL:
assert(is_atomic_type(entity_tp));
break;
case IR_INITIALIZER_NULL:
break;
}
......
......@@ -101,13 +101,14 @@ static void do_type_walk(ir_type *const tp, ir_entity *const ent,
break;
}
case IR_ENTITY_METHOD:
case IR_ENTITY_NORMAL:
/* walk over the value types */
if (ent->initializer != NULL) {
walk_initializer(ent->initializer, pre, post, env);
}
break;
case IR_ENTITY_METHOD:
case IR_ENTITY_UNKNOWN:
case IR_ENTITY_PARAMETER:
case IR_ENTITY_LABEL:
......
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