get_address_taken_state_name() added
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 7 Jan 2007 22:52:22 +0000 (22:52 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 7 Jan 2007 22:52:22 +0000 (22:52 +0000)
Fixed bitfield size (need an extra bit for the sign :-(

[r8496]

ir/tr/entity.c
ir/tr/entity.h
ir/tr/entity_t.h

index de0387c..38f4ef0 100644 (file)
@@ -6,7 +6,7 @@
  * Modified by: Goetz Lindenmaier, Michael Beck
  * Created:
  * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2006 Universität Karlsruhe
+ * Copyright:   (c) 1998-2007 Universität Karlsruhe
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 #ifdef HAVE_CONFIG_H
@@ -365,7 +365,6 @@ const char *get_allocation_name(ir_allocation all)
 #undef X
 }  /* get_allocation_name */
 
-
 ir_visibility
 (get_entity_visibility)(const ir_entity *ent) {
        return _get_entity_visibility(ent);
@@ -504,6 +503,18 @@ void (set_entity_address_taken)(ir_entity *ent, ir_address_taken_state flag) {
        _set_entity_address_taken(ent, flag);
 }  /* set_entity_address_taken */
 
+/* Return the name of the address_taken state. */
+const char *get_address_taken_state_name(ir_address_taken_state state) {
+#define X(a)    case a: return #a
+       switch (state) {
+       X(ir_address_not_taken);
+       X(ir_address_taken_unknown);
+       X(ir_address_taken);
+    default: return "BAD VALUE";
+       }
+#undef X
+}  /* get_address_taken_state_name */
+
 /* Get the entity's stickyness */
 ir_stickyness
 (get_entity_stickyness)(const ir_entity *ent) {
index 22fb1b5..ea0efc2 100644 (file)
@@ -336,6 +336,9 @@ ir_address_taken_state get_entity_address_taken(const ir_entity *ent);
 /** Sets/resets the state of the address taken flag of an entity. */
 void set_entity_address_taken(ir_entity *ent, ir_address_taken_state flag);
 
+/** Return the name of the address_taken state. */
+const char *get_address_taken_state_name(ir_address_taken_state state);
+
 /* -- Representation of constant values of entities -- */
 /**
  * Returns true if the the node is representable as code on
index b5a40a4..b3c0266 100644 (file)
@@ -6,7 +6,7 @@
  * Modified by: Goetz Lindenmaier, Michael Beck
  * Created:
  * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2006 Universität Karlsruhe
+ * Copyright:   (c) 1998-2007 Universität Karlsruhe
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 
@@ -118,7 +118,7 @@ struct ir_entity {
        ir_volatility volatility:2;             /**< Specifies volatility of entities content. */
        ir_stickyness stickyness:2;             /**< Specifies whether this entity is sticky.  */
        ir_peculiarity peculiarity:3;           /**< The peculiarity of this entity. */
-       ir_address_taken_state address_taken:2; /**< A flag that can be set to mark address taken entities. */
+       ir_address_taken_state address_taken:3; /**< A flag that can be set to mark address taken entities. */
        unsigned final:1;              /**< If set, this entity cannot be overridden. */
        unsigned compiler_gen:1;       /**< If set, this entity was compiler generated. */
        int offset;                    /**< Offset in bytes for this entity.  Fixed when layout
@@ -322,9 +322,10 @@ _get_entity_address_taken(const ir_entity *ent) {
 }
 
 static INLINE void
-_set_entity_address_taken(ir_entity *ent, ir_address_taken_state flag) {
+_set_entity_address_taken(ir_entity *ent, ir_address_taken_state state) {
        assert(ent && ent->kind == k_entity);
-       ent->address_taken = flag;
+       assert(ir_address_not_taken <= state && state <= ir_address_taken);
+       ent->address_taken = state;
 }
 
 static INLINE int