diff options
author | Michael Forney <mforney@mforney.org> | 2019-05-09 23:32:15 -0700 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2021-10-25 18:38:54 +0200 |
commit | 542825d1f48cd1037c76e12fd5a14b6a91422cf6 (patch) | |
tree | e3956818df19aa9f6808ba5bc86c3036accd19f6 | |
parent | 5f994fed4e17bd65fc3958b5a8aab577a8948b9f (diff) | |
download | roux-542825d1f48cd1037c76e12fd5a14b6a91422cf6.tar.gz |
arm64: Handle slots in Ocopy operands
-rw-r--r-- | arm64/emit.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/arm64/emit.c b/arm64/emit.c index 76588ed..f48dbee 100644 --- a/arm64/emit.c +++ b/arm64/emit.c @@ -218,8 +218,8 @@ emitf(char *s, Ins *i, E *e) break; case 'M': c = *s++; - assert(c == '0' || c == '1'); - r = i->arg[c - '0']; + assert(c == '0' || c == '1' || c == '='); + r = c == '=' ? i->to : i->arg[c - '0']; switch (rtype(r)) { default: die("todo (arm emit): unhandled ref"); @@ -307,9 +307,26 @@ emitins(Ins *i, E *e) case Ocopy: if (req(i->to, i->arg[0])) break; - if (rtype(i->arg[0]) != RCon) + if (rtype(i->to) == RSlot) { + if (rtype(i->arg[0]) == RSlot) { + emitf("ldr %?, %M0\n\tstr %?, %M=", i, e); + } else { + assert(isreg(i->arg[0])); + emitf("str %0, %M=", i, e); + } + break; + } + assert(isreg(i->to)); + switch (rtype(i->arg[0])) { + case RCon: + loadcon(&e->fn->con[i->arg[0].val], i->to.val, i->cls, e->f); + break; + case RSlot: + emitf("ldr %=, %M0", i, e); + break; + default: goto Table; - loadcon(&e->fn->con[i->arg[0].val], i->to.val, i->cls, e->f); + } break; case Oaddr: assert(rtype(i->arg[0]) == RSlot); |