- /*
- * Consider the definition of the node, but not the uses, since
- * newly created liveranges by the node after which the perm is
- * located are not of interest for the perm.
- */
- if(irn == pos)
- break;
-
- for(i = 0, n = get_irn_arity(irn); i < n; ++i) {
- ir_node *op = get_irn_n(irn, i);
-
- if(arch_irn_has_reg_class(arch_env, op, arch_pos_make_out(0), cls))
- pset_insert_ptr(live, op);
- }
- }
-
- n = pset_count(live);
- nodes = malloc(n * sizeof(nodes[0]));
-
- for(irn = pset_first(live), i = 0; irn; irn = pset_next(live), i++)
- nodes[i] = irn;
-
- perm = new_Perm(env->main_env->node_factory, cls, irg, bl, n, nodes);
- sched_add_after(pos, perm);
- free(nodes);
-
- curr = perm;
- for(i = 0; i < n; ++i) {
- ir_node *copies[1];
- ir_node *perm_op = get_irn_n(perm, i);
- const arch_register_t *reg = arch_get_irn_register(arch_env, perm_op, arch_pos_make_out(0));
-
- ir_mode *mode = get_irn_mode(perm_op);
- ir_node *proj = new_r_Proj(irg, bl, perm, mode, i);
- arch_set_irn_register(arch_env, proj, arch_pos_make_out(0), reg);
-
- sched_add_after(curr, proj);
- curr = proj;
-
- copies[0] = proj;
- be_introduce_copies(env->dom_front, perm_op, array_size(copies), copies);
- }
- return perm;