summary refs log tree commit diff
path: root/lisc/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-24 09:40:18 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-24 09:40:18 -0500
commit72988e6aa899ab5f13620d0f7eb5b9e44fdf262e (patch)
treea8606d770e8a95bb7edcaf43ebe1aebac423a1dc /lisc/isel.c
parent400a8c70f9b4525615497481a405cb78fffe194f (diff)
downloadroux-72988e6aa899ab5f13620d0f7eb5b9e44fdf262e.tar.gz
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 (limited to 'lisc/isel.c')
-rw-r--r--lisc/isel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 8ae4be7..499a6e0 100644
--- 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);