From 782d4e9df0363ca9f64d8b92a3d6952d552f13a5 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 14 Jun 2023 15:05:43 +0200 Subject: add spilling for function calls, misc fixes --- abi0.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'abi0.c') 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; -- cgit v1.2.3