res->compiler_gen = 0;
res->offset = -1;
res->link = NULL;
+ res->repr_class = NULL;
if (is_Method_type(type)) {
symconst_symbol sym;
}
entity *
-new_d_entity (ir_type *owner, ident *name, ir_type *type, dbg_info *db) {
+new_d_entity(ir_type *owner, ident *name, ir_type *type, dbg_info *db) {
entity *res;
- assert_legal_owner_of_ent(owner);
+ assert(is_compound_type(owner));
res = new_rd_entity(db, owner, name, type);
/* Remember entity in it's owner. */
- insert_entity_in_owner (res);
+ insert_entity_in_owner(res);
hook_new_entity(res);
return res;
}
entity *
-new_entity (ir_type *owner, ident *name, ir_type *type) {
+new_entity(ir_type *owner, ident *name, ir_type *type) {
return new_d_entity(owner, name, type, NULL);
}
}
entity *
-copy_entity_own (entity *old, ir_type *new_owner) {
+copy_entity_own(entity *old, ir_type *new_owner) {
entity *newe;
- assert(old && old->kind == k_entity);
- assert_legal_owner_of_ent(new_owner);
+ assert(is_entity(old));
+ assert(is_compound_type(new_owner));
if (old->owner == new_owner) return old;
newe = xmalloc(sizeof(*newe));
- memcpy (newe, old, sizeof(*newe));
+ memcpy(newe, old, sizeof(*newe));
newe->owner = new_owner;
if (is_Class_type(new_owner)) {
newe->overwrites = NEW_ARR_F(entity *, 0);
newe->nr = get_irp_new_node_nr();
#endif
- insert_entity_in_owner (newe);
+ insert_entity_in_owner(newe);
return newe;
}
entity *
-copy_entity_name (entity *old, ident *new_name) {
+copy_entity_name(entity *old, ident *new_name) {
entity *newe;
assert(old && old->kind == k_entity);
}
void
-set_entity_owner (entity *ent, ir_type *owner) {
- assert(ent && ent->kind == k_entity);
- assert_legal_owner_of_ent(owner);
+set_entity_owner(entity *ent, ir_type *owner) {
+ assert(is_entity(ent));
+ assert(is_compound_type(owner));
ent->owner = owner;
}
-void /* should this go into type.c? */
-assert_legal_owner_of_ent(ir_type *owner) {
- assert(get_type_tpop_code(owner) == tpo_class ||
- get_type_tpop_code(owner) == tpo_union ||
- get_type_tpop_code(owner) == tpo_struct ||
- get_type_tpop_code(owner) == tpo_array); /* Yes, array has an entity
- -- to select fields! */
-}
-
ident *
(get_entity_ld_ident)(entity *ent) {
return _get_entity_ld_ident(ent);
}
int is_atomic_entity(entity *ent) {
- ir_type *t = get_entity_type(ent);
- tp_op *op = get_type_tpop(t);
+ ir_type *t = get_entity_type(ent);
+ const tp_op *op = get_type_tpop(t);
return (op == type_primitive || op == type_pointer ||
op == type_enumeration || op == type_method);
}
int is_compound_entity(entity *ent) {
- ir_type *t = get_entity_type(ent);
- tp_op *op = get_type_tpop(t);
+ ir_type *t = get_entity_type(ent);
+ const tp_op *op = get_type_tpop(t);
return (op == type_class || op == type_struct ||
op == type_array || op == type_union);
}
}
}
+/* Returns the class type that this type info entity represents or NULL
+ if ent is no type info entity. */
+ir_type *(get_entity_repr_class)(const entity *ent) {
+ return _get_entity_repr_class(ent);
+}
+
/* Initialize entity module. */
void firm_init_entity(void)
{