summary refs log tree commit diff
path: root/lisc/rega.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-05 21:27:02 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-10-05 21:38:55 -0400
commita83174f44741088906718cc656675099e9193ad5 (patch)
treee006679c5d7cc42692abe48a61b8776fd54067c0 /lisc/rega.c
parent60aacea0c3dad234b59dcfeb5d50e3de69662515 (diff)
downloadroux-a83174f44741088906718cc656675099e9193ad5.tar.gz
factor vector duplication in vdup()
Diffstat (limited to 'lisc/rega.c')
-rw-r--r--lisc/rega.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/lisc/rega.c b/lisc/rega.c
index ce96798..2f335e6 100644
--- a/lisc/rega.c
+++ b/lisc/rega.c
@@ -343,7 +343,6 @@ rega(Fn *fn)
 {
 	int n, t, r, x;
 	Blk *b, *b1, *s, ***ps, *blist;
-	Ins *i;
 	RMap *end, *beg, cur;
 	Phi *p;
 	uint u;
@@ -424,9 +423,6 @@ rega(Fn *fn)
 					pmadd(src, dst, tmp[t].wide);
 				}
 			pmgen();
-			/* todo, moving this out of
-			 * here would make sense */
-			n = curi-insb;
 			if (!n)
 				continue;
 			b1 = balloc();
@@ -435,10 +431,8 @@ rega(Fn *fn)
 			blist = b1;
 			fn->nblk++;
 			sprintf(b1->name, "%s_%s", b->name, s->name);
-			i = alloc(n * sizeof(Ins));
-			memcpy(i, insb, n * sizeof(Ins));
-			b1->ins = i;
-			b1->nins = n;
+			b1->nins = curi - insb;
+			vdup(&b1->ins, insb, b1->nins * sizeof(Ins));
 			b1->jmp.type = JJmp;
 			b1->s1 = s;
 			**ps = b1;
@@ -459,7 +453,7 @@ rega(Fn *fn)
 	free(beg);
 
 	if (debug['R']) {
-		fprintf(stderr, "\n> After register allocation\n");
+		fprintf(stderr, "\n> After register allocation:\n");
 		printfn(fn, stderr);
 	}
 }