qbe

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

commit 72988e6aa899ab5f13620d0f7eb5b9e44fdf262e
parent 400a8c70f9b4525615497481a405cb78fffe194f
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Wed, 24 Feb 2016 09:40:18 -0500

oops, phi nodes rewrite for fast locals was trashed

The phi fixing mechanism can use emit(), so we need to
set curi before performing the rewrite.  Otherwise, we are
writing at random places in the instruction buffer (not so
bad because it is bounds checked), but then we loose the
instructions written (bad)!

Diffstat:
Mlisc/isel.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisc/isel.c b/lisc/isel.c @@ -944,6 +944,7 @@ isel(Fn *fn) n = fn->ntmp; ainfo = emalloc(n * sizeof ainfo[0]); for (b=fn->start; b; b=b->link) { + curi = &insb[NIns]; for (sb=(Blk*[3]){b->s1, b->s2, 0}; *sb; sb++) for (p=(*sb)->phi; p; p=p->link) { for (a=0; p->blk[a] != b; a++) @@ -953,7 +954,6 @@ isel(Fn *fn) for (m=0; m<n; m++) ainfo[m] = (ANum){.n = 0, .i = 0}; anumber(ainfo, b, fn->con); - curi = &insb[NIns]; seljmp(b, fn); for (i=&b->ins[b->nins]; i!=b->ins;) sel(*--i, ainfo, fn);