commit 5dbc5dc2c9816821db6e7f1a2903c54a7d549efd
parent 542825d1f48cd1037c76e12fd5a14b6a91422cf6
Author: Michael Forney <mforney@mforney.org>
Date: Thu, 25 Mar 2021 13:51:25 -0700
arm64: handle copy of constant to slot
If registers spill onto the stack, we may end up with SSA like
S320 =l copy 0
after rega(). Handle this case in arm64 emit().
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arm64/emit.c b/arm64/emit.c
@@ -308,9 +308,15 @@ emitins(Ins *i, E *e)
if (req(i->to, i->arg[0]))
break;
if (rtype(i->to) == RSlot) {
- if (rtype(i->arg[0]) == RSlot) {
+ switch (rtype(i->arg[0])) {
+ case RSlot:
emitf("ldr %?, %M0\n\tstr %?, %M=", i, e);
- } else {
+ break;
+ case RCon:
+ loadcon(&e->fn->con[i->arg[0].val], R18, i->cls, e->f);
+ emitf("str %?, %M=", i, e);
+ break;
+ default:
assert(isreg(i->arg[0]));
emitf("str %0, %M=", i, e);
}