X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firssacons.c;h=a96c48f2574037982ee4fdd1ac5142d4c6252704;hb=4f92e524762e0febc361676111b3b5b79addd03a;hp=9dd9e942c9ccf2b1794cb926e4e77d64446a5959;hpb=9732efd178d7a99a751cc5fd2be3297b688f2595;p=libfirm diff --git a/ir/ir/irssacons.c b/ir/ir/irssacons.c index 9dd9e942c..a96c48f25 100644 --- a/ir/ir/irssacons.c +++ b/ir/ir/irssacons.c @@ -30,23 +30,24 @@ #include "irnode_t.h" #include "irgwalk.h" +/** Note: start and finish must use the same kind of walker */ +static void (*ssa_cons_walker)(ir_graph *, irg_walk_func *, irg_walk_func *, void *) + = irg_block_walk_graph; + /** * Post-walker: prepare the graph nodes for new SSA construction cycle by * allocation new arrays. */ -static void prepare_nodes(ir_node *irn, void *env) +static void prepare_blocks(ir_node *block, void *env) { - (void)env; - - if (is_Block(irn)) { - unsigned n_loc = current_ir_graph->n_loc; - struct obstack *obst = current_ir_graph->obst; - /* reset mature flag */ - irn->attr.block.is_matured = 0; - irn->attr.block.graph_arr = NEW_ARR_D(ir_node *, obst, n_loc); - memset(irn->attr.block.graph_arr, 0, sizeof(ir_node*) * n_loc); - irn->attr.block.phis = NULL; - } + unsigned n_loc = current_ir_graph->n_loc; + struct obstack *obst = current_ir_graph->obst; + (void)env; + /* reset mature flag */ + set_Block_matured(block, 0); + block->attr.block.graph_arr = NEW_ARR_D(ir_node *, obst, n_loc); + memset(block->attr.block.graph_arr, 0, sizeof(ir_node*) * n_loc); + set_Block_phis(block, NULL); } /* @@ -75,7 +76,7 @@ void ssa_cons_start(ir_graph *irg, int n_loc) * seems worth to do this. First, we have to check if they really exists and * then clear them. We do not expect SSA construction is used often. */ - irg_walk_graph(irg, NULL, prepare_nodes, NULL); + ssa_cons_walker(irg, NULL, prepare_blocks, NULL); } /** @@ -95,6 +96,6 @@ static void finish_block(ir_node *block, void *env) */ void ssa_cons_finish(ir_graph *irg) { - irg_block_walk_graph(irg, NULL, finish_block, NULL); + ssa_cons_walker(irg, NULL, finish_block, NULL); irg_finalize_cons(irg); }