Commit 9964857a authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Improve printing of ARM address modes.

* Omit the offset when it is 0.
* Show the offset in signed decimal.
parent 2b1e7961
......@@ -68,12 +68,18 @@ static void arm_emit_dest_register(const ir_node *node, int pos)
arm_emit_register(reg);
}
static void arm_emit_offset(const ir_node *node)
static void arm_emit_address_mode(ir_node const *const node)
{
const arm_load_store_attr_t *attr = get_arm_load_store_attr_const(node);
be_emit_char('[');
arm_emit_source_register(node, 0);
arm_load_store_attr_t const *const attr = get_arm_load_store_attr_const(node);
assert(attr->base.is_load_store);
long const offset = attr->offset;
if (offset != 0)
be_emit_irprintf(", #%ld", attr->offset);
be_emit_irprintf("0x%X", attr->offset);
be_emit_char(']');
}
/**
......@@ -258,6 +264,10 @@ void arm_emitf(const ir_node *node, const char *format, ...)
be_emit_char('%');
break;
case 'A':
arm_emit_address_mode(node);
break;
case 'S': {
if (!is_digit(*format))
goto unknown;
......@@ -278,10 +288,6 @@ void arm_emitf(const ir_node *node, const char *format, ...)
arm_emit_address(node);
break;
case 'o':
arm_emit_offset(node);
break;
case 'O':
arm_emit_shifter_operand(node);
break;
......
......@@ -503,7 +503,7 @@ Ldr => {
outs => [ "res", "M" ],
in_reqs => [ "gp", "mem" ],
out_reqs => [ "gp", "mem" ],
emit => 'ldr%ML %D0, [%S0, #%o]',
emit => 'ldr%ML %D0, %A',
attr_type => "arm_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
},
......@@ -515,7 +515,7 @@ Str => {
outs => [ "M" ],
in_reqs => [ "gp", "gp", "mem" ],
out_reqs => [ "mem" ],
emit => 'str%MS %S1, [%S0, #%o]',
emit => 'str%MS %S1, %A',
attr_type => "arm_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
},
......@@ -581,7 +581,7 @@ Ldf => {
outs => [ "res", "M" ],
in_reqs => [ "gp", "mem" ],
out_reqs => [ "fpa", "mem" ],
emit => 'ldf%MF %D0, [%S0, #%o]',
emit => 'ldf%MF %D0, %A',
attr_type => "arm_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
},
......@@ -593,7 +593,7 @@ Stf => {
outs => [ "M" ],
in_reqs => [ "gp", "fpa", "mem" ],
out_reqs => [ "mem" ],
emit => 'stf%MF %S1, [%S0, #%o]',
emit => 'stf%MF %S1, %A',
attr_type => "arm_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int entity_sign, long offset, bool is_frame_entity",
},
......
Supports Markdown
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