summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-14 00:48:24 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:33 -0400
commit73b7d9b199f0e73821acdde4770995c8db413106 (patch)
tree4ec96d0839568769635633b3a368a85c7b53b52e /lisc
parenta6aa774cbb19b45ef21af37257bb8f2da180da67 (diff)
downloadroux-73b7d9b199f0e73821acdde4770995c8db413106.tar.gz
reshuffle instructions around call
Diffstat (limited to 'lisc')
-rw-r--r--lisc/isel.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 9295d49..6d15488 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -500,13 +500,15 @@ selcall(Fn *fn, Ins *i0, Ins *i1)
 	if (rtype(i1->arg[1]) == RTyp)
 		diag("struct-returning function not implemented");
 
-	emit(OCopy, i1->wide, i1->to, TMP(RAX), R);
-	for (n=0; n<8; n++) {
+	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, TMP(RAX), i->arg[0], R);
+	emit(OCall, 0, R, i->arg[0], R);
+	emit(OCopy, 1, TMP(RAX), R, R);
+	for (n=6-nint; n<8; n++)
+		emit(OCopy, 1, TMP(ireg[n]), R, R);
 
 	for (i=i0, a=ai, ni=0; i<i1; i++, a++) {
 		if (a->inmem)
@@ -530,8 +532,6 @@ selcall(Fn *fn, Ins *i0, Ins *i1)
 			emit(OCopy, i->wide, r, i->arg[0], R);
 		}
 	}
-	for (; ni < 8; ni++)
-		emit(OCopy, 1, TMP(ireg[ni]), R, R);
 
 	for (i=i0, a=ai; i<i1; i++, a++) {
 		if (!a->inmem)