Fixed entity_nr in copy methods
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 25 Feb 2003 10:00:40 +0000 (10:00 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Tue, 25 Feb 2003 10:00:40 +0000 (10:00 +0000)
Visibility of type/entity nr, comments

[r826]

ir/tr/entity.c
ir/tr/entity.h
ir/tr/type.c
ir/tr/type.h
ir/tr/typewalk.h

index 7c57f22..24cee47 100644 (file)
@@ -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);
 
index 3d0f3a7..55c4560 100644 (file)
@@ -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);
 
index 947ab90..ec52790 100644 (file)
@@ -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));
index 3d39f91..a8a5917 100644 (file)
@@ -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);
 
index e00a36b..85ddef0 100644 (file)
@@ -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,