summaryrefslogtreecommitdiffhomepage
path: root/ir/be
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2019-03-04 20:31:56 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2019-04-05 20:44:54 +0200
commit0d9e5f5dc1737e721fa2cdbd41f497dff94ebf26 (patch)
treeee297650638e363e551a1d1ee759cd387daafc13 /ir/be
parent05d881f5ca246ee3e5bacf65ffc4b884a7819a4f (diff)
beasm: Give label constraints the "register" class 'exec'.
Diffstat (limited to 'ir/be')
-rw-r--r--ir/be/bearch.c2
-rw-r--r--ir/be/bearch.h2
-rw-r--r--ir/be/beasm.c7
-rw-r--r--ir/be/beasm.h5
4 files changed, 14 insertions, 2 deletions
diff --git a/ir/be/bearch.c b/ir/be/bearch.c
index 05edd5e..1fa3c1e 100644
--- a/ir/be/bearch.c
+++ b/ir/be/bearch.c
@@ -22,7 +22,7 @@
#include "target_t.h"
#include "util.h"
-static arch_register_class_t arch_exec_cls = {
+arch_register_class_t arch_exec_cls = {
.name = "exec",
.mode = NULL, /* Filled in at initialization. */
.regs = NULL,
diff --git a/ir/be/bearch.h b/ir/be/bearch.h
index e442035..2608914 100644
--- a/ir/be/bearch.h
+++ b/ir/be/bearch.h
@@ -21,6 +21,8 @@
#include "beinfo.h"
#include "be.h"
+extern arch_register_class_t arch_exec_cls;
+
extern arch_register_req_t const arch_exec_requirement;
#define arch_exec_req (&arch_exec_requirement)
diff --git a/ir/be/beasm.c b/ir/be/beasm.c
index 6bc43fd..2c26843 100644
--- a/ir/be/beasm.c
+++ b/ir/be/beasm.c
@@ -48,6 +48,13 @@ void be_parse_asm_constraints_internal(be_asm_constraint_t *const constraint, id
char const *i = get_id_str(constraint_text);
+ if (!i) {
+ /* Labels have no constraint text. */
+ constraint->all_registers_allowed = true;
+ constraint->cls = &arch_exec_cls;
+ return;
+ }
+
bool is_output = false;
if (i[0] == '+' || i[0] == '=') {
++i;
diff --git a/ir/be/beasm.h b/ir/be/beasm.h
index 8d88f1c..84facb7 100644
--- a/ir/be/beasm.h
+++ b/ir/be/beasm.h
@@ -116,7 +116,10 @@ static inline void be_asm_add_inout(be_asm_info_t *const info, be_asm_operand_t
static inline void be_asm_add_out(be_asm_info_t *const info, be_asm_operand_t *const op, struct obstack *const obst, be_asm_constraint_t const *const be_constraint, int const opos)
{
- be_set_asm_operand(op, BE_ASM_OPERAND_OUTPUT_VALUE, opos);
+ be_asm_operand_kind_t const kind =
+ be_constraint->cls == &arch_exec_cls ? BE_ASM_OPERAND_LABEL :
+ /* */ BE_ASM_OPERAND_OUTPUT_VALUE;
+ be_set_asm_operand(op, kind, opos);
arch_register_req_t const *const oreq = be_make_register_req(obst, be_constraint);
info->out_reqs[opos] = oreq;
}