From 0b08729e04ee529435b89d359202a731f65b2f01 Mon Sep 17 00:00:00 2001 From: Sebastian Hack Date: Wed, 2 Jul 2003 08:54:45 +0000 Subject: [PATCH] Added name getting methods for variability and allocation [r1428] --- ir/tr/entity.c | 27 +++++++++++++++++++++++++++ ir/tr/entity.h | 6 ++++++ 2 files changed, 33 insertions(+) diff --git a/ir/tr/entity.c b/ir/tr/entity.c index 1dfef1516..8d52c28c5 100644 --- a/ir/tr/entity.c +++ b/ir/tr/entity.c @@ -279,6 +279,20 @@ set_entity_allocation (entity *ent, ent_allocation al) { ent->allocation = al; } +/* return the name of the visibility */ +const char *get_allocation_name(ent_allocation all) +{ +#define X(a) case a: return #a + switch (all) { + X(automatic_allocated); + X(parameter_allocated); + X(dynamic_allocated); + X(static_allocated); + default: return "BAD VALUE"; + } +#undef X +} + INLINE ent_visibility get_entity_visibility (entity *ent) { @@ -295,6 +309,19 @@ set_entity_visibility (entity *ent, ent_visibility vis) { ent->visibility = vis; } +/* return the name of the visibility */ +const char *get_visibility_name(ent_visibility vis) +{ +#define X(a) case a: return #a + switch (vis) { + X(local); + X(external_visible); + X(external_allocated); + default: return "BAD VALUE"; + } +#undef X +} + INLINE ent_variability get_entity_variability (entity *ent) { return ent->variability; diff --git a/ir/tr/entity.h b/ir/tr/entity.h index d180c7f8b..8f5dfbb1a 100644 --- a/ir/tr/entity.h +++ b/ir/tr/entity.h @@ -224,6 +224,9 @@ ent_allocation get_entity_allocation (entity *ent); /** Sets the allocation type of an entity. */ void set_entity_allocation (entity *ent, ent_allocation al); +/** Return the name of the visibility */ +const char *get_allocation_name(ent_allocation vis); + /** * This enumeration flags the visibility of entities. This is necessary * for partial compilation. @@ -245,6 +248,9 @@ ent_visibility get_entity_visibility (entity *ent); /** Sets the visibility of an entity. */ void set_entity_visibility (entity *ent, ent_visibility vis); +/** Return the name of the visibility */ +const char *get_visibility_name(ent_visibility vis); + /** This enumeration flags the variability of entities. */ typedef enum { uninitialized, /**< The content of the entity is completely unknown. */ -- 2.20.1