summary refs log tree commit diff
path: root/lisc/isel.c
diff options
context:
space:
mode:
Diffstat (limited to 'lisc/isel.c')
-rw-r--r--lisc/isel.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 6d15488..6928a1a 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -500,11 +500,13 @@ selcall(Fn *fn, Ins *i0, Ins *i1)
 	if (rtype(i1->arg[1]) == RTyp)
 		diag("struct-returning function not implemented");
 
+	if (stk) {
+		r = newcon(-(int64_t)stk, fn);
+		emit(OSAlloc, 0, R, r, R);
+	}
 	for (n=0; n<8; n++)
 		emit(OCopy, 0, R, TMP(ireg[n]), R);
 	emit(OCopy, i1->wide, i1->to, TMP(RAX), R);
-	r = newcon(-(int64_t)stk, fn);
-	emit(OSAlloc, 0, R, r, R);
 	emit(OCall, 0, R, i->arg[0], R);
 	emit(OCopy, 1, TMP(RAX), R, R);
 	for (n=6-nint; n<8; n++)