Commit 9d5d8ed5 authored by Matthias Braun's avatar Matthias Braun
Browse files

fix a few memory leaks

parent 543bb596
...@@ -257,14 +257,16 @@ static ir_node *be_spill_phi(spill_env_t *senv, ir_node *phi, ir_node *ctx_irn, ...@@ -257,14 +257,16 @@ static ir_node *be_spill_phi(spill_env_t *senv, ir_node *phi, ir_node *ctx_irn,
*/ */
static ir_node *be_spill_node(spill_env_t *senv, ir_node *to_spill) { static ir_node *be_spill_node(spill_env_t *senv, ir_node *to_spill) {
ir_graph *irg = get_irn_irg(to_spill); ir_graph *irg = get_irn_irg(to_spill);
set *already_visited_phis = new_set(cmp_phi_spill_assoc, 10);
ir_node *res; ir_node *res;
bitset_t *bs = bitset_alloca(get_irg_last_idx(irg));
if (pset_find_ptr(senv->mem_phis, to_spill)) if (pset_find_ptr(senv->mem_phis, to_spill)) {
set *already_visited_phis = new_set(cmp_phi_spill_assoc, 10);
bitset_t *bs = bitset_alloca(get_irg_last_idx(irg));
res = be_spill_phi(senv, to_spill, to_spill, already_visited_phis, bs); res = be_spill_phi(senv, to_spill, to_spill, already_visited_phis, bs);
else del_set(already_visited_phis);
} else {
res = be_spill_irn(senv, to_spill, to_spill); res = be_spill_irn(senv, to_spill, to_spill);
}
return res; return res;
} }
...@@ -406,7 +408,6 @@ static void phi_walker(ir_node *irn, void *env) { ...@@ -406,7 +408,6 @@ static void phi_walker(ir_node *irn, void *env) {
void be_insert_spills_reloads(spill_env_t *senv) { void be_insert_spills_reloads(spill_env_t *senv) {
const arch_env_t *aenv = senv->chordal_env->birg->main_env->arch_env; const arch_env_t *aenv = senv->chordal_env->birg->main_env->arch_env;
ir_graph *irg = senv->chordal_env->irg;
ir_node *irn; ir_node *irn;
spill_info_t *si; spill_info_t *si;
......
...@@ -139,8 +139,9 @@ static INLINE block_attr_t *get_block_attr(morgan_env_t *env, ir_node *block) { ...@@ -139,8 +139,9 @@ static INLINE block_attr_t *get_block_attr(morgan_env_t *env, ir_node *block) {
return res; return res;
} }
static int is_mem_phi(const ir_node *irn, void *data) { static int is_mem_phi(const ir_node *node, void *data) {
// TODO what is this for? // TODO what is this for?
return 0; return 0;
} }
...@@ -171,6 +172,14 @@ static INLINE void construct_loop_out_edges(ir_node* block, void* e) { ...@@ -171,6 +172,14 @@ static INLINE void construct_loop_out_edges(ir_node* block, void* e) {
} }
} }
static void free_loop_out_edges(morgan_env_t *env) {
loop_attr_t *l_attr;
for(l_attr = set_first(env->loop_attr_set); l_attr != NULL; l_attr = set_next(env->loop_attr_set)) {
del_set(l_attr->out_edges);
}
}
/** /**
* Construct the livethrough unused information for a block * Construct the livethrough unused information for a block
*/ */
...@@ -488,6 +497,7 @@ void be_spill_morgan(const be_chordal_env_t *chordal_env) { ...@@ -488,6 +497,7 @@ void be_spill_morgan(const be_chordal_env_t *chordal_env) {
// cleanup // cleanup
be_end_uses(env.uses); be_end_uses(env.uses);
be_dump(env.irg, "-spillmorgan", dump_ir_block_graph_sched); be_dump(env.irg, "-spillmorgan", dump_ir_block_graph_sched);
free_loop_out_edges(&env);
del_set(env.loop_attr_set); del_set(env.loop_attr_set);
del_set(env.block_attr_set); del_set(env.block_attr_set);
......
...@@ -114,7 +114,7 @@ static void verify_schedule_walker(ir_node *block, void *data) ...@@ -114,7 +114,7 @@ static void verify_schedule_walker(ir_node *block, void *data)
ir_node *node; ir_node *node;
int non_phi_found = 0; int non_phi_found = 0;
int cfchange_found = 0; int cfchange_found = 0;
// TODO ask ABI about delay branches // TODO ask arch about delay branches
int delay_branches = 0; int delay_branches = 0;
pset *uses = pset_new_ptr_default(); pset *uses = pset_new_ptr_default();
...@@ -134,9 +134,9 @@ static void verify_schedule_walker(ir_node *block, void *data) ...@@ -134,9 +134,9 @@ static void verify_schedule_walker(ir_node *block, void *data)
node, block, get_irg_dump_name(env->irg)); node, block, get_irg_dump_name(env->irg));
env->problem_found = 1; env->problem_found = 1;
} }
continue; } else {
} non_phi_found = 1;
non_phi_found = 1; }
// 2. Check for control flow changing nodes // 2. Check for control flow changing nodes
if (is_cfop(node) && get_irn_opcode(node) != iro_Start) { if (is_cfop(node) && get_irn_opcode(node) != iro_Start) {
......
Supports Markdown
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