aboutsummaryrefslogtreecommitdiffhomepage
path: root/abi0.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-14 15:05:43 +0200
committerlemon <lsof@mailbox.org>2023-06-14 15:05:43 +0200
commit782d4e9df0363ca9f64d8b92a3d6952d552f13a5 (patch)
tree8c71e107a8c0b54f53c2c94d053ad4cc1b7a441d /abi0.c
parent8d8cf6584bf4081b54cd91fcaa42578cbd794440 (diff)
add spilling for function calls, misc fixes
Diffstat (limited to 'abi0.c')
-rw-r--r--abi0.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/abi0.c b/abi0.c
index e523a7d..19a5dff 100644
--- a/abi0.c
+++ b/abi0.c
@@ -227,8 +227,13 @@ abi0_call(struct function *fn, struct instr *ins, struct block *blk, int *curi)
if (call->ret.isagg) {
replref(fn, blk, (*curi), mkref(RTMP, ins - instrtab), retmem);
if (!nret) { /* hidden pointer argument */
- if (call->abiret[0].reg >= 0)
+ if (call->abiret[0].reg >= 0) {
+ /* the result location pointer is also returned by the callee, like in x86 */
++nret;
+ insertinstr(blk, ++*curi, mkinstr(Ocopy, KPTR, mkref(RREG, call->abiret[0].reg)));
+ /* even if this is not used it the register copy
+ * must be emitted for the register allocator to know */
+ }
} else { /* aggregate returned in regs */
union ref r[2];
struct instr ins;