Added some helper functions to show the variability, volatility and peculirity.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 30 Apr 2003 14:49:07 +0000 (14:49 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 30 Apr 2003 14:49:07 +0000 (14:49 +0000)
[r1109]

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

index 6b6fc7a..b01b577 100644 (file)
@@ -319,6 +319,19 @@ set_entity_variability (entity *ent, ent_variability var){
   ent->variability = var;
 }
 
+/* return the name of the variablity */
+const char *get_variablity_name(ent_variability var)
+{
+#define X(a)   case a: return #a
+  switch (var) {
+    X(uninitialized);
+    X(initialized);
+    X(part_constant);
+    X(constant);
+    default: return "BAD VALUE";
+  }
+#undef X
+}
 
 INLINE ent_volatility
 get_entity_volatility (entity *ent) {
@@ -332,6 +345,18 @@ set_entity_volatility (entity *ent, ent_volatility vol) {
   ent->volatility = vol;
 }
 
+/* return the name of the volatility */
+const char *get_volatility_name(ent_volatility var)
+{
+#define X(a)   case a: return #a
+  switch (var) {
+    X(non_volatile);
+    X(is_volatile);
+    default: return "BAD VALUE";
+  }
+#undef X
+}
+
 INLINE peculiarity
 get_entity_peculiarity (entity *ent) {
   assert (ent);
@@ -346,6 +371,19 @@ set_entity_peculiarity (entity *ent, peculiarity pec) {
   ent->peculiarity = pec;
 }
 
+/* return the name of the peculiarity */
+const char *get_peculiarity_name(peculiarity var)
+{
+#define X(a)   case a: return #a
+  switch (var) {
+    X(description);
+    X(inherited);
+    X(existent);
+    default: return "BAD VALUE";
+  }
+#undef X
+}
+
 /* Set has no effect for entities of type method. */
 INLINE ir_node *
 get_atomic_ent_value(entity *ent) {
index 39914b5..98bc968 100644 (file)
@@ -262,6 +262,9 @@ ent_variability get_entity_variability (entity *ent);
 /** Sets the variability of an entity. */
 void            set_entity_variability (entity *ent, ent_variability var);
 
+/** Return the name of the variablity. */
+const char *get_variablity_name(ent_variability var);
+
 /** This enumeration flags the volatility of entities. */
 typedef enum {
   non_volatile,    /**< The entity is not volatile */
@@ -274,6 +277,9 @@ ent_volatility get_entity_volatility (entity *ent);
 /** Sets the volatility of an entity. */
 void           set_entity_volatility (entity *ent, ent_volatility vol);
 
+/* Return the name of the volatility. */
+const char *get_volatility_name(ent_volatility var);
+
 /** Returns the offset of an entity (in a compound). Only set if layout = fixed. */
 int       get_entity_offset (entity *ent);
 
@@ -294,10 +300,15 @@ void    set_entity_link(entity *ent, void *l);
 ir_graph *get_entity_irg(entity *ent);
 void      set_entity_irg(entity *ent, ir_graph *irg);
 
-/* For the definition of enumeration peculiarity see type.h */
+/** Return the peculiarity of an entity. */
 peculiarity get_entity_peculiarity (entity *ent);
+
+/** Sets the peculiarity of an entity. */
 void        set_entity_peculiarity (entity *ent, peculiarity pec);
 
+/** Return the name of the peculiarity. */
+const char *get_peculiarity_name(peculiarity var);
+
 /* -- Representation of constant values of entites -- */
 /* Set current_ir_graph to get_const_code_irg() to generate a constant
    expression. */
@@ -394,5 +405,4 @@ bool        entity_visited(entity *ent);
 /** Returns true if this entity was not visited. */
 bool        entity_not_visited(entity *ent);
 
-
 # endif /* _ENTITY_H_ */