summary refs log tree commit diff
path: root/arm64/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-03-14 23:10:39 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-03-14 23:14:48 +0100
commitc5769f62b4912e429a332c9aa0bead3a383fe966 (patch)
tree4a10efe9455184ce71bd7e4a8a7429c327ba66e8 /arm64/isel.c
parent329a18a30b9f8db598db39b7326fc4149bcc1431 (diff)
downloadroux-c5769f62b4912e429a332c9aa0bead3a383fe966.tar.gz
dynamic stack allocs for arm64
I also moved some isel logic
that would have been repeated
a third time in util.c.
Diffstat (limited to 'arm64/isel.c')
-rw-r--r--arm64/isel.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arm64/isel.c b/arm64/isel.c
index 031ba11..bb5c12b 100644
--- a/arm64/isel.c
+++ b/arm64/isel.c
@@ -163,6 +163,12 @@ sel(Ins i, Fn *fn)
 	Ins *i0;
 	int ck, cc;
 
+	if (INRANGE(i.op, Oalloc, Oalloc1)) {
+		i0 = curi - 1;
+		salloc(i.to, i.arg[0], fn);
+		fixarg(&i0->arg[0], Kl, 0, fn);
+		return;
+	}
 	if (iscmp(i.op, &ck, &cc)) {
 		emit(Oflag, i.cls, i.to, R, R);
 		i0 = curi;
@@ -170,7 +176,9 @@ sel(Ins i, Fn *fn)
 			i0->op += cmpop(cc);
 		else
 			i0->op += cc;
-	} else if (i.op != Onop) {
+		return;
+	}
+	if (i.op != Onop) {
 		emiti(i);
 		iarg = curi->arg; /* fixarg() can change curi */
 		fixarg(&iarg[0], argcls(&i, 0), 0, fn);