Commit 302e20bf authored by Matthias Braun's avatar Matthias Braun
Browse files

coding style cleanup, use C99

parent 09f2dc24
...@@ -41,10 +41,9 @@ ir_entity *get_unknown_entity(void) ...@@ -41,10 +41,9 @@ ir_entity *get_unknown_entity(void)
static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind, static ir_entity *intern_new_entity(ir_type *owner, ir_entity_kind kind,
ident *name, ir_type *type, dbg_info *dbgi) ident *name, ir_type *type, dbg_info *dbgi)
{ {
assert(owner); assert(owner != NULL);
ir_entity *res = XMALLOCZ(ir_entity); ir_entity *res = XMALLOCZ(ir_entity);
res->kind = k_entity; res->kind = k_entity;
res->name = name; res->name = name;
res->ld_name = NULL; res->ld_name = NULL;
...@@ -79,7 +78,6 @@ ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *type, ...@@ -79,7 +78,6 @@ ir_entity *new_d_entity(ir_type *owner, ident *name, ir_type *type,
dbg_info *db) dbg_info *db)
{ {
ir_entity *res; ir_entity *res;
if (is_Method_type(type)) { if (is_Method_type(type)) {
ir_graph *irg = get_const_code_irg(); ir_graph *irg = get_const_code_irg();
symconst_symbol sym; symconst_symbol sym;
...@@ -205,16 +203,14 @@ static ir_entity *deep_entity_copy(ir_entity *old) ...@@ -205,16 +203,14 @@ static ir_entity *deep_entity_copy(ir_entity *old)
ir_entity *copy_entity_own(ir_entity *old, ir_type *new_owner) ir_entity *copy_entity_own(ir_entity *old, ir_type *new_owner)
{ {
ir_entity *newe;
assert(is_entity(old)); assert(is_entity(old));
assert(is_compound_type(new_owner)); assert(is_compound_type(new_owner));
assert(get_type_state(new_owner) != layout_fixed); assert(get_type_state(new_owner) != layout_fixed);
if (old->owner == new_owner) if (old->owner == new_owner)
return old; return old;
/* create a deep copy so we are safe of aliasing and double-freeing. */ /* create a deep copy so we are safe of aliasing and double-freeing. */
newe = deep_entity_copy(old); ir_entity *newe = deep_entity_copy(old);
newe->owner = new_owner; newe->owner = new_owner;
add_compound_member(new_owner, newe); add_compound_member(new_owner, newe);
...@@ -223,14 +219,12 @@ ir_entity *copy_entity_own(ir_entity *old, ir_type *new_owner) ...@@ -223,14 +219,12 @@ ir_entity *copy_entity_own(ir_entity *old, ir_type *new_owner)
ir_entity *copy_entity_name(ir_entity *old, ident *new_name) ir_entity *copy_entity_name(ir_entity *old, ident *new_name)
{ {
ir_entity *newe; assert(old->kind == k_entity);
assert(old && old->kind == k_entity);
if (old->name == new_name) if (old->name == new_name)
return old; return old;
newe = deep_entity_copy(old); ir_entity *newe = deep_entity_copy(old);
newe->name = new_name; newe->name = new_name;
newe->ld_name = NULL; newe->ld_name = NULL;
add_compound_member(old->owner, newe); add_compound_member(old->owner, newe);
...@@ -242,7 +236,7 @@ void free_entity(ir_entity *ent) ...@@ -242,7 +236,7 @@ void free_entity(ir_entity *ent)
if (is_compound_type(ent->owner)) if (is_compound_type(ent->owner))
remove_compound_member(ent->owner, ent); remove_compound_member(ent->owner, ent);
assert(ent && ent->kind == k_entity); assert(ent->kind == k_entity);
free_entity_attrs(ent); free_entity_attrs(ent);
#ifdef DEBUG_libfirm #ifdef DEBUG_libfirm
ent->kind = k_BAD; ent->kind = k_BAD;
...@@ -252,7 +246,7 @@ void free_entity(ir_entity *ent) ...@@ -252,7 +246,7 @@ void free_entity(ir_entity *ent)
long get_entity_nr(const ir_entity *ent) long get_entity_nr(const ir_entity *ent)
{ {
assert(ent && ent->kind == k_entity); assert(ent->kind == k_entity);
#ifdef DEBUG_libfirm #ifdef DEBUG_libfirm
return ent->nr; return ent->nr;
#else #else
...@@ -349,9 +343,9 @@ const char *get_volatility_name(ir_volatility var) ...@@ -349,9 +343,9 @@ const char *get_volatility_name(ir_volatility var)
switch (var) { switch (var) {
X(volatility_non_volatile); X(volatility_non_volatile);
X(volatility_is_volatile); X(volatility_is_volatile);
default: return "BAD VALUE";
} }
#undef X #undef X
return "BAD VALUE";
} }
ir_align (get_entity_aligned)(const ir_entity *ent) ir_align (get_entity_aligned)(const ir_entity *ent)
...@@ -380,9 +374,9 @@ const char *get_align_name(ir_align a) ...@@ -380,9 +374,9 @@ const char *get_align_name(ir_align a)
switch (a) { switch (a) {
X(align_non_aligned); X(align_non_aligned);
X(align_is_aligned); X(align_is_aligned);
default: return "BAD VALUE";
} }
#undef X #undef X
return "BAD VALUE";
} }
void set_entity_label(ir_entity *ent, ir_label_t label) void set_entity_label(ir_entity *ent, ir_label_t label)
...@@ -451,7 +445,7 @@ ir_node *get_atomic_ent_value(const ir_entity *entity) ...@@ -451,7 +445,7 @@ ir_node *get_atomic_ent_value(const ir_entity *entity)
{ {
ir_initializer_t *initializer = get_entity_initializer(entity); ir_initializer_t *initializer = get_entity_initializer(entity);
assert(entity && is_atomic_entity(entity)); assert(is_atomic_entity(entity));
if (initializer == NULL) { if (initializer == NULL) {
ir_type *type = get_entity_type(entity); ir_type *type = get_entity_type(entity);
return new_r_Unknown(get_const_code_irg(), get_type_mode(type)); return new_r_Unknown(get_const_code_irg(), get_type_mode(type));
...@@ -478,20 +472,16 @@ ir_node *get_atomic_ent_value(const ir_entity *entity) ...@@ -478,20 +472,16 @@ ir_node *get_atomic_ent_value(const ir_entity *entity)
void set_atomic_ent_value(ir_entity *entity, ir_node *val) void set_atomic_ent_value(ir_entity *entity, ir_node *val)
{ {
ir_initializer_t *initializer;
assert(is_atomic_entity(entity)); assert(is_atomic_entity(entity));
assert(is_Dummy(val) || get_irn_mode(val) == get_type_mode(entity->type)); assert(is_Dummy(val) || get_irn_mode(val) == get_type_mode(entity->type));
initializer = create_initializer_const(val); ir_initializer_t *initializer = create_initializer_const(val);
entity->initializer = initializer; entity->initializer = initializer;
} }
int is_irn_const_expression(ir_node *n) int is_irn_const_expression(ir_node *n)
{ {
/* we are in danger iff an exception will arise. TODO: be more precisely, /* we are in danger iff an exception will arise. TODO: be more precisely,
* for instance Div. will NOT rise if divisor != 0 * for instance Div. will NOT rise if divisor != 0 */
*/
if (is_binop(n) && !is_fragile_op(n)) if (is_binop(n) && !is_fragile_op(n))
return is_irn_const_expression(get_binop_left(n)) && is_irn_const_expression(get_binop_right(n)); return is_irn_const_expression(get_binop_left(n)) && is_irn_const_expression(get_binop_right(n));
...@@ -511,13 +501,11 @@ int is_irn_const_expression(ir_node *n) ...@@ -511,13 +501,11 @@ int is_irn_const_expression(ir_node *n)
ir_node *copy_const_value(dbg_info *dbg, ir_node *n, ir_node *block) ir_node *copy_const_value(dbg_info *dbg, ir_node *n, ir_node *block)
{ {
ir_graph *irg = get_irn_irg(block); ir_graph *irg = get_irn_irg(block);
ir_node *nn;
ir_mode *m;
/* @@@ GL I think we should implement this using the routines from irgopt for
dead node elimination/inlineing. */
m = get_irn_mode(n); /* @@@ GL I think we should implement this using the routines from irgopt
* for dead node elimination/inlineing. */
ir_mode *m = get_irn_mode(n);
ir_node *nn;
switch (get_irn_opcode(n)) { switch (get_irn_opcode(n)) {
case iro_Const: case iro_Const:
nn = new_rd_Const(dbg, irg, get_Const_tarval(n)); nn = new_rd_Const(dbg, irg, get_Const_tarval(n));
...@@ -568,7 +556,8 @@ ir_node *copy_const_value(dbg_info *dbg, ir_node *n, ir_node *block) ...@@ -568,7 +556,8 @@ ir_node *copy_const_value(dbg_info *dbg, ir_node *n, ir_node *block)
copy_const_value(dbg, get_Not_op(n), block), m); copy_const_value(dbg, get_Not_op(n), block), m);
break; break;
case iro_Unknown: case iro_Unknown:
nn = new_r_Unknown(irg, m); break; nn = new_r_Unknown(irg, m);
break;
default: default:
panic("opcode invalid or not implemented %+F", n); panic("opcode invalid or not implemented %+F", n);
} }
...@@ -583,9 +572,9 @@ const char *get_initializer_kind_name(ir_initializer_kind_t ini) ...@@ -583,9 +572,9 @@ const char *get_initializer_kind_name(ir_initializer_kind_t ini)
X(IR_INITIALIZER_TARVAL); X(IR_INITIALIZER_TARVAL);
X(IR_INITIALIZER_NULL); X(IR_INITIALIZER_NULL);
X(IR_INITIALIZER_COMPOUND); X(IR_INITIALIZER_COMPOUND);
default: return "BAD VALUE";
} }
#undef X #undef X
return "BAD VALUE";
} }
static ir_initializer_t null_initializer = { IR_INITIALIZER_NULL }; static ir_initializer_t null_initializer = { IR_INITIALIZER_NULL };
...@@ -623,17 +612,16 @@ ir_initializer_t *create_initializer_compound(size_t n_entries) ...@@ -623,17 +612,16 @@ ir_initializer_t *create_initializer_compound(size_t n_entries)
{ {
struct obstack *obst = get_irg_obstack(get_const_code_irg()); struct obstack *obst = get_irg_obstack(get_const_code_irg());
size_t i; size_t size = sizeof(ir_initializer_compound_t)
size_t size = sizeof(ir_initializer_compound_t) + n_entries * sizeof(ir_initializer_t*)
+ n_entries * sizeof(ir_initializer_t*) - sizeof(ir_initializer_t*);
- sizeof(ir_initializer_t*);
ir_initializer_t *initializer ir_initializer_t *initializer
= (ir_initializer_t*)obstack_alloc(obst, size); = (ir_initializer_t*)obstack_alloc(obst, size);
initializer->kind = IR_INITIALIZER_COMPOUND; initializer->kind = IR_INITIALIZER_COMPOUND;
initializer->compound.n_initializers = n_entries; initializer->compound.n_initializers = n_entries;
for (i = 0; i < n_entries; ++i) { for (size_t i = 0; i < n_entries; ++i) {
initializer->compound.initializers[i] = get_initializer_null(); initializer->compound.initializers[i] = get_initializer_null();
} }
...@@ -762,9 +750,7 @@ size_t get_entity_n_overwrites(const ir_entity *ent) ...@@ -762,9 +750,7 @@ size_t get_entity_n_overwrites(const ir_entity *ent)
size_t get_entity_overwrites_index(const ir_entity *ent, ir_entity *overwritten) size_t get_entity_overwrites_index(const ir_entity *ent, ir_entity *overwritten)
{ {
size_t i; for (size_t i = 0, n = get_entity_n_overwrites(ent); i < n; ++i) {
size_t n = get_entity_n_overwrites(ent);
for (i = 0; i < n; ++i) {
if (get_entity_overwrites(ent, i) == overwritten) if (get_entity_overwrites(ent, i) == overwritten)
return i; return i;
} }
...@@ -785,9 +771,7 @@ void set_entity_overwrites(ir_entity *ent, size_t pos, ir_entity *overwritten) ...@@ -785,9 +771,7 @@ void set_entity_overwrites(ir_entity *ent, size_t pos, ir_entity *overwritten)
void remove_entity_overwrites(ir_entity *ent, ir_entity *overwritten) void remove_entity_overwrites(ir_entity *ent, ir_entity *overwritten)
{ {
size_t i; for (size_t i = 0, n = get_entity_n_overwrites(ent); i < n; ++i) {
size_t n = get_entity_n_overwrites(ent);
for (i = 0; i < n; ++i) {
if (ent->overwrites[i] == overwritten) { if (ent->overwrites[i] == overwritten) {
for (; i < n - 1; i++) for (; i < n - 1; i++)
ent->overwrites[i] = ent->overwrites[i+1]; ent->overwrites[i] = ent->overwrites[i+1];
...@@ -808,9 +792,7 @@ size_t get_entity_n_overwrittenby(const ir_entity *ent) ...@@ -808,9 +792,7 @@ size_t get_entity_n_overwrittenby(const ir_entity *ent)
size_t get_entity_overwrittenby_index(const ir_entity *ent, size_t get_entity_overwrittenby_index(const ir_entity *ent,
ir_entity *overwrites) ir_entity *overwrites)
{ {
size_t i; for (size_t i = 0, n = get_entity_n_overwrittenby(ent); i < n; ++i) {
size_t n = get_entity_n_overwrittenby(ent);
for (i = 0; i < n; ++i) {
if (get_entity_overwrittenby(ent, i) == overwrites) if (get_entity_overwrittenby(ent, i) == overwrites)
return i; return i;
} }
...@@ -831,9 +813,7 @@ void set_entity_overwrittenby(ir_entity *ent, size_t pos, ir_entity *overwrites) ...@@ -831,9 +813,7 @@ void set_entity_overwrittenby(ir_entity *ent, size_t pos, ir_entity *overwrites)
void remove_entity_overwrittenby(ir_entity *ent, ir_entity *overwrites) void remove_entity_overwrittenby(ir_entity *ent, ir_entity *overwrites)
{ {
size_t i; for (size_t i = 0, n = get_entity_n_overwrittenby(ent); i < n; ++i) {
size_t n = get_entity_n_overwrittenby(ent);
for (i = 0; i < n; ++i) {
if (ent->overwrittenby[i] == overwrites) { if (ent->overwrittenby[i] == overwrites) {
for (; i < n - 1; ++i) for (; i < n - 1; ++i)
ent->overwrittenby[i] = ent->overwrittenby[i+1]; ent->overwrittenby[i] = ent->overwrittenby[i+1];
...@@ -905,7 +885,7 @@ int (is_entity)(const void *thing) ...@@ -905,7 +885,7 @@ int (is_entity)(const void *thing)
int is_atomic_entity(const ir_entity *ent) int is_atomic_entity(const ir_entity *ent)
{ {
ir_type *t = get_entity_type(ent); ir_type *t = get_entity_type(ent);
const tp_op *op = get_type_tpop(t); const tp_op *op = get_type_tpop(t);
return (op == type_primitive || op == type_pointer || return (op == type_primitive || op == type_pointer ||
op == type_enumeration || op == type_method); op == type_enumeration || op == type_method);
......
...@@ -27,8 +27,8 @@ const tp_op *tpop_code; const tp_op *get_tpop_code_type (void) { retur ...@@ -27,8 +27,8 @@ const tp_op *tpop_code; const tp_op *get_tpop_code_type (void) { retur
const tp_op *tpop_none; const tp_op *get_tpop_none (void) { return tpop_none; } const tp_op *tpop_none; const tp_op *get_tpop_none (void) { return tpop_none; }
const tp_op *tpop_unknown; const tp_op *get_tpop_unknown (void) { return tpop_unknown; } const tp_op *tpop_unknown; const tp_op *get_tpop_unknown (void) { return tpop_unknown; }
const tp_op * const tp_op *new_tpop(tp_opcode code, ident *name, unsigned flags,
new_tpop(tp_opcode code, ident *name, unsigned flags, size_t attr_size, const tp_op_ops *ops) size_t attr_size, const tp_op_ops *ops)
{ {
tp_op *res = XMALLOC(tp_op); tp_op *res = XMALLOC(tp_op);
res->code = code; res->code = code;
...@@ -148,7 +148,8 @@ static const tp_op_ops ...@@ -148,7 +148,8 @@ static const tp_op_ops
NULL, NULL,
NULL, NULL,
NULL NULL
}; }
;
void init_tpop(void) void init_tpop(void)
{ {
......
...@@ -32,34 +32,27 @@ ident *default_mangle_inherited_name(const ir_entity *super, const ir_type *clss ...@@ -32,34 +32,27 @@ ident *default_mangle_inherited_name(const ir_entity *super, const ir_type *clss
by an entity of this class. */ by an entity of this class. */
static void copy_entities_from_superclass(ir_type *clss, void *env) static void copy_entities_from_superclass(ir_type *clss, void *env)
{ {
size_t i;
size_t j;
size_t k;
size_t l;
int overwritten;
ir_type *super;
ir_entity *inhent, *thisent;
mangle_inherited_name_func *mfunc = *(mangle_inherited_name_func **)env; mangle_inherited_name_func *mfunc = *(mangle_inherited_name_func **)env;
for (i = 0; i < get_class_n_supertypes(clss); i++) { for (size_t i = 0; i < get_class_n_supertypes(clss); i++) {
super = get_class_supertype(clss, i); ir_type *super = get_class_supertype(clss, i);
for (j = 0; j < get_class_n_members(super); j++) { for (size_t j = 0; j < get_class_n_members(super); j++) {
inhent = get_class_member(super, j); ir_entity *inhent = get_class_member(super, j);
/* check whether inhent is already overwritten */ /* check whether inhent is already overwritten */
overwritten = 0; bool overwritten = false;
for (k = 0; (k < get_class_n_members(clss)) && (overwritten == 0); k++) { for (size_t k = 0; (k < get_class_n_members(clss)) && (overwritten == 0); k++) {
thisent = get_class_member(clss, k); ir_entity *thisent = get_class_member(clss, k);
for (l = 0; l < get_entity_n_overwrites(thisent); l++) { for (size_t l = 0; l < get_entity_n_overwrites(thisent); l++) {
if (inhent == get_entity_overwrites(thisent, l)) { if (inhent == get_entity_overwrites(thisent, l)) {
/* overwritten - do not copy */ /* overwritten - do not copy */
overwritten = 1; overwritten = true;
break; break;
} }
} }
} }
/* Inherit entity */ /* Inherit entity */
if (!overwritten) { if (!overwritten) {
thisent = copy_entity_own(inhent, clss); ir_entity *thisent = copy_entity_own(inhent, clss);
add_entity_overwrites(thisent, inhent); add_entity_overwrites(thisent, inhent);
if (get_entity_peculiarity(inhent) == peculiarity_existent) if (get_entity_peculiarity(inhent) == peculiarity_existent)
set_entity_peculiarity(thisent, peculiarity_inherited); set_entity_peculiarity(thisent, peculiarity_inherited);
...@@ -96,11 +89,11 @@ void resolve_inheritance(mangle_inherited_name_func *mfunc) ...@@ -96,11 +89,11 @@ void resolve_inheritance(mangle_inherited_name_func *mfunc)
/* adding the infix 'trans_'. */ /* adding the infix 'trans_'. */
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
void set_irp_inh_transitive_closure_state(inh_transitive_closure_state s) void set_irp_inh_transitive_closure_state(inh_transitive_closure_state s)
{ {
irp->inh_trans_closure_state = s; irp->inh_trans_closure_state = s;
} }
void invalidate_irp_inh_transitive_closure_state(void) void invalidate_irp_inh_transitive_closure_state(void)
{ {
if (irp->inh_trans_closure_state == inh_transitive_closure_valid) if (irp->inh_trans_closure_state == inh_transitive_closure_valid)
irp->inh_trans_closure_state = inh_transitive_closure_invalid; irp->inh_trans_closure_state = inh_transitive_closure_invalid;
...@@ -131,7 +124,7 @@ typedef enum { ...@@ -131,7 +124,7 @@ typedef enum {
typedef struct { typedef struct {
const firm_kind *kind; /**< An entity or type. */ const firm_kind *kind; /**< An entity or type. */
pset *directions[2]; pset *directions[2];
} tr_inh_trans_tp; } tr_inh_trans_tp;
/* We use this set for all types and entities. */ /* We use this set for all types and entities. */
...@@ -142,10 +135,9 @@ static set *tr_inh_trans_set = NULL; ...@@ -142,10 +135,9 @@ static set *tr_inh_trans_set = NULL;
*/ */
static int tr_inh_trans_cmp(const void *e1, const void *e2, size_t size) static int tr_inh_trans_cmp(const void *e1, const void *e2, size_t size)
{ {
(void) size;
const tr_inh_trans_tp *ef1 = (const tr_inh_trans_tp*)e1; const tr_inh_trans_tp *ef1 = (const tr_inh_trans_tp*)e1;
const tr_inh_trans_tp *ef2 = (const tr_inh_trans_tp*)e2; const tr_inh_trans_tp *ef2 = (const tr_inh_trans_tp*)e2;
(void) size;
return ef1->kind != ef2->kind; return ef1->kind != ef2->kind;
} }
...@@ -160,12 +152,12 @@ static inline unsigned int tr_inh_trans_hash(const tr_inh_trans_tp *v) ...@@ -160,12 +152,12 @@ static inline unsigned int tr_inh_trans_hash(const tr_inh_trans_tp *v)
/* This always completes successfully. */ /* This always completes successfully. */
static tr_inh_trans_tp *get_firm_kind_entry(const firm_kind *k) static tr_inh_trans_tp *get_firm_kind_entry(const firm_kind *k)
{ {
tr_inh_trans_tp a, *found; if (tr_inh_trans_set == NULL)
a.kind = k; tr_inh_trans_set = new_set(tr_inh_trans_cmp, 128);
if (!tr_inh_trans_set) tr_inh_trans_set = new_set(tr_inh_trans_cmp, 128);
found = set_find(tr_inh_trans_tp, tr_inh_trans_set, &a, sizeof(a), tr_inh_trans_hash(&a)); tr_inh_trans_tp a;
a.kind = k;
tr_inh_trans_tp *found = set_find(tr_inh_trans_tp, tr_inh_trans_set, &a, sizeof(a), tr_inh_trans_hash(&a));
if (!found) { if (!found) {
a.directions[d_up] = pset_new_ptr(16); a.directions[d_up] = pset_new_ptr(16);
a.directions[d_down] = pset_new_ptr(16); a.directions[d_down] = pset_new_ptr(16);
...@@ -176,19 +168,15 @@ static tr_inh_trans_tp *get_firm_kind_entry(const firm_kind *k) ...@@ -176,19 +168,15 @@ static tr_inh_trans_tp *get_firm_kind_entry(const firm_kind *k)
static pset *get_entity_map(const ir_entity *ent, dir d) static pset *get_entity_map(const ir_entity *ent, dir d)
{ {
tr_inh_trans_tp *found;
assert(is_entity(ent)); assert(is_entity(ent));
found = get_firm_kind_entry((const firm_kind *)ent); tr_inh_trans_tp *found = get_firm_kind_entry((const firm_kind *)ent);
return found->directions[d]; return found->directions[d];
} }
static pset *get_type_map(const ir_type *tp, dir d) static pset *get_type_map(const ir_type *tp, dir d)
{ {
tr_inh_trans_tp *found;
assert(is_type(tp)); assert(is_type(tp));
found = get_firm_kind_entry((const firm_kind *)tp); tr_inh_trans_tp *found = get_firm_kind_entry((const firm_kind *)tp);
return found->directions[d]; return found->directions[d];
} }
...@@ -211,15 +199,12 @@ static pset *get_type_map(const ir_type *tp, dir d) ...@@ -211,15 +199,12 @@ static pset *get_type_map(const ir_type *tp, dir d)
* Well, we still miss some candidates ... */ * Well, we still miss some candidates ... */
static void compute_down_closure(ir_type *tp) static void compute_down_closure(ir_type *tp)
{ {
pset *myset, *subset;
size_t i, n_subtypes, n_members, n_supertypes;
ir_visited_t master_visited = get_master_type_visited(); ir_visited_t master_visited = get_master_type_visited();
set_type_visited(tp, master_visited-1); set_type_visited(tp, master_visited-1);
/* Recursive descend. */ /* Recursive descend. */
n_subtypes = get_class_n_subtypes(tp); size_t n_subtypes = get_class_n_subtypes(tp);
for (i = 0; i < n_subtypes; ++i) { for (size_t i = 0; i < n_subtypes; ++i) {
ir_type *stp = get_class_subtype(tp, i); ir_type *stp = get_class_subtype(tp, i);
if (get_type_visited(stp) < master_visited-1) { if (get_type_visited(stp) < master_visited-1) {
compute_down_closure(stp); compute_down_closure(stp);
...@@ -227,24 +212,23 @@ static void compute_down_closure(ir_type *tp) ...@@ -227,24 +212,23 @@ static void compute_down_closure(ir_type *tp)
} }
/* types */ /* types */
myset = get_type_map(tp, d_down); pset *myset = get_type_map(tp, d_down);
for (i = 0; i < n_subtypes; ++i) { for (size_t i = 0; i < n_subtypes; ++i) {
ir_type *stp = get_class_subtype(tp, i); ir_type *stp = get_class_subtype(tp, i);
subset = get_type_map(stp, d_down); pset *subset = get_type_map(stp, d_down);
pset_insert_ptr(myset, stp); pset_insert_ptr(myset, stp);
pset_insert_pset_ptr(myset, subset); pset_insert_pset_ptr(myset, subset);
} }
/* entities */ /* entities */
n_members = get_class_n_members(tp); for (size_t i = 0, n_members = get_class_n_members(tp); i < n_members; ++i) {
for (i = 0; i < n_members; ++i) {
ir_entity *mem = get_class_member(tp, i); ir_entity *mem = get_class_member(tp, i);
size_t j, n_overwrittenby = get_entity_n_overwrittenby(mem); size_t j, n_overwrittenby = get_entity_n_overwrittenby(mem);
myset = get_entity_map(mem, d_down); myset = get_entity_map(mem, d_down);
for (j = 0; j < n_overwrittenby; ++j) { for (j = 0; j < n_overwrittenby; ++j) {
ir_entity *ov = get_entity_overwrittenby(mem, j); ir_entity *ov = get_entity_overwrittenby(mem, j);
subset = get_entity_map(ov, d_down); pset *subset = get_entity_map(ov, d_down);
pset_insert_ptr(myset, ov); pset_insert_ptr(myset, ov);
pset_insert_pset_ptr(myset, subset); pset_insert_pset_ptr(myset, subset);
} }
...@@ -253,8 +237,8 @@ static void compute_down_closure(ir_type *tp) ...@@ -253,8 +237,8 @@ static void compute_down_closure(ir_type *tp)
mark_type_visited(tp); mark_type_visited(tp);
/* Walk up. */