From a32ee5eb0ceb637b8b0cd4e0e5fd2e2d3a363298 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 30 Apr 2003 14:49:07 +0000 Subject: [PATCH] Added some helper functions to show the variability, volatility and peculirity. [r1109] --- ir/tr/entity.c | 38 ++++++++++++++++++++++++++++++++++++++ ir/tr/entity.h | 14 ++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 6b6fc7aaf..b01b577e7 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -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) { diff --git a/ir/tr/entity.h b/ir/tr/entity.h index 39914b558..98bc968dd 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -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_ */ -- 2.20.1