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, ...)
case 'M':
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 'S': sparc_emit_store_mode(node); break;
default: goto unknown;
}
break;
case 'O':
if (!is_digit(*fmt))
goto unknown;
sparc_emit_offset(node, *fmt++ - '0');
break;
case 'R': {
arch_register_t const *const reg = va_arg(ap, const arch_register_t*);
be_emit_char('%');
......
......@@ -24,6 +24,7 @@
* %H <node> high immediate
* %L ir_node* control flow target of the node
* %ML <node> load mode
* %MOx <node> memory access with offset [%reg + %reg/imm]
* %MS <node> store mode
* %R arch_register_t const* register
* %Sx <node> source register x
......
......@@ -380,7 +380,7 @@ Ld => {
ins => [ "ptr", "mem" ],
outs => [ "res", "M" ],
attr_type => "sparc_load_store_attr_t",
emit => "ld%ML [%S0%O1], %D0"
emit => "ld%ML %MO0, %D0"
},
SetHi => {
......@@ -415,7 +415,7 @@ St => {
ins => [ "val", "ptr", "mem" ],
outs => [ "M" ],
attr_type => "sparc_load_store_attr_t",
emit => "st%MS %S0, [%S1%O2]"
emit => "st%MS %S0, %MO1"
},
Save => {
......@@ -825,7 +825,7 @@ Ldf => {
attr_type => "sparc_load_store_attr_t",
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);",
emit => "ld%ML [%S0%O1], %D0"
emit => "ld%ML %MO0, %D0"
},
Stf => {
......@@ -842,7 +842,7 @@ Stf => {
attr_type => "sparc_load_store_attr_t",
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);",
emit => "st%MS %S0, [%S1%O2]",
emit => "st%MS %S0, %MO1",
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