summaryrefslogtreecommitdiffhomepage
path: root/ir/be
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-04 08:36:55 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-04-05 20:44:54 +0200
commit8661e326d4f90dc9749f8df60184f03ad029fba8 (patch)
tree0337c2fd01859e2d0567cdff95bbb7eef26ad47e /ir/be
parent4aacad60e2ba5c17db38e3e106a4947a21ac2983 (diff)
beasm: Handle operand modifier 'l' in all backends.
Diffstat (limited to 'ir/be')
-rw-r--r--ir/be/amd64/amd64_emitter.c4
-rw-r--r--ir/be/arm/arm_emitter.c6
-rw-r--r--ir/be/beasm.c2
-rw-r--r--ir/be/ia32/ia32_emitter.c4
-rw-r--r--ir/be/mips/mips_emitter.c1
-rw-r--r--ir/be/riscv/riscv_emitter.c1
-rw-r--r--ir/be/sparc/sparc_emitter.c1
7 files changed, 15 insertions, 4 deletions
diff --git a/ir/be/amd64/amd64_emitter.c b/ir/be/amd64/amd64_emitter.c
index e3e3613..bf06f93 100644
--- a/ir/be/amd64/amd64_emitter.c
+++ b/ir/be/amd64/amd64_emitter.c
@@ -533,6 +533,7 @@ static void emit_amd64_asm_operand(ir_node const *const node, char const modifie
* X: no modifying effect (gcc doc: don't print any sort of PIC '@' suffix for a symbol)
* b: 8 bit low name of register
* c: immediate without prefix '$'
+ * l: label without prefix '$'
* h: 8 bit high name of register
* k: 32 bit name of register
* p: like 'c' and other operands unmodified (gcc doc: "print raw symbol")
@@ -573,7 +574,8 @@ static void emit_amd64_asm_operand(ir_node const *const node, char const modifie
return;
case BE_ASM_OPERAND_LABEL:
- be_emit_char('$');
+ if (modifier != 'l')
+ be_emit_char('$');
be_emit_cfop_target_pos(node, op->op.pos);
return;
}
diff --git a/ir/be/arm/arm_emitter.c b/ir/be/arm/arm_emitter.c
index b8a2ea4..2650d5b 100644
--- a/ir/be/arm/arm_emitter.c
+++ b/ir/be/arm/arm_emitter.c
@@ -423,7 +423,8 @@ static void emit_arm_asm_operand(ir_node const *const node, char const modifier,
/* modifiers:
* B: Ones' complement of immediate and without prefix '#'
* C: memory reference consisting only of a single register
- * c: immediate without prefix '#' */
+ * c: immediate without prefix '#'
+ * l: label without prefix '#' */
if (!be_is_valid_asm_operand_kind(node, modifier, pos, op->op.kind, "", "Bc", "C"))
return;
@@ -457,7 +458,8 @@ static void emit_arm_asm_operand(ir_node const *const node, char const modifier,
return;
case BE_ASM_OPERAND_LABEL:
- be_emit_char('#');
+ if (modifier != 'l')
+ be_emit_char('#');
be_emit_cfop_target_pos(node, op->op.pos);
return;
diff --git a/ir/be/beasm.c b/ir/be/beasm.c
index c1f28b3..6798a1e 100644
--- a/ir/be/beasm.c
+++ b/ir/be/beasm.c
@@ -435,6 +435,8 @@ bool be_is_valid_asm_operand_kind(ir_node const *const node, char const modifier
want = BE_ASM_OPERAND_IMMEDIATE;
} else if (strchr(mod_mem, modifier)) {
want = BE_ASM_OPERAND_MEMORY;
+ } else if (modifier == 'l') {
+ want = BE_ASM_OPERAND_LABEL;
} else {
be_errorf(node, "asm contains unknown modifier '%c'", modifier);
return false;
diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c
index ee96481..304519a 100644
--- a/ir/be/ia32/ia32_emitter.c
+++ b/ir/be/ia32/ia32_emitter.c
@@ -750,6 +750,7 @@ static void emit_ia32_asm_operand(ir_node const *const node, char const modifier
* X: no modifying effect (gcc doc: don't print any sort of PIC '@' suffix for a symbol)
* b: 8 bit low name of register
* c: immediate without prefix '$'
+ * l: label without prefix '$'
* h: 8 bit high name of register
* k: 32 bit name of register
* p: like 'c' and other operands unmodified (gcc doc: "print raw symbol")
@@ -789,7 +790,8 @@ static void emit_ia32_asm_operand(ir_node const *const node, char const modifier
return;
case BE_ASM_OPERAND_LABEL:
- be_emit_char('$');
+ if (modifier != 'l')
+ be_emit_char('$');
be_emit_cfop_target_pos(node, op->op.pos);
return;
}
diff --git a/ir/be/mips/mips_emitter.c b/ir/be/mips/mips_emitter.c
index 792127d..c3e62ef 100644
--- a/ir/be/mips/mips_emitter.c
+++ b/ir/be/mips/mips_emitter.c
@@ -103,6 +103,7 @@ static void emit_mips_asm_operand(ir_node const *const node, char const modifier
mips_asm_operand_t const *const op = &((mips_asm_operand_t const*)attr->operands)[pos];
/* modifiers:
* c: plain immediate
+ * l: label only
* z: print normally, except immediate 0 as '$zero' */
if (!be_is_valid_asm_operand_kind(node, modifier, pos, op->op.kind, "z", "c", ""))
return;
diff --git a/ir/be/riscv/riscv_emitter.c b/ir/be/riscv/riscv_emitter.c
index 2c36fae..9dc3a2a 100644
--- a/ir/be/riscv/riscv_emitter.c
+++ b/ir/be/riscv/riscv_emitter.c
@@ -108,6 +108,7 @@ static void emit_riscv_asm_operand(ir_node const *const node, char const modifie
* R: %lo of immediate
* c: plain immediate
* h: %hi of immediate
+ * l: label only
* z: print normally, except immediate 0 as 'zero' */
if (!be_is_valid_asm_operand_kind(node, modifier, pos, op->op.kind, "z", "Rch", ""))
return;
diff --git a/ir/be/sparc/sparc_emitter.c b/ir/be/sparc/sparc_emitter.c
index b06bd3e..a58a4c4 100644
--- a/ir/be/sparc/sparc_emitter.c
+++ b/ir/be/sparc/sparc_emitter.c
@@ -626,6 +626,7 @@ static void emit_sparc_asm_operand(ir_node const *const node, char const modifie
/* modifiers:
* c: plain immediate
* f: memory reference without surrounding '[]'
+ * l: label only
* m: see 'f'
* r: immediate, but show '%g0' instead of '0' */
if (!be_is_valid_asm_operand_kind(node, modifier, pos, op->op.kind, "r", "c", "fm"))