- /* We use the block visited flag to indicate blocks in the dominance
- * froniter of some values (and this potentially needing phis) */
- inc_irg_block_visited(irg);
-
- DBG((dbgssa, LEVEL_1, "Introducing following copies for:\n"));
-
- /* compute iterated dominance frontiers and create lists in the block link
- * fields that sort usages by dominance. Blocks in the dominance frontier
- * are marked by links back to the block. */
- worklist = new_waitq();
-
- foreach_pset(nodes, value) {
- block = get_nodes_block(value);
- env.mode = get_irn_mode(value);
-
- if(!irn_visited(block)) {
- waitq_put(worklist, block);
- }
- introduce_def_at_block(block, value);
- DBG((dbgssa, LEVEL_1, "\t%+F in %+F\n", value, block));
- }
-
- mark_iterated_dominance_frontiers(domfronts, worklist);
- del_waitq(worklist);
-
- /*
- * Search the valid def for each use and set it.
- */
- foreach_pset(nodes, value) {
- foreach_out_edge_safe(value, edge, next) {
- ir_node *use = get_edge_src_irn(edge);
- ir_node *at = use;
- int pos = get_edge_src_pos(edge);
-
- if(ignores != NULL && pset_find_ptr(ignores, use))
- continue;
-
- if(is_Phi(use)) {
- ir_node *block = get_nodes_block(use);
- ir_node *predblock = get_Block_cfgpred_block(block, pos);
- at = sched_last(predblock);
- }
-
- ir_node *def = search_def(&env, at);
-
- if(def == NULL) {
- panic("no definition found for %+F input %d\n", use, pos);
- }
-
- DBG((dbgssa, LEVEL_2, "\t%+F(%d) -> %+F\n", use, pos, def));
- set_irn_n(use, pos, def);
- }