ir_node *src_copy;
ir_node *dst_copy;
- src_copy = be_new_Copy(&arm_reg_classes[CLASS_arm_gp], block, new_src);
- dst_copy = be_new_Copy(&arm_reg_classes[CLASS_arm_gp], block, new_dst);
+ src_copy = be_new_Copy(block, new_src);
+ dst_copy = be_new_Copy(block, new_dst);
return new_bd_arm_CopyB(dbg, block, dst_copy, src_copy,
new_bd_arm_EmptyReg(dbg, block),
DB((dbg, LEVEL_1, "%+F creating copy node (%+F, %s) -> (%+F, %s)\n",
irn, arg1, cycle.elems[i]->name, res2, cycle.elems[i + 1]->name));
- cpyxchg = be_new_Copy(reg_class, block, arg1);
+ cpyxchg = be_new_Copy(block, arg1);
arch_set_irn_register(cpyxchg, cycle.elems[i + 1]);
/* exchange copy node and proj */
/* check if already exists such a copy in the schedule immediately before */
cpy = find_copy(skip_Proj(irn), other_different);
if (! cpy) {
- cpy = be_new_Copy(cls, block, other_different);
+ cpy = be_new_Copy(block, other_different);
arch_set_irn_flags(cpy, arch_irn_flags_dont_spill);
DB((dbg_constr, LEVEL_1, "created non-spillable %+F for value %+F\n", cpy, other_different));
} else {
/* Add the Keep resp. CopyKeep and reroute the users */
/* of the other_different irn in case of CopyKeep. */
if (has_irn_users(other_different)) {
- keep = be_new_CopyKeep_single(cls, block, cpy, irn, get_irn_mode(other_different));
+ keep = be_new_CopyKeep_single(block, cpy, irn);
be_node_set_reg_class_in(keep, 1, cls);
} else {
ir_node *in[2];
}
#ifdef KEEP_ALIVE_COPYKEEP_HACK
- new_ck = be_new_CopyKeep(entry->cls, get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in, mode_ANY);
+ new_ck = be_new_CopyKeep(get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in);
keep_alive(new_ck);
#else
- new_ck = be_new_CopyKeep(entry->cls, get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in, get_irn_mode(ref));
+ new_ck = be_new_CopyKeep(get_nodes_block(ref), be_get_CopyKeep_op(ref), n_melt, new_ck_in);
#endif /* KEEP_ALIVE_COPYKEEP_HACK */
/* set register class for all kept inputs */
return irn;
}
-ir_node *be_new_Copy(const arch_register_class_t *cls, ir_node *bl, ir_node *op)
+ir_node *be_new_Copy(ir_node *bl, ir_node *op)
{
ir_node *in[1];
ir_node *res;
arch_register_req_t *req;
be_node_attr_t *attr;
ir_graph *irg = get_Block_irg(bl);
+ const arch_register_req_t *in_req = arch_get_irn_register_req(op);
+ const arch_register_class_t *cls = in_req->cls;
in[0] = op;
res = new_ir_node(NULL, irg, bl, op_be_Copy, get_irn_mode(op), 1, in);
req = allocate_reg_req(res);
req->cls = cls;
- req->type = arch_register_req_type_should_be_same;
+ req->type = arch_register_req_type_should_be_same
+ | (in_req->type & arch_register_req_type_aligned);
req->other_same = 1U << 0;
- req->width = 1;
+ req->width = in_req->width;
be_set_constr_out(res, 0, req);
return res;
return attr->ent;
}
-ir_node *be_new_CopyKeep(const arch_register_class_t *cls, ir_node *bl, ir_node *src, int n, ir_node *in_keep[], ir_mode *mode)
+ir_node *be_new_CopyKeep(ir_node *bl, ir_node *src, int n, ir_node *in_keep[])
{
ir_node *irn;
ir_node **in = ALLOCAN(ir_node*, n + 1);
ir_graph *irg = get_Block_irg(bl);
+ const arch_register_req_t *req = arch_get_irn_register_req(src);
+ const arch_register_class_t *cls = req->cls;
+ ir_mode *mode = get_irn_mode(src);
be_node_attr_t *attr;
in[0] = src;
return irn;
}
-ir_node *be_new_CopyKeep_single(const arch_register_class_t *cls, ir_node *bl, ir_node *src, ir_node *keep, ir_mode *mode)
+ir_node *be_new_CopyKeep_single(ir_node *bl, ir_node *src, ir_node *keep)
{
- return be_new_CopyKeep(cls, bl, src, 1, &keep, mode);
+ return be_new_CopyKeep(bl, src, 1, &keep);
}
ir_node *be_get_CopyKeep_op(const ir_node *cpy)
return spill;
}
-ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert, ir_mode *mode, ir_node *spill)
+ir_node *be_reload(const arch_register_class_t *cls, ir_node *insert,
+ ir_mode *mode, ir_node *spill)
{
ir_node *reload;
ir_node *bl = is_Block(insert) ? insert : get_nodes_block(insert);
/**
* Make a new Copy node.
*/
-ir_node *be_new_Copy(const arch_register_class_t *cls, ir_node *block,
- ir_node *in);
+ir_node *be_new_Copy(ir_node *block, ir_node *in);
/** Returns the Copy Argument. */
ir_node *be_get_Copy_op(const ir_node *cpy);
/** Sets the Copy Argument. */
enum {
n_be_CopyKeep_op = 0
};
-ir_node *be_new_CopyKeep(const arch_register_class_t *cls, ir_node *block,
- ir_node *src, int n, ir_node *in_keep[],
- ir_mode *mode);
+ir_node *be_new_CopyKeep(ir_node *block, ir_node *src,
+ int n, ir_node *in_keep[]);
-ir_node *be_new_CopyKeep_single(const arch_register_class_t *cls,
- ir_node *block, ir_node *src, ir_node *keep,
- ir_mode *mode);
+ir_node *be_new_CopyKeep_single(ir_node *block, ir_node *src, ir_node *keep);
ir_node *be_get_CopyKeep_op(const ir_node *cpy);
return false;
reg = arch_register_for_index(cls, r);
- copy = be_new_Copy(cls, block, to_split);
+ copy = be_new_Copy(block, to_split);
mark_as_copy_of(copy, to_split);
/* hacky, but correct here */
if (assignments[arch_register_get_index(from_reg)] == to_split)
/* create a copy */
src = assignments[old_r];
- copy = be_new_Copy(cls, block, src);
+ copy = be_new_Copy(block, src);
sched_add_before(before, copy);
reg = arch_register_for_index(cls, r);
DB((dbg, LEVEL_2, "Copy %+F (from %+F, before %+F) -> %s\n",
if (rbitset_is_set(req->limited, reg->index))
continue;
- copy = be_new_Copy(cls, block, op);
+ copy = be_new_Copy(block, op);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
if (rbitsets_equal(req->limited, req2->limited, cls->n_regs))
continue;
- copy = be_new_Copy(cls, block, in);
+ copy = be_new_Copy(block, in);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
if (be_is_Copy(in))
continue;
- copy = be_new_Copy(cls, block, in);
+ copy = be_new_Copy(block, in);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
DBG((dbg, LEVEL_3, "inserting constr copy %+F for %+F pos %d\n",
phi = (ir_node*)get_irn_link(phi)) {
ir_node *phi_block = get_nodes_block(phi);
const arch_register_t *phi_reg = arch_get_irn_register(phi);
- const arch_register_class_t *cls = phi_reg->reg_class;
int max;
int i;
insert it into schedule,
pin it
*/
- ir_node *dupl = be_new_Copy(cls, arg_block, arg);
+ ir_node *dupl = be_new_Copy(arg_block, arg);
set_irn_n(phi, i, dupl);
arch_set_irn_register(dupl, phi_reg);
pin it
*/
ir_node *perm = get_Proj_pred(arg);
- ir_node *dupl = be_new_Copy(cls, arg_block, arg);
+ ir_node *dupl = be_new_Copy(arg_block, arg);
ir_node *ins;
set_irn_n(phi, i, dupl);
sched_add_after(start, push);
/* move esp to ebp */
- curr_bp = be_new_Copy(bp->reg_class, block, curr_sp);
+ curr_bp = be_new_Copy(block, curr_sp);
sched_add_after(push, curr_bp);
be_set_constr_single_reg_out(curr_bp, 0, bp, arch_register_req_type_ignore);
- curr_sp = be_new_CopyKeep_single(sp->reg_class, block, curr_sp, curr_bp, mode_gp);
+ curr_sp = be_new_CopyKeep_single(block, curr_sp, curr_bp);
sched_add_after(curr_bp, curr_sp);
be_set_constr_single_reg_out(curr_sp, 0, sp, arch_register_req_type_produces_sp);
edges_reroute(initial_bp, curr_bp);
* (the register can't be live since the operation will override it
* anyway) */
if (uses_out_reg == NULL) {
- ir_node *copy = be_new_Copy(cls, block, in_node);
+ ir_node *copy = be_new_Copy(block, in_node);
DBG_OPT_2ADDRCPY(copy);
/* destination is the out register */