summary refs log tree commit diff
path: root/lisc/ssa.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-11-13 15:21:53 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-11-13 15:21:53 -0500
commitcde5a4871bf970541698634d24a755a3d0999f4b (patch)
treed521972fa58d0d15107178f54ccb0c043f6d616e /lisc/ssa.c
parent3be8f0fef8e7979855f94b4c7096725d3faf9c84 (diff)
downloadroux-cde5a4871bf970541698634d24a755a3d0999f4b.tar.gz
fix a few bugs in filluse()
Diffstat (limited to 'lisc/ssa.c')
-rw-r--r--lisc/ssa.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisc/ssa.c b/lisc/ssa.c
index 2d4a373..7a7f55e 100644
--- a/lisc/ssa.c
+++ b/lisc/ssa.c
@@ -10,17 +10,18 @@ adduse(Tmp *tmp, int ty, Blk *b, ...)
 
 	va_start(ap, b);
 	n = tmp->nuse;
-	vgrow(tmp->use, ++tmp->nuse);
+	vgrow(&tmp->use, ++tmp->nuse);
 	u = &tmp->use[n];
+	u->type = ty;
 	u->bid = b->id;
 	switch (ty) {
 	default:
 		diag("ssa: adduse defaulted");
 	case UPhi:
-		u->u.phi = va_arg(ap, Ref);
+		u->u.phi = va_arg(ap, Phi *);
 		break;
 	case UIns:
-		u->u.ins = va_arg(ap, Ins *) - b->ins;
+		u->u.ins = va_arg(ap, Ins *);
 		break;
 	case UJmp:
 		break;
@@ -57,7 +58,7 @@ filluse(Fn *fn)
 			for (a=0; a<p->narg; a++)
 				if (rtype(p->arg[a]) == RTmp) {
 					t = p->arg[a].val;
-					adduse(&tmp[t], UPhi, b, p->to);
+					adduse(&tmp[t], UPhi, b, p);
 					if (!tmp[t].phi)
 						tmp[t].phi = p->to.val;
 				}