From: Götz Lindenmaier Date: Tue, 25 Feb 2003 10:00:40 +0000 (+0000) Subject: Fixed entity_nr in copy methods X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=51977d52c191e6e94871a12a9928fda8766c90cb;p=libfirm Fixed entity_nr in copy methods Visibility of type/entity nr, comments [r826] --- diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 7c57f22b7..24cee47c8 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -36,7 +36,10 @@ init_entity (void) /** ENTITY **/ /*******************************************************************/ -INLINE type *get_entity_owner (entity *ent); +/* redeclared to declare INLINE. */ +INLINE entity *get_entity_overwrites (entity *ent, int pos); +INLINE entity *get_entity_overwrittenby (entity *ent, int pos); +INLINE type *get_entity_owner (entity *ent); INLINE void insert_entity_in_owner (entity *ent) { type *owner = ent->owner; @@ -142,6 +145,9 @@ copy_entity_own (entity *old, type *new_owner) { new->overwrites = NEW_ARR_F(entity *, 1); new->overwrittenby = NEW_ARR_F(entity *, 1); } +#ifdef DEBUG_libfirm + new->nr = get_irp_new_node_nr(); +#endif insert_entity_in_owner (new); @@ -157,8 +163,13 @@ copy_entity_name (entity *old, ident *new_name) { memcpy (new, old, sizeof (entity)); new->name = new_name; new->ld_name = NULL; - new->overwrites = DUP_ARR_F(entity *, old->overwrites); - new->overwrittenby = DUP_ARR_F(entity *, old->overwrittenby); + if (is_class_type(new->owner)) { + new->overwrites = DUP_ARR_F(entity *, old->overwrites); + new->overwrittenby = DUP_ARR_F(entity *, old->overwrittenby); + } +#ifdef DEBUG_libfirm + new->nr = get_irp_new_node_nr(); +#endif insert_entity_in_owner (new); diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 3d0f3a74a..55c4560a3 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -325,6 +325,10 @@ int is_compound_entity(entity *ent); bool equal_entity(entity *ent1, entity *ent2); +/** Outputs a unique number for this entity if libfirm is compiled for + debugging, (configure with --enable-debug) else returns 0. */ +INLINE long get_entity_nr(entity *ent); + unsigned long get_entity_visited(entity *ent); void set_entity_visited(entity *ent, unsigned long num); diff --git a/ir/tr/type.c b/ir/tr/type.c index 947ab901b..ec527909e 100644 --- a/ir/tr/type.c +++ b/ir/tr/type.c @@ -212,7 +212,7 @@ void set_type_state(type *tp, type_state state) { assert(tp && tp->kind == k_type); - if ((tp->type_op == type_pointer) && (tp->type_op == type_primitive) && + if ((tp->type_op == type_pointer) || (tp->type_op == type_primitive) || (tp->type_op == type_method)) return; @@ -232,7 +232,7 @@ set_type_state(type *tp, type_state state) { } break; case tpo_struct: { - /* assert(get_type_size(tp) > -1); @@@ lowerfirm geht nicht durch */ + assert(get_type_size(tp) > -1); for (i = 0; i < get_struct_n_members(tp); i++) { assert(get_entity_offset(get_struct_member(tp, i)) > -1); assert((get_entity_allocation(get_struct_member(tp, i)) == automatic_allocated)); diff --git a/ir/tr/type.h b/ir/tr/type.h index 3d39f9105..a8a5917d8 100644 --- a/ir/tr/type.h +++ b/ir/tr/type.h @@ -610,7 +610,7 @@ int is_atomic_type(type *tp); int is_compound_type(type *tp); -/** Outputs a unique number for this node if libfirm is compiled for +/** Outputs a unique number for this type if libfirm is compiled for debugging, (configure with --enable-debug) else returns 0. */ INLINE long get_type_nr(type *tp); diff --git a/ir/tr/typewalk.h b/ir/tr/typewalk.h index e00a36bb3..85ddef08c 100644 --- a/ir/tr/typewalk.h +++ b/ir/tr/typewalk.h @@ -49,7 +49,11 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env); -/** walks over all type information reachable from irg */ +/** Walks over all type information reachable from an ir graph. + * + * Walks over all type information reachable from irg, i.e., starts a + * type walk at the irgs entity, the irgs frame type and all types and + * entities that are attributes to firm nodes. */ void type_walk_irg(ir_graph *irg, type_walk_func *pre, type_walk_func *post,