summary refs log tree commit diff
path: root/mem.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-12-12 22:36:34 +0100
committerQuentin Carbonneaux <quentin@c9x.me>2022-12-12 22:36:34 +0100
commitc5ea06c1360a7bb93cf1a5303f804855a38a82ef (patch)
tree5529d66c7bb08c4e16c3ec09fba83dd1a0c4429b /mem.c
parentc0f25aeae3ef5d5f4b6bc5678f8d8ce40597d673 (diff)
downloadroux-c5ea06c1360a7bb93cf1a5303f804855a38a82ef.tar.gz
treat retc as non-escaping
We may well treat all rets as
non-escaping since stack slots
are destroyed upon funcion
return.
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mem.c b/mem.c
index fc3269c..a574e1f 100644
--- a/mem.c
+++ b/mem.c
@@ -302,6 +302,11 @@ coalesce(Fn *fn)
 		assert(t->ndef == 1 && t->def);
 		*t->def = (Ins){.op = Onop};
 		for (u=t->use; u<&t->use[t->nuse]; u++) {
+			if (u->type == UJmp) {
+				b = fn->rpo[u->bid];
+				b->jmp.arg = CON_Z;
+				continue;
+			}
 			assert(u->type == UIns);
 			i = u->u.ins;
 			/* make loads crash */
@@ -357,6 +362,11 @@ coalesce(Fn *fn)
 		assert(t->ndef == 1 && t->def);
 		*t->def = (Ins){.op = Onop};
 		for (u=t->use; u<&t->use[t->nuse]; u++) {
+			if (u->type == UJmp) {
+				b = fn->rpo[u->bid];
+				b->jmp.arg = TMP(s->s->t);
+				continue;
+			}
 			assert(u->type == UIns);
 			arg = u->u.ins->arg;
 			for (n=0; n<2; n++)