- in[0] = arg;
- in[1] = get_node_for_register(pairs, n, cycle->elems[i + 1], 0);
-
- cpyxchg = new_Perm(fact, reg_class, env->chord_env->irg, block, 2, in);
- set_Proj_pred(res, cpyxchg);
- set_Proj_proj(res, 0);
- set_Proj_pred(get_node_for_register(pairs, n, cycle->elems[i], 1), cpyxchg);
- set_Proj_proj(get_node_for_register(pairs, n, cycle->elems[i], 1), 1);
+ in[0] = arg1;
+ in[1] = arg2;
+
+ DBG((mod, LEVEL_1, "%+F creating exchange node (%+F, %s) and (%+F, %s) with\n",
+ irn, arg1, cycle->elems[i]->name, arg2, cycle->elems[i + 1]->name));
+ DBG((mod, LEVEL_1, "%+F (%+F, %s) and (%+F, %s)\n",
+ irn, res1, cycle->elems[i]->name, res2, cycle->elems[i + 1]->name));
+
+ cpyxchg = be_new_Perm(reg_class, env->chord_env->irg, block, 2, in);
+
+ sched_remove(res1);
+ sched_remove(res2);
+
+ set_Proj_pred(res2, cpyxchg);
+ set_Proj_proj(res2, 0);
+ set_Proj_pred(res1, cpyxchg);
+ set_Proj_proj(res1, 1);
+
+ sched_add_after(sched_point, res1);
+ sched_add_after(sched_point, res2);
+
+ arch_set_irn_register(arch_env, res2, cycle->elems[i + 1]);
+ arch_set_irn_register(arch_env, res1, cycle->elems[i]);