commit bad74e6dce897df9f21cea5bf0a32df298856351
parent ee46ff8dad6782a739fefd176e55a70754787917
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Mon, 14 Sep 2015 18:06:53 -0400
emit stack fixup only when necessary
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git 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++)