Commit db1b619b authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Clean up 'be_new_Perm()'.

parent 2da93aea
......@@ -304,8 +304,8 @@ static void lower_perm_node(ir_node *const perm, arch_register_class_t const *co
new_p = q->in_node;
new_q = p->in_node;
} else {
ir_node *const in[] = { p->in_node, q->in_node };
ir_node *const xchg = be_new_Perm(cls, block, ARRAY_SIZE(in), in);
ir_node *const in[] = { p->in_node, q->in_node };
ir_node *const xchg = be_new_Perm(block, ARRAY_SIZE(in), in);
DBG((dbg, LEVEL_2, "%+F: inserting %+F for %+F (%s) and %+F (%s)\n", perm, xchg, in[0], arch_get_irn_register(in[0]), in[1], arch_get_irn_register(in[1])));
new_p = be_new_Proj_reg(xchg, 0, q->in_reg);
new_q = be_new_Proj_reg(xchg, 1, q->out_reg);
......
......@@ -139,26 +139,20 @@ static void init_node_attr(ir_node *const node, unsigned const n_outputs, arch_i
info->flags = flags;
}
ir_node *be_new_Perm(arch_register_class_t const *const cls,
ir_node *const block, int const n,
ir_node *const *const in)
ir_node *be_new_Perm(ir_node *const block, int const n, ir_node *const *const in)
{
ir_graph *irg = get_irn_irg(block);
ir_node *irn = new_ir_node(NULL, irg, block, op_be_Perm, mode_T, n, in);
ir_graph *const irg = get_irn_irg(block);
ir_node *const irn = new_ir_node(NULL, irg, block, op_be_Perm, mode_T, n, in);
init_node_attr(irn, n, arch_irn_flags_none);
be_node_attr_t *attr = (be_node_attr_t*)get_irn_generic_attr(irn);
be_node_attr_t *const attr = (be_node_attr_t*)get_irn_generic_attr(irn);
attr->exc.pinned = true;
for (int i = 0; i < n; ++i) {
const ir_node *input = in[i];
const arch_register_req_t *req = arch_get_irn_register_req(input);
if (req->width == 1) {
be_node_set_register_req_in(irn, i, cls->class_req);
arch_set_irn_register_req_out(irn, i, cls->class_req);
} else {
arch_register_req_t *const new_req = be_create_cls_req(irg, cls, req->width);
be_node_set_register_req_in(irn, i, new_req);
arch_set_irn_register_req_out(irn, i, new_req);
}
arch_register_req_t const *const in_req = arch_get_irn_register_req(in[i]);
arch_register_req_t const *const slot_req =
in_req->width == 1 ? in_req->cls->class_req :
be_create_cls_req(irg, in_req->cls, in_req->width);
be_node_set_register_req_in( irn, i, slot_req);
arch_set_irn_register_req_out(irn, i, slot_req);
}
return irn;
......
......@@ -88,8 +88,7 @@ ir_node *be_new_Copy_before_reg(ir_node *val, ir_node *before, arch_register_t c
/**
* Make a new Perm node.
*/
ir_node *be_new_Perm(arch_register_class_t const *cls, ir_node *block, int n,
ir_node *const *in);
ir_node *be_new_Perm(ir_node *block, int n, ir_node *const *in);
/**
* Create a new MemPerm node.
......
......@@ -851,7 +851,7 @@ static void permute_values(ir_nodeset_t *live_nodes, ir_node *before,
unsigned r2 = permutation[old_r];
ir_node *const in[] = { assignments[r2], assignments[old_r] };
ir_node *const perm = be_new_Perm(cls, block, ARRAY_SIZE(in), in);
ir_node *const perm = be_new_Perm(block, ARRAY_SIZE(in), in);
sched_add_before(before, perm);
DB((dbg, LEVEL_2, "Perm %+F (perm %+F,%+F, before %+F)\n",
perm, in[0], in[1], before));
......
......@@ -109,7 +109,7 @@ static void impl_parcopy(const arch_register_class_t *cls,
}
if (perm_size > 0) {
ir_node *perm = be_new_Perm(cls, block, perm_size, perm_ins);
ir_node *const perm = be_new_Perm(block, perm_size, perm_ins);
sched_add_before(before, perm);
unsigned i = 0;
......
......@@ -85,7 +85,7 @@ ir_node *insert_Perm_before(ir_graph *irg, const arch_register_class_t *cls,
QSORT(nodes, n, cmp_node_nr);
ir_node *const block = get_nodes_block(pos);
ir_node *const perm = be_new_Perm(cls, block, n, nodes);
ir_node *const perm = be_new_Perm(block, n, nodes);
sched_add_before(pos, perm);
free(nodes);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment