From: Götz Lindenmaier Date: Tue, 9 Nov 2004 18:23:00 +0000 (+0000) Subject: inproved, commented X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=3bcbfec36f89ae53617d216824c72a01c9034abb;p=libfirm inproved, commented [r4340] --- diff --git a/ir/tr/entity.c b/ir/tr/entity.c index c20618bcb..91041533a 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -46,7 +46,10 @@ void init_entity (void) { assert(unknown_type && "Call init_type before init_entity!"); - new_rd_entity(NULL, unknown_type, new_id_from_str(UNKNOWN_ENTITY_NAME), unknown_type); + assert(!unknown_entity && "Call init_entity only once!"); + unknown_entity = new_rd_entity(NULL, unknown_type, new_id_from_str(UNKNOWN_ENTITY_NAME), unknown_type); + set_entity_visibility(unknown_entity, visibility_external_allocated); + set_entity_ld_ident(unknown_entity, get_entity_ident(unknown_entity)); } diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 216aca99d..9de7abb6f 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -540,11 +540,29 @@ entity *resolve_ent_polymorphy(type *dynamic_class, entity* static_ent); * exactly one entity unknown. This entity has as owner and as type the unknown type. It is * allocated when initializing the entity module. * + * The entity can take the role of any entity, also methods. It returns default + * values in these cases. + * * The following values are set: - * mode: mode_ANY - * name: "type_unknown" - * state: layout_fixed - * size: 0 + * name = "unknown_entity" + * ld_name = "unknown_entity" + * owner = unknown_type + * type = unknown_type + * visibility = visibility_external_allocated + * offset = -1 + * variability = variability_uninitialized + * value = NULL + * values = NULL + * val_paths = NULL + * peculiarity = peculiarity_existent + * volatility = volatility_non_volatile + * stickyness = stickyness_unsticky + * ld_name = NULL + * overwrites = NULL + * overwrittenby = NULL + * irg = NULL + * link = NULL + * */ /* A variable that contains the only unknown entity. */ extern entity *unknown_entity; diff --git a/ir/tr/entity_t.h b/ir/tr/entity_t.h index cf52d889d..41309a7d1 100644 --- a/ir/tr/entity_t.h +++ b/ir/tr/entity_t.h @@ -283,7 +283,7 @@ __set_entity_link(entity *ent, void *l) { static INLINE ir_graph * __get_entity_irg(const entity *ent) { assert(ent && ent->kind == k_entity); - assert(is_method_type(ent->type)); + assert(ent == unknown_entity || is_method_type(ent->type)); return ent->irg; }