Commit 033fb743 authored by Moritz Kroll's avatar Moritz Kroll
Browse files

Added has_entity_initializer() and get_initializer_kind_name()

[r25517]
parent 21d88871
......@@ -444,6 +444,9 @@ typedef enum ir_initializer_kind_t {
/** returns kind of an initializer */
ir_initializer_kind_t get_initializer_kind(const ir_initializer_t *initializer);
/** Return the name of the initializer kind. */
const char *get_initializer_kind_name(ir_initializer_kind_t ini);
/**
* returns the null initializer (there's only one instance of it in a program )
*/
......@@ -548,6 +551,9 @@ void set_compound_ent_value(ir_entity *ent, ir_node *val, ir_entity *member, int
/** Sets the new style initializers of an entity. */
void set_entity_initializer(ir_entity *entity, ir_initializer_t *initializer);
/** Returns true, if an entity has new style initializers. */
int has_entity_initializer(const ir_entity *entity);
/** Return the new style initializers of an entity. */
ir_initializer_t *get_entity_initializer(const ir_entity *entity);
......
......@@ -679,6 +679,20 @@ ir_node *copy_const_value(dbg_info *dbg, ir_node *n) {
return nn;
} /* copy_const_value */
/** Return the name of the initializer kind. */
const char *get_initializer_kind_name(ir_initializer_kind_t ini)
{
#define X(a) case a: return #a
switch (ini) {
X(IR_INITIALIZER_CONST);
X(IR_INITIALIZER_TARVAL);
X(IR_INITIALIZER_NULL);
X(IR_INITIALIZER_COMPOUND);
default: return "BAD VALUE";
}
#undef X
}
static ir_initializer_t null_initializer = { IR_INITIALIZER_NULL };
ir_initializer_t *get_initializer_null(void)
......@@ -783,6 +797,11 @@ void set_entity_initializer(ir_entity *entity, ir_initializer_t *initializer)
check_entity_initializer(entity);
}
int has_entity_initializer(const ir_entity *entity)
{
return entity->has_initializer;
}
ir_initializer_t *get_entity_initializer(const ir_entity *entity)
{
assert(entity->has_initializer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment