Commit e9be161e authored by Matthias Braun's avatar Matthias Braun
Browse files

entity: Rename kind to firm_tag and entity_kind to kind

parent 0ac34044
......@@ -1342,7 +1342,7 @@ static bool check_needs_quotes(char const *const s)
void be_gas_emit_entity(const ir_entity *entity)
{
if (entity->entity_kind == IR_ENTITY_LABEL) {
if (entity->kind == IR_ENTITY_LABEL) {
ir_label_t label = get_entity_label(entity);
be_emit_irprintf("%s_%lu", be_gas_get_private_prefix(), label);
return;
......
......@@ -667,7 +667,7 @@ static void write_entity(write_env_t *env, ir_entity *ent)
}
fputc('\t', env->file);
switch ((ir_entity_kind)ent->entity_kind) {
switch ((ir_entity_kind)ent->kind) {
case IR_ENTITY_ALIAS: write_symbol(env, "alias"); break;
case IR_ENTITY_NORMAL: write_symbol(env, "entity"); break;
case IR_ENTITY_METHOD: write_symbol(env, "method"); break;
......@@ -681,8 +681,7 @@ static void write_entity(write_env_t *env, ir_entity *ent)
}
write_long(env, get_entity_nr(ent));
if (ent->entity_kind != IR_ENTITY_LABEL
&& ent->entity_kind != IR_ENTITY_PARAMETER) {
if (ent->kind != IR_ENTITY_LABEL && ent->kind != IR_ENTITY_PARAMETER) {
write_ident_null(env, get_entity_ident(ent));
if (!entity_has_ld_ident(ent)) {
write_ident_null(env, NULL);
......@@ -706,11 +705,11 @@ static void write_entity(write_env_t *env, ir_entity *ent)
write_list_end(env);
write_type_ref(env, type);
if (ent->entity_kind != IR_ENTITY_LABEL)
if (ent->kind != IR_ENTITY_LABEL)
write_type_ref(env, owner);
write_volatility(env, get_entity_volatility(ent));
switch ((ir_entity_kind)ent->entity_kind) {
switch ((ir_entity_kind)ent->kind) {
case IR_ENTITY_ALIAS:
write_entity_ref(env, get_entity_alias(ent));
break;
......@@ -1394,7 +1393,7 @@ static ir_entity *get_entity(read_env_t *env, long entnr)
parse_error(env, "unknown entity: %ld\n", entnr);
return create_error_entity();
}
if (entity->kind != k_entity) {
if (!is_entity(entity)) {
parse_error(env, "Object %ld is not an entity (but should be)\n",
entnr);
return create_error_entity();
......
......@@ -38,12 +38,12 @@ static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
assert(owner != NULL);
ir_entity *res = XMALLOCZ(ir_entity);
res->kind = k_entity;
res->firm_tag = k_entity;
res->name = name;
res->ld_name = name;
res->type = type;
res->owner = owner;
res->entity_kind = kind;
res->kind = kind;
res->volatility = volatility_non_volatile;
res->aligned = align_is_aligned;
res->usage = ir_usage_unknown;
......@@ -159,7 +159,7 @@ static void free_entity_attrs(ir_entity *ent)
/* TODO: free initializers */
if (ent->entity_kind == IR_ENTITY_METHOD) {
if (ent->kind == IR_ENTITY_METHOD) {
if (ent->attr.mtd_attr.param_access) {
DEL_ARR_F(ent->attr.mtd_attr.param_access);
ent->attr.mtd_attr.param_access = NULL;
......@@ -200,17 +200,17 @@ void free_entity(ir_entity *ent)
{
remove_compound_member(ent->owner, ent);
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
free_entity_attrs(ent);
#ifdef DEBUG_libfirm
ent->kind = k_BAD;
ent->firm_tag = k_BAD;
#endif
free(ent);
}
long get_entity_nr(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->nr;
}
......@@ -236,7 +236,7 @@ ir_type *(get_entity_owner)(const ir_entity *ent)
void set_entity_owner(ir_entity *ent, ir_type *owner)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
assert(is_compound_type(owner));
remove_compound_member(ent->owner, ent);
......@@ -282,7 +282,7 @@ ir_type *(get_entity_type)(const ir_entity *ent)
void set_entity_type(ir_entity *ent, ir_type *type)
{
switch (ent->entity_kind) {
switch (ent->kind) {
case IR_ENTITY_METHOD:
assert(is_Method_type(type));
break;
......@@ -355,13 +355,13 @@ const char *get_align_name(ir_align a)
void set_entity_label(ir_entity *ent, ir_label_t label)
{
assert(ent->entity_kind == IR_ENTITY_LABEL);
assert(ent->kind == IR_ENTITY_LABEL);
ent->attr.code_attr.label = label;
}
ir_label_t get_entity_label(const ir_entity *ent)
{
assert(ent->entity_kind == IR_ENTITY_LABEL);
assert(ent->kind == IR_ENTITY_LABEL);
return ent->attr.code_attr.label;
}
......@@ -764,7 +764,7 @@ void set_entity_vtable_number(ir_entity *ent, unsigned vtable_number)
int is_unknown_entity(const ir_entity *entity)
{
return entity->entity_kind == IR_ENTITY_UNKNOWN;
return entity->kind == IR_ENTITY_UNKNOWN;
}
int is_atomic_entity(const ir_entity *ent)
......@@ -783,12 +783,12 @@ int is_compound_entity(const ir_entity *ent)
int is_method_entity(const ir_entity *ent)
{
return ent->entity_kind == IR_ENTITY_METHOD;
return ent->kind == IR_ENTITY_METHOD;
}
int is_alias_entity(const ir_entity *entity)
{
return entity->entity_kind == IR_ENTITY_ALIAS;
return entity->kind == IR_ENTITY_ALIAS;
}
ir_visited_t (get_entity_visited)(const ir_entity *ent)
......@@ -818,8 +818,7 @@ int (entity_not_visited)(const ir_entity *ent)
int entity_has_additional_properties(const ir_entity *entity)
{
return entity->entity_kind == IR_ENTITY_METHOD
|| entity->entity_kind == IR_ENTITY_ALIAS;
return entity->kind == IR_ENTITY_METHOD || entity->kind == IR_ENTITY_ALIAS;
}
mtp_additional_properties get_entity_additional_properties(const ir_entity *ent)
......
......@@ -165,7 +165,7 @@ typedef enum ir_entity_kind {
* An abstract data type to represent program entities.
*/
struct ir_entity {
firm_kind kind; /**< The dynamic type tag for entity. */
firm_kind firm_tag; /**< The dynamic type tag for entity. */
ident *name; /**< The name of this entity. */
ident *ld_name; /**< Unique name of this entity, i.e., the mangled
name. May be NULL to indicate that a default
......@@ -173,7 +173,7 @@ struct ir_entity {
ir_type *type; /**< The type of this entity */
ir_type *owner; /**< The compound type (e.g. class type) this
entity belongs to. */
ENUMBF(ir_entity_kind) entity_kind:3; /**< entity kind */
ENUMBF(ir_entity_kind) kind:3; /**< entity kind */
ENUMBF(ir_linkage) linkage:7; /**< Linkage type */
ENUMBF(ir_volatility) volatility:1; /**< Volatility of entity content.*/
ENUMBF(ir_align) aligned:1; /**< Alignment of entity content. */
......@@ -227,36 +227,36 @@ static inline bool is_entity(const void *thing)
static inline ir_entity_kind get_entity_kind(const ir_entity *entity)
{
return (ir_entity_kind)entity->entity_kind;
return (ir_entity_kind)entity->kind;
}
static inline ident *_get_entity_ident(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->name;
}
static inline const char *_get_entity_name(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return get_id_str(get_entity_ident(ent));
}
static inline void _set_entity_ident(ir_entity *ent, ident *id)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->name = id;
}
static inline ir_type *_get_entity_owner(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->owner;
}
static inline ident *_get_entity_ld_ident(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
if (ent->ld_name)
return ent->ld_name;
return ent->name;
......@@ -264,79 +264,79 @@ static inline ident *_get_entity_ld_ident(const ir_entity *ent)
static inline const char *_get_entity_ld_name(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return get_id_str(get_entity_ld_ident(ent));
}
static inline ir_type *_get_entity_type(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->type;
}
static inline ir_linkage _get_entity_linkage(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return (ir_linkage) ent->linkage;
}
static inline ir_volatility _get_entity_volatility(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return (ir_volatility) ent->volatility;
}
static inline void _set_entity_volatility(ir_entity *ent, ir_volatility vol)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->volatility = vol;
}
static inline unsigned _get_entity_alignment(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->alignment;
}
static inline void _set_entity_alignment(ir_entity *ent, unsigned alignment)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->alignment = alignment;
}
static inline ir_align _get_entity_aligned(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return (ir_align) ent->aligned;
}
static inline void _set_entity_aligned(ir_entity *ent, ir_align a)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->aligned = a;
}
static inline ir_entity_usage _get_entity_usage(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return (ir_entity_usage) ent->usage;
}
static inline void _set_entity_usage(ir_entity *ent, ir_entity_usage state)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->usage = state;
}
static inline bool is_entity_compound_member(const ir_entity *entity)
{
return entity->entity_kind == IR_ENTITY_COMPOUND_MEMBER
|| entity->entity_kind == IR_ENTITY_PARAMETER;
return entity->kind == IR_ENTITY_COMPOUND_MEMBER
|| entity->kind == IR_ENTITY_PARAMETER;
}
static inline ir_initializer_t *_get_entity_initializer(ir_entity const *const ent)
{
assert(ent->entity_kind == IR_ENTITY_NORMAL);
assert(ent->kind == IR_ENTITY_NORMAL);
return ent->attr.normal.initializer;
}
......@@ -378,20 +378,20 @@ static inline void _set_entity_bitfield_size(ir_entity *entity, unsigned size)
static inline void *_get_entity_link(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->link;
}
static inline void _set_entity_link(ir_entity *ent, void *l)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->link = l;
}
static inline ir_graph *_get_entity_irg(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->entity_kind == IR_ENTITY_METHOD);
assert(ent->firm_tag == k_entity);
assert(ent->kind == IR_ENTITY_METHOD);
return ent->attr.mtd_attr.irg;
}
......@@ -402,26 +402,26 @@ static inline ir_graph *_get_entity_linktime_irg(const ir_entity *entity)
if (get_entity_linkage(entity) & IR_LINKAGE_WEAK)
return NULL;
/* only method entities have an irg field (alias etc. does not) */
if (entity->entity_kind != IR_ENTITY_METHOD)
if (entity->kind != IR_ENTITY_METHOD)
return NULL;
return get_entity_irg(entity);
}
static inline ir_visited_t _get_entity_visited(const ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
return ent->visit;
}
static inline void _set_entity_visited(ir_entity *ent, ir_visited_t num)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->visit = num;
}
static inline void _mark_entity_visited(ir_entity *ent)
{
assert(ent->kind == k_entity);
assert(ent->firm_tag == k_entity);
ent->visit = firm_type_visited;
}
......@@ -437,7 +437,7 @@ static inline int _entity_not_visited(const ir_entity *ent)
static inline int _is_parameter_entity(const ir_entity *entity)
{
return entity->entity_kind == IR_ENTITY_PARAMETER;
return entity->kind == IR_ENTITY_PARAMETER;
}
static inline size_t _get_entity_parameter_number(const ir_entity *entity)
......@@ -458,7 +458,7 @@ static inline void _set_entity_dbg_info(ir_entity *ent, dbg_info *db)
static inline bool is_global_entity(ir_entity const *const entity)
{
switch (entity->entity_kind) {
switch (entity->kind) {
case IR_ENTITY_ALIAS:
case IR_ENTITY_METHOD:
case IR_ENTITY_NORMAL:
......
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