Commit bd66289b authored by Matthias Braun's avatar Matthias Braun
Browse files

arm: Remove CopyB node

We use lower_CopyB anyway so there are no copybs left when lowering.
They are all lowered to load/store sequences or memcpy calls.
parent 2ea8b12b
...@@ -496,74 +496,6 @@ static void emit_arm_B(const ir_node *irn) ...@@ -496,74 +496,6 @@ static void emit_arm_B(const ir_node *irn)
} }
} }
/** Sort register in ascending order. */
static int reg_cmp(const void *a, const void *b)
{
const arch_register_t *const *ra = (const arch_register_t**)a;
const arch_register_t *const *rb = (const arch_register_t**)b;
return *ra < *rb ? -1 : (*ra != *rb);
}
/**
* Create the CopyB instruction sequence.
*/
static void emit_arm_CopyB(const ir_node *irn)
{
const arm_CopyB_attr_t *attr = get_arm_CopyB_attr_const(irn);
unsigned size = attr->size;
/* collect the temporary registers and sort them, we need ascending order */
const arch_register_t *tmpregs[] = {
arch_get_irn_register_in(irn, 2),
arch_get_irn_register_in(irn, 3),
arch_get_irn_register_in(irn, 4),
&arm_registers[REG_R12],
};
/* Note: R12 is always the last register because the RA did not assign
* higher ones */
QSORT(tmpregs, 3, reg_cmp);
if (be_options.verbose_asm) {
arm_emitf(irn, "/* MemCopy (%S1)->(%S0) [%u bytes], Uses %r, %r, %r and %r */",
size, tmpregs[0], tmpregs[1], tmpregs[2], tmpregs[3]);
}
assert(size > 0 && "CopyB needs size > 0" );
if (size & 3) {
be_errorf(irn, "strange hack enabled: copy more bytes than needed");
size += 4;
}
size >>= 2;
switch (size & 3) {
case 0:
break;
case 1:
arm_emitf(irn, "ldr %r, [%S1, #0]", tmpregs[3]);
arm_emitf(irn, "str %r, [%S0, #0]", tmpregs[3]);
break;
case 2:
arm_emitf(irn, "ldmia %S1!, {%r, %r}", tmpregs[0], tmpregs[1]);
arm_emitf(irn, "stmia %S0!, {%r, %r}", tmpregs[0], tmpregs[1]);
break;
case 3:
arm_emitf(irn, "ldmia %S1!, {%r, %r, %r}", tmpregs[0], tmpregs[1],
tmpregs[2]);
arm_emitf(irn, "stmia %S0!, {%r, %r, %r}", tmpregs[0], tmpregs[1],
tmpregs[2]);
break;
}
size >>= 2;
while (size) {
arm_emitf(irn, "ldmia %S1!, {%r, %r, %r}", tmpregs[0], tmpregs[1],
tmpregs[2], tmpregs[3]);
arm_emitf(irn, "stmia %S0!, {%r, %r, %r}", tmpregs[0], tmpregs[1],
tmpregs[2], tmpregs[3]);
--size;
}
}
static void emit_arm_SwitchJmp(const ir_node *irn) static void emit_arm_SwitchJmp(const ir_node *irn)
{ {
const arm_SwitchJmp_attr_t *attr = get_arm_SwitchJmp_attr_const(irn); const arm_SwitchJmp_attr_t *attr = get_arm_SwitchJmp_attr_const(irn);
...@@ -673,7 +605,6 @@ static void arm_register_emitters(void) ...@@ -673,7 +605,6 @@ static void arm_register_emitters(void)
/* custom emitter */ /* custom emitter */
be_set_emitter(op_arm_Address, emit_arm_Address); be_set_emitter(op_arm_Address, emit_arm_Address);
be_set_emitter(op_arm_B, emit_arm_B); be_set_emitter(op_arm_B, emit_arm_B);
be_set_emitter(op_arm_CopyB, emit_arm_CopyB);
be_set_emitter(op_arm_fConst, emit_arm_fConst); be_set_emitter(op_arm_fConst, emit_arm_fConst);
be_set_emitter(op_arm_FrameAddr, emit_arm_FrameAddr); be_set_emitter(op_arm_FrameAddr, emit_arm_FrameAddr);
be_set_emitter(op_arm_Jmp, emit_arm_Jmp); be_set_emitter(op_arm_Jmp, emit_arm_Jmp);
......
...@@ -247,18 +247,6 @@ const arm_SwitchJmp_attr_t *get_arm_SwitchJmp_attr_const(const ir_node *node) ...@@ -247,18 +247,6 @@ const arm_SwitchJmp_attr_t *get_arm_SwitchJmp_attr_const(const ir_node *node)
return (const arm_SwitchJmp_attr_t*)get_irn_generic_attr_const(node); return (const arm_SwitchJmp_attr_t*)get_irn_generic_attr_const(node);
} }
arm_CopyB_attr_t *get_arm_CopyB_attr(ir_node *node)
{
assert(is_arm_CopyB(node));
return (arm_CopyB_attr_t*)get_irn_generic_attr(node);
}
const arm_CopyB_attr_t *get_arm_CopyB_attr_const(const ir_node *node)
{
assert(is_arm_CopyB(node));
return (const arm_CopyB_attr_t*)get_irn_generic_attr_const(node);
}
ir_tarval *get_fConst_value(const ir_node *node) ir_tarval *get_fConst_value(const ir_node *node)
{ {
const arm_fConst_attr_t *attr = get_arm_fConst_attr_const(node); const arm_fConst_attr_t *attr = get_arm_fConst_attr_const(node);
...@@ -339,12 +327,6 @@ static void init_arm_farith_attributes(ir_node *res, ir_mode *mode) ...@@ -339,12 +327,6 @@ static void init_arm_farith_attributes(ir_node *res, ir_mode *mode)
attr->mode = mode; attr->mode = mode;
} }
static void init_arm_CopyB_attributes(ir_node *res, unsigned size)
{
arm_CopyB_attr_t *attr = get_arm_CopyB_attr(res);
attr->size = size;
}
static void init_arm_SwitchJmp_attributes(ir_node *res, static void init_arm_SwitchJmp_attributes(ir_node *res,
const ir_switch_table *table) const ir_switch_table *table)
{ {
...@@ -372,13 +354,6 @@ static int arm_Address_attrs_equal(const ir_node *a, const ir_node *b) ...@@ -372,13 +354,6 @@ static int arm_Address_attrs_equal(const ir_node *a, const ir_node *b)
&& attr_a->fp_offset == attr_b->fp_offset; && attr_a->fp_offset == attr_b->fp_offset;
} }
static int arm_CopyB_attrs_equal(const ir_node *a, const ir_node *b)
{
const arm_CopyB_attr_t *attr_a = get_arm_CopyB_attr_const(a);
const arm_CopyB_attr_t *attr_b = get_arm_CopyB_attr_const(b);
return arm_attrs_equal(a, b) && attr_a->size == attr_b->size;
}
static int arm_CondJmp_attrs_equal(const ir_node *a, const ir_node *b) static int arm_CondJmp_attrs_equal(const ir_node *a, const ir_node *b)
{ {
const arm_CondJmp_attr_t *attr_a = get_arm_CondJmp_attr_const(a); const arm_CondJmp_attr_t *attr_a = get_arm_CondJmp_attr_const(a);
......
...@@ -69,9 +69,6 @@ $default_copy_attr = "arm_copy_attr"; ...@@ -69,9 +69,6 @@ $default_copy_attr = "arm_copy_attr";
arm_farith_attr_t => arm_farith_attr_t =>
"\tinit_arm_attributes(res, irn_flags_, in_reqs, n_res);\n". "\tinit_arm_attributes(res, irn_flags_, in_reqs, n_res);\n".
"\tinit_arm_farith_attributes(res, op_mode);", "\tinit_arm_farith_attributes(res, op_mode);",
arm_CopyB_attr_t =>
"\tinit_arm_attributes(res, irn_flags_, in_reqs, n_res);\n".
"\tinit_arm_CopyB_attributes(res, size);",
); );
my $unop_shifter_operand = { my $unop_shifter_operand = {
...@@ -451,16 +448,6 @@ Bl => { ...@@ -451,16 +448,6 @@ Bl => {
emit => 'bl %I', emit => 'bl %I',
}, },
CopyB => {
state => "pinned",
attr => "unsigned size",
attr_type => "arm_CopyB_attr_t",
in_reqs => [ "!sp", "!sp", "gp", "gp", "gp", "none" ],
out_reqs => [ "none" ],
outs => [ "M" ],
mode => "mode_M",
},
FrameAddr => { FrameAddr => {
op_flags => [ "constlike" ], op_flags => [ "constlike" ],
irn_flags => [ "rematerializable" ], irn_flags => [ "rematerializable" ],
......
...@@ -1343,27 +1343,6 @@ static void double_to_ints(dbg_info *dbgi, ir_node *block, ir_node *node, ...@@ -1343,27 +1343,6 @@ static void double_to_ints(dbg_info *dbgi, ir_node *block, ir_node *node,
*out_value1 = new_r_Proj(ldr1, arm_mode_gp, pn_arm_Ldr_res); *out_value1 = new_r_Proj(ldr1, arm_mode_gp, pn_arm_Ldr_res);
} }
static ir_node *gen_CopyB(ir_node *node)
{
ir_node *block = be_transform_nodes_block(node);
ir_node *src = get_CopyB_src(node);
ir_node *new_src = be_transform_node(src);
ir_node *dst = get_CopyB_dst(node);
ir_node *new_dst = be_transform_node(dst);
ir_node *mem = get_CopyB_mem(node);
ir_node *new_mem = be_transform_node(mem);
dbg_info *dbg = get_irn_dbg_info(node);
int size = get_type_size_bytes(get_CopyB_type(node));
ir_node *src_copy = be_new_Copy(block, new_src);
ir_node *dst_copy = be_new_Copy(block, new_dst);
return new_bd_arm_CopyB(dbg, block, dst_copy, src_copy,
be_new_AnyVal(block, &arm_reg_classes[CLASS_arm_gp]),
be_new_AnyVal(block, &arm_reg_classes[CLASS_arm_gp]),
be_new_AnyVal(block, &arm_reg_classes[CLASS_arm_gp]),
new_mem, size);
}
/** /**
* Transform builtin clz. * Transform builtin clz.
*/ */
...@@ -2053,7 +2032,6 @@ static void arm_register_transformers(void) ...@@ -2053,7 +2032,6 @@ static void arm_register_transformers(void)
be_set_transform_function(op_Cond, gen_Cond); be_set_transform_function(op_Cond, gen_Cond);
be_set_transform_function(op_Const, gen_Const); be_set_transform_function(op_Const, gen_Const);
be_set_transform_function(op_Conv, gen_Conv); be_set_transform_function(op_Conv, gen_Conv);
be_set_transform_function(op_CopyB, gen_CopyB);
be_set_transform_function(op_Div, gen_Div); be_set_transform_function(op_Div, gen_Div);
be_set_transform_function(op_Eor, gen_Eor); be_set_transform_function(op_Eor, gen_Eor);
be_set_transform_function(op_Jmp, gen_Jmp); be_set_transform_function(op_Jmp, gen_Jmp);
......
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