2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief restarting SSA construction for values.
14 #include "irgraph_t.h"
18 /** Note: start and finish must use the same kind of walker */
19 static void (*ssa_cons_walker)(ir_graph *, irg_walk_func *, irg_walk_func *, void *)
20 = irg_block_walk_graph;
23 * Post-walker: prepare the graph nodes for new SSA construction cycle by
24 * allocation new arrays.
26 static void prepare_blocks(ir_node *block, void *env)
28 ir_graph *const irg = get_Block_irg(block);
29 unsigned const n_loc = irg->n_loc;
31 /* reset mature flag */
32 set_Block_matured(block, 0);
33 block->attr.block.graph_arr = NEW_ARR_DZ(ir_node*, get_irg_obstack(irg), n_loc);
34 set_Block_phis(block, NULL);
37 void ssa_cons_start(ir_graph *irg, int n_loc)
39 add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_CONSTRUCTION);
41 irg_set_nloc(irg, n_loc);
44 * Note: we could try to reuse existing frag arrays, but it does not
45 * seems worth to do this. First, we have to check if they really exists and
46 * then clear them. We do not expect SSA construction is used often.
48 ssa_cons_walker(irg, NULL, prepare_blocks, NULL);
52 * mature all immature Blocks.
54 static void finish_block(ir_node *block, void *env)
58 mature_immBlock(block);
61 void ssa_cons_finish(ir_graph *irg)
63 ssa_cons_walker(irg, NULL, finish_block, NULL);
64 irg_finalize_cons(irg);