summaryrefslogtreecommitdiffhomepage
path: root/ir/be
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-04 09:13:02 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-04-05 20:44:54 +0200
commitfd82a980b216595e52e27c9ea0e249db0dccda74 (patch)
treedd26fe8287bdfcc7f28097f89d7732e3910cc5fa /ir/be
parent60d0bc93afef8023bf7a940a85c94724490becd1 (diff)
beasm: Tell the backends how to handle the fallthrough exec output of be_Asm.
Diffstat (limited to 'ir/be')
-rw-r--r--ir/be/amd64/amd64_emitter.c4
-rw-r--r--ir/be/arm/arm_emitter.c4
-rw-r--r--ir/be/beasm.c5
-rw-r--r--ir/be/beasm.h2
-rw-r--r--ir/be/ia32/ia32_emitter.c4
-rw-r--r--ir/be/mips/mips_emitter.c4
-rw-r--r--ir/be/riscv/riscv_emitter.c4
-rw-r--r--ir/be/sparc/sparc_emitter.c4
8 files changed, 23 insertions, 8 deletions
diff --git a/ir/be/amd64/amd64_emitter.c b/ir/be/amd64/amd64_emitter.c
index bf06f93..da13af9 100644
--- a/ir/be/amd64/amd64_emitter.c
+++ b/ir/be/amd64/amd64_emitter.c
@@ -589,7 +589,9 @@ static void emit_jmp(ir_node const *const node, ir_node const *const target)
static void emit_amd64_asm(const ir_node *node)
{
- be_emit_asm(node, emit_amd64_asm_operand);
+ ir_node const *const fallthrough = be_emit_asm(node, emit_amd64_asm_operand);
+ if (fallthrough)
+ emit_jmp(node, fallthrough);
}
/**
diff --git a/ir/be/arm/arm_emitter.c b/ir/be/arm/arm_emitter.c
index 2650d5b..be8b7c7 100644
--- a/ir/be/arm/arm_emitter.c
+++ b/ir/be/arm/arm_emitter.c
@@ -474,7 +474,9 @@ static void emit_arm_asm_operand(ir_node const *const node, char const modifier,
static void emit_be_ASM(const ir_node *node)
{
- be_emit_asm(node, &emit_arm_asm_operand);
+ ir_node const *const fallthrough = be_emit_asm(node, &emit_arm_asm_operand);
+ if (fallthrough)
+ emit_jmp(node, fallthrough);
}
/** Emit an IncSP node */
diff --git a/ir/be/beasm.c b/ir/be/beasm.c
index 1ea9ffe..2073116 100644
--- a/ir/be/beasm.c
+++ b/ir/be/beasm.c
@@ -355,7 +355,7 @@ ir_node *be_make_asm(ir_node const *const node, be_asm_info_t const *const info,
return new_node;
}
-void be_emit_asm(ir_node const *const asmn, be_emit_asm_operand_func *const emit_asm_operand)
+ir_node *be_emit_asm(ir_node const *const asmn, be_emit_asm_operand_func *const emit_asm_operand)
{
be_emit_cstring("#APP");
be_emit_finish_line_gas(asmn);
@@ -412,6 +412,9 @@ void be_emit_asm(ir_node const *const asmn, be_emit_asm_operand_func *const emit
be_emit_cstring("\n#NO_APP\n");
be_emit_write_line();
+
+ /* Return the fallthrough proj if present. */
+ return get_Proj_for_pn(asmn, pn_be_Asm_X_regular);
}
static char const *be_get_constraint_name(be_asm_operand_kind_t const kind)
diff --git a/ir/be/beasm.h b/ir/be/beasm.h
index 7a4e515..8d88f1c 100644
--- a/ir/be/beasm.h
+++ b/ir/be/beasm.h
@@ -125,7 +125,7 @@ ir_node *be_make_asm(ir_node const *node, be_asm_info_t const *info, void *opera
typedef void be_emit_asm_operand_func(ir_node const *asmn, char modifier, unsigned pos);
-void be_emit_asm(ir_node const *asmn, be_emit_asm_operand_func *emit_asm_operand);
+ir_node *be_emit_asm(ir_node const *asmn, be_emit_asm_operand_func *emit_asm_operand);
bool be_is_valid_asm_operand_kind(ir_node const *node, char modifier, unsigned pos, be_asm_operand_kind_t have, char const *mod_any, char const *mod_imm, char const *mod_mem);
diff --git a/ir/be/ia32/ia32_emitter.c b/ir/be/ia32/ia32_emitter.c
index 304519a..ac6af26 100644
--- a/ir/be/ia32/ia32_emitter.c
+++ b/ir/be/ia32/ia32_emitter.c
@@ -803,7 +803,9 @@ static void emit_ia32_asm_operand(ir_node const *const node, char const modifier
*/
static void emit_ia32_Asm(const ir_node *node)
{
- be_emit_asm(node, emit_ia32_asm_operand);
+ ir_node *const fallthrough = be_emit_asm(node, emit_ia32_asm_operand);
+ if (fallthrough)
+ emit_jmp(node, fallthrough);
}
/**
diff --git a/ir/be/mips/mips_emitter.c b/ir/be/mips/mips_emitter.c
index c3e62ef..14811f9 100644
--- a/ir/be/mips/mips_emitter.c
+++ b/ir/be/mips/mips_emitter.c
@@ -149,7 +149,9 @@ static void emit_jmp(ir_node const *const node, ir_node const *const target)
static void emit_be_ASM(const ir_node *node)
{
- be_emit_asm(node, &emit_mips_asm_operand);
+ ir_node const *const fallthrough = be_emit_asm(node, &emit_mips_asm_operand);
+ if (fallthrough)
+ emit_jmp(node, fallthrough);
}
static void emit_be_Copy(ir_node const *const node)
diff --git a/ir/be/riscv/riscv_emitter.c b/ir/be/riscv/riscv_emitter.c
index 9dc3a2a..fc89483 100644
--- a/ir/be/riscv/riscv_emitter.c
+++ b/ir/be/riscv/riscv_emitter.c
@@ -165,7 +165,9 @@ static void emit_riscv_asm_operand(ir_node const *const node, char const modifie
static void emit_be_ASM(const ir_node *node)
{
- be_emit_asm(node, &emit_riscv_asm_operand);
+ ir_node const *const fallthrough = be_emit_asm(node, &emit_riscv_asm_operand);
+ if (fallthrough)
+ emit_jmp(node, fallthrough);
}
static void emit_be_Copy(ir_node const *const node)
diff --git a/ir/be/sparc/sparc_emitter.c b/ir/be/sparc/sparc_emitter.c
index a58a4c4..6b2987b 100644
--- a/ir/be/sparc/sparc_emitter.c
+++ b/ir/be/sparc/sparc_emitter.c
@@ -682,7 +682,9 @@ static void emit_jmp(ir_node const *const node, ir_node const *const target)
static void emit_sparc_ASM(const ir_node *node)
{
- be_emit_asm(node, emit_sparc_asm_operand);
+ ir_node const *const fallthrough = be_emit_asm(node, emit_sparc_asm_operand);
+ if (fallthrough)
+ emit_jmp(node, fallthrough);
}
/**