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

Remove goto

parent 5a0479fb
......@@ -585,34 +585,38 @@ void optimize_cf(ir_graph *irg)
/* we use the mark flag to mark removable blocks */
ir_reserve_resources(irg, IR_RESOURCE_BLOCK_MARK | IR_RESOURCE_IRN_LINK);
restart:
env.changed = false;
env.phis_moved = false;
assure_doms(irg);
/* The Cond optimization might expose unreachable code, so we loop */
for (;;) {
int length;
env.changed = false;
env.phis_moved = false;
env.switch_conds = NEW_ARR_F(ir_node*, 0);
irg_walk(end, clear_link, collect_nodes, &env);
assure_doms(irg);
/* handle all collected switch-Conds */
n = ARR_LEN(env.switch_conds);
for (i = 0; i < n; ++i) {
ir_node *cond = env.switch_conds[i];
env.changed |= handle_switch_cond(cond);
}
DEL_ARR_F(env.switch_conds);
env.switch_conds = NEW_ARR_F(ir_node*, 0);
irg_walk(end, clear_link, collect_nodes, &env);
/* handle all collected switch-Conds */
length = ARR_LEN(env.switch_conds);
for (i = 0; i < length; ++i) {
ir_node *cond = env.switch_conds[i];
env.changed |= handle_switch_cond(cond);
}
DEL_ARR_F(env.switch_conds);
if (!env.changed) break;
if (env.changed) {
/* Handle graph state if was changed. */
set_irg_doms_inconsistent(irg);
set_irg_extblk_inconsistent(irg);
set_irg_entity_usage_state(irg, ir_entity_usage_not_computed);
/* The Cond optimization might generate unreachable code, so restart if
it happens. */
goto restart;
}
/* assert due to collect_nodes:
* 1. removable blocks are now marked as such
* 2. phi lists are up to date
*/
/* Optimize the standard code. */
assure_doms(irg);
irg_block_walk_graph(irg, optimize_blocks, remove_simple_blocks, &env);
......
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