+static int need_copy(ir_node *node, ir_node *block)
+{
+ int i, arity;
+
+ /* Phi always stop the recursion */
+ if (is_Phi(node))
+ return get_irn_intra_n(node, -1) == block;
+
+ if (! is_nice_value(node))
+ return 0;
+
+ /* check predecessor */
+ arity = get_irn_intra_arity(node);
+ for (i = 0; i < arity; ++i) {
+ ir_node *pred = get_irn_intra_n(node, i);
+ ir_node *local_bl = get_irn_intra_n(pred, -1);
+ ir_node *leader = value_lookup(get_block_info(local_bl)->avail_out, pred);
+
+ pred = leader != NULL ? leader : pred;
+ if (need_copy(pred, block))
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * Translate a node
+ */
+static ir_node *translate(ir_node *node, ir_node *block, int pos, pre_env *env)
+{
+ int i, arity, need_new;
+ ir_node *res, *nn, **in;
+
+ /* Phi always stop the recursion */
+ if (is_Phi(node)) {
+ if (get_irn_intra_n(node, -1) == block)
+ return get_Phi_pred(node, pos);
+ return node;
+ }
+
+ if (! is_nice_value(node))
+ return node;
+
+ arity = get_irn_intra_arity(node);
+ if (arity > 0) {
+ NEW_ARR_A(ir_node *, in, arity);
+ i = arity - 1;
+ need_new = 0;
+ do {
+ ir_node *pred = get_irn_intra_n(node, i);
+ ir_node *pred_blk = get_irn_intra_n(pred, -1);
+ ir_node *leader = value_lookup(get_block_info(pred_blk)->avail_out, pred);
+ in[i] = translate(leader ? leader : pred, block, pos, env);
+ need_new |= (in[i] != pred);
+ --i;
+ } while(i >= 0);
+ if (! need_new)
+ return node;
+
+ /* create a copy */
+ nn = new_ir_node(
+ get_irn_dbg_info(node),
+ current_ir_graph,
+ get_Block_cfgpred_block(block, pos),
+ get_irn_op(node),
+ get_irn_mode(node),
+ arity,
+ in);
+ /* We need the attribute copy here, because the Hash value of a
+ node might depend on that. */
+ copy_node_attr(node, nn);
+ res = node_add(env->trans_set, nn);
+ if (nn != res)
+ obstack_free(env->obst, nn);
+ else
+ DB((dbg, LEVEL_2, "--> Translate %+F in <%+F,%d> into %+F\n", node, block, pos, res));
+ return res;
+ }
+ return node;
+}
+
+/**
+ * Implements phi_translate.
+ */
+static ir_node *deep_phi_translate(ir_node *node, ir_node *block, int pos, pre_env *env)