summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beasm.h
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-07-27 07:39:25 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-07-27 07:39:35 +0200
commitd431dc0817f857e26e24c007ccb315aaa0dfc830 (patch)
tree5d01f8bdb1d6e708abbe72bf390ac7e8bacbcc77 /ir/be/beasm.h
parentdd8a4070872960f0877a4c7afabb323381cca7c4 (diff)
beasm: Ensure that a matching or in-out constraint can be fulfilled by marking the input as killed.
This fixes backend/asm_live_through_matching.c.
Diffstat (limited to 'ir/be/beasm.h')
-rw-r--r--ir/be/beasm.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/ir/be/beasm.h b/ir/be/beasm.h
index 1714538..b0c7bce 100644
--- a/ir/be/beasm.h
+++ b/ir/be/beasm.h
@@ -82,12 +82,21 @@ static inline arch_register_req_t const *be_asm_make_same_req(struct obstack *co
return oreq;
}
-static inline void be_asm_add_inout(be_asm_info_t *const info, be_asm_operand_t *const op, struct obstack *const obst, ir_node *const in, arch_register_req_t const *const ireq, int const opos)
+static inline void be_asm_add_inout(be_asm_info_t *const info, be_asm_operand_t *const op, struct obstack *const obst, ir_node *const in, arch_register_req_t const *const orig_ireq, int const opos)
{
+ arch_register_req_t const *ireq = orig_ireq;
+ if (opos >= 0) {
+ /* Ensure that the matching output can use the same register by marking the
+ * input as 'kills_value'. */
+ arch_register_req_t *const new_ireq = OALLOC(obst, arch_register_req_t);
+ *new_ireq = *ireq;
+ new_ireq->kills_value = true;
+ ireq = new_ireq;
+ }
ir_node *const new_in = be_transform_node(in);
be_asm_add_in(info, op, BE_ASM_OPERAND_INPUT_VALUE, new_in, ireq);
if (opos >= 0) {
- arch_register_req_t const *const oreq = be_asm_make_same_req(obst, ireq, ARR_LEN(info->in_reqs) - 1);
+ arch_register_req_t const *const oreq = be_asm_make_same_req(obst, orig_ireq, ARR_LEN(info->in_reqs) - 1);
info->out_reqs[opos] = oreq;
}
}