aboutsummaryrefslogtreecommitdiffhomepage
path: root/abi0.c
diff options
context:
space:
mode:
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;