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

sparc: Add the format specifier '%MOx' to print a memory access with offset.

This replaces '[%Sx%O(x+1)]'.
parent 78087bf5
...@@ -617,18 +617,23 @@ void sparc_emitf(ir_node const *const node, char const *fmt, ...) ...@@ -617,18 +617,23 @@ void sparc_emitf(ir_node const *const node, char const *fmt, ...)
case 'M': case 'M':
switch (*fmt++) { switch (*fmt++) {
case 'O': {
if (!is_digit(*fmt))
goto unknown;
unsigned const pos = *fmt++ - '0';
be_emit_char('[');
sparc_emit_source_register(node, pos);
sparc_emit_offset(node, pos + 1);
be_emit_char(']');
break;
}
case 'L': sparc_emit_load_mode(node); break; case 'L': sparc_emit_load_mode(node); break;
case 'S': sparc_emit_store_mode(node); break; case 'S': sparc_emit_store_mode(node); break;
default: goto unknown; default: goto unknown;
} }
break; break;
case 'O':
if (!is_digit(*fmt))
goto unknown;
sparc_emit_offset(node, *fmt++ - '0');
break;
case 'R': { case 'R': {
arch_register_t const *const reg = va_arg(ap, const arch_register_t*); arch_register_t const *const reg = va_arg(ap, const arch_register_t*);
be_emit_char('%'); be_emit_char('%');
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* %H <node> high immediate * %H <node> high immediate
* %L ir_node* control flow target of the node * %L ir_node* control flow target of the node
* %ML <node> load mode * %ML <node> load mode
* %MOx <node> memory access with offset [%reg + %reg/imm]
* %MS <node> store mode * %MS <node> store mode
* %R arch_register_t const* register * %R arch_register_t const* register
* %Sx <node> source register x * %Sx <node> source register x
......
...@@ -380,7 +380,7 @@ Ld => { ...@@ -380,7 +380,7 @@ Ld => {
ins => [ "ptr", "mem" ], ins => [ "ptr", "mem" ],
outs => [ "res", "M" ], outs => [ "res", "M" ],
attr_type => "sparc_load_store_attr_t", attr_type => "sparc_load_store_attr_t",
emit => "ld%ML [%S0%O1], %D0" emit => "ld%ML %MO0, %D0"
}, },
SetHi => { SetHi => {
...@@ -415,7 +415,7 @@ St => { ...@@ -415,7 +415,7 @@ St => {
ins => [ "val", "ptr", "mem" ], ins => [ "val", "ptr", "mem" ],
outs => [ "M" ], outs => [ "M" ],
attr_type => "sparc_load_store_attr_t", attr_type => "sparc_load_store_attr_t",
emit => "st%MS %S0, [%S1%O2]" emit => "st%MS %S0, %MO1"
}, },
Save => { Save => {
...@@ -825,7 +825,7 @@ Ldf => { ...@@ -825,7 +825,7 @@ Ldf => {
attr_type => "sparc_load_store_attr_t", attr_type => "sparc_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity", attr => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);", custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
emit => "ld%ML [%S0%O1], %D0" emit => "ld%ML %MO0, %D0"
}, },
Stf => { Stf => {
...@@ -842,7 +842,7 @@ Stf => { ...@@ -842,7 +842,7 @@ Stf => {
attr_type => "sparc_load_store_attr_t", attr_type => "sparc_load_store_attr_t",
attr => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity", attr => "ir_mode *ls_mode, ir_entity *entity, int32_t offset, bool is_frame_entity",
custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);", custominit => "init_sparc_load_store_attributes(res, ls_mode, entity, offset, is_frame_entity, false);",
emit => "st%MS %S0, [%S1%O2]", emit => "st%MS %S0, %MO1",
mode => "mode_M", mode => "mode_M",
}, },
......
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