From 0f879b9b0245e0b23a11ac65943846d312b3786f Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 17 Aug 2015 21:16:03 -0400 Subject: [PATCH] tweak block-border heuristic for reg. allocation We only allocate a register that has a hint if the hint register is not used already. In the max example it gives a better result and it does not seem to affect the collatz test. --- lisc/rega.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisc/rega.c b/lisc/rega.c index f571011..6b29546 100644 --- a/lisc/rega.c +++ b/lisc/rega.c @@ -324,9 +324,10 @@ rega(Fn *fn) radd(&cur, t, r); for (x=0; x<2; x++) for (t=Tmp0; tntmp; t++) - if (x==1 || tmp[t].hint!=-1) if (BGET(b->out, t)) if (!BGET(cur.b, t)) + if (x == 1 + || ((r=tmp[t].hint) != -1 && !BGET(cur.b, r))) ralloc(&cur, t); /* process instructions */ end[n] = cur;