qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit c5ea06c1360a7bb93cf1a5303f804855a38a82ef
parent c0f25aeae3ef5d5f4b6bc5678f8d8ce40597d673
Author: Quentin Carbonneaux <quentin@c9x.me>
Date:   Mon, 12 Dec 2022 22:36:34 +0100

treat retc as non-escaping

We may well treat all rets as
non-escaping since stack slots
are destroyed upon funcion
return.

Diffstat:
Malias.c | 3++-
Mmem.c | 10++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/alias.c b/alias.c @@ -192,6 +192,7 @@ fillalias(Fn *fn) } } } - esc(b->jmp.arg, fn); + if (b->jmp.type != Jretc) + esc(b->jmp.arg, fn); } } diff --git 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++)