summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-16 12:41:06 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:31 -0400
commit27f4eae43eebb4990bad59c8becdca41d2fb865d (patch)
tree4873311a650c7ff32b050394f4f7f074476dee88 /lisc
parente1725c0cdd15d7fea5beefec24759cc15825ead1 (diff)
downloadroux-27f4eae43eebb4990bad59c8becdca41d2fb865d.tar.gz
remove round-robin in ralloc (need preferences)
Diffstat (limited to 'lisc')
-rw-r--r--lisc/rega.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lisc/rega.c b/lisc/rega.c
index d6445c3..dc01ce0 100644
--- a/lisc/rega.c
+++ b/lisc/rega.c
@@ -73,8 +73,7 @@ radd(RMap *m, int t, int r)
 static Ref
 ralloc(RMap *m, int t)
 {
-	static int x;
-	int n, r;
+	int r;
 
 	if (t < Tmp0) {
 		assert(BGET(m->b, RBASE(t)));
@@ -86,13 +85,9 @@ ralloc(RMap *m, int t)
 	} else {
 		r = tmp[t].hint;
 		if (r == -1 || BGET(m->b, r))
-			for (n=0;; x=(x+1)%NReg, n++) {
-				if (n > NReg)
+			for (r=RAX; BGET(m->b, r); r++)
+				if (r+1 == RAX+NReg)
 					diag("rega: no more regs");
-				r = RAX + x;
-				if (!BGET(m->b, r))
-					break;
-			}
 		radd(m, t, r);
 		if (tmp[t].hint == -1)
 			tmp[t].hint = r;