Commit e66c1853 authored by Andreas Zwinkau's avatar Andreas Zwinkau
Browse files

user of analysis must reserve resources

This is safer for resources the user requires itself, since the
information must live longer than the analysis then.
parent d1e88988
......@@ -296,7 +296,8 @@ void dca_analyze(ir_graph *irg)
assert(tarval_get_integer_overflow_mode() == TV_OVERFLOW_WRAP);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
assert(((ir_resources_reserved(irg) & IR_RESOURCE_IRN_LINK) != 0) &&
"user of dc analysis must reserve links");
irg_walk_graph(irg, dca_init_node, NULL, 0);
......@@ -312,8 +313,6 @@ void dca_analyze(ir_graph *irg)
del_pdeq(q);
}
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
return;
}
......
......@@ -653,7 +653,10 @@ void fp_vrp_analyze(ir_graph* const irg, struct obstack *client_obst)
FIRM_DBG_REGISTER(dbg, "firm.ana.fp-vrp");
DB((dbg, LEVEL_1, "===> Performing constant propagation on %+F (analysis)\n", irg));
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_PHI_LIST);
assert(((ir_resources_reserved(irg) & IR_RESOURCE_IRN_LINK) != 0) &&
"user of fp-vrp analysis must reserve links");
assert(((ir_resources_reserved(irg) & IR_RESOURCE_PHI_LIST) != 0) &&
"user of fp-vrp analysis must reserve phi list");
{
pdeq* const q = new_pdeq();
......@@ -680,6 +683,4 @@ void fp_vrp_analyze(ir_graph* const irg, struct obstack *client_obst)
del_pdeq(q);
}
ir_free_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_PHI_LIST);
}
......@@ -219,13 +219,13 @@ void fixpoint_vrp(ir_graph* const irg)
obstack_init(&private_obst);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_PHI_LIST);
fp_vrp_analyze(irg, &private_obst);
FIRM_DBG_REGISTER(dbg, "firm.opt.fp-vrp");
DB((dbg, LEVEL_1, "===> Performing constant propagation on %+F (optimization)\n", irg));
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_PHI_LIST);
DB((dbg, LEVEL_2, "---> Applying analysis results\n"));
env.modified = 0;
irg_walk_graph(irg, NULL, apply_result, &env);
......
......@@ -86,18 +86,23 @@ void occult_consts(ir_graph *irg)
| IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES);
env_t env;
env.changed = false;
obstack_init(&env.obst);
env.changed = false;
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK | IR_RESOURCE_PHI_LIST);
fp_vrp_analyze(irg, &env.obst);
ir_nodemap_init(&env.vrp, irg);
irg_walk_graph(irg, fill_nodemap, 0, &env.vrp);
ir_free_resources(irg, IR_RESOURCE_PHI_LIST);
dca_analyze(irg);
ir_nodemap_init(&env.dca, irg);
irg_walk_graph(irg, fill_nodemap, 0, &env.dca);
ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
irg_walk_graph(irg, occult_const_opt_walker, 0, &env);
ir_nodemap_destroy(&env.dca);
......
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