aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64/isel.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-08 23:03:06 +0200
committerlemon <lsof@mailbox.org>2025-10-08 23:03:06 +0200
commit6436f4c576b65dd8220db7dcd0e7a21f33ac4933 (patch)
tree7c06011b48019761151192f63140921610d2f036 /amd64/isel.c
parentde0ff34465d9c6a34a359b0b05af1f5c34905c6c (diff)
initial implementation of run-time array/aggregate initializers
Diffstat (limited to 'amd64/isel.c')
-rw-r--r--amd64/isel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 450d8fd..fefd8ea 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -82,6 +82,10 @@ fixarg(union ref *r, struct instr *ins, struct block *blk, int *curi)
wr32le(data, pun.i);
}
*r = mkdatref(NULL, siz, /*align*/siz, data, siz, /*deref*/1);
+ if (&ins->l != r && ins->l.t == RADDR) {
+ /* can't use memory arg in rhs if lhs is memory */
+ *r = insertinstr(blk, (*curi)++, mkinstr(Ocopy, con->cls, *r));
+ }
} else if (in_range(op, Odiv, Ourem) && kisint(ins->cls))
goto DivImm;
} else if (r->t == RICON && in_range(op, Odiv, Ourem) && kisint(ins->cls)) {