From 56203de6df7e8ed7f05dc3db061ef30d955cb795 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 26 Oct 2015 18:49:14 -0400 Subject: wip on regalloc new heuristics I thought that many parallel copies generated can be avoided if temporaries are in their hint register at the beginning of blocks with multiple predecessors. To get more benefit, I suspect that we could use a copy-propagating peephole pass. --- lisc/rega.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'lisc') diff --git a/lisc/rega.c b/lisc/rega.c index 5173ecc..d368977 100644 --- a/lisc/rega.c +++ b/lisc/rega.c @@ -360,9 +360,9 @@ doblk(Blk *b, RMap *cur) void rega(Fn *fn) { - int n, t, r, x; + int j, n, t, r, r1, x; Blk *b, *b1, *s, ***ps, *blist; - RMap *end, *beg, cur; + RMap *end, *beg, cur, old; Ins *i; Phi *p; uint u; @@ -401,14 +401,36 @@ rega(Fn *fn) } end[n] = cur; doblk(b, &cur); - beg[n] = cur; b->in = cur.b; for (p=b->phi; p; p=p->link) - if (rtype(p->to) == RTmp) { - t = p->to.val; - BCLR(b->in, t); - /* rfree(&cur, t); */ + if (rtype(p->to) == RTmp) + BCLR(b->in, p->to.val); + if (b->npred > 1) { + /* attempt to satisfy hints + * when it's simple and we have + * multiple predecessors + */ + old = cur; + curi = insb; + for (j=0; jnins += j; + i = alloc(b->nins * sizeof(Ins)); + icpy(icpy(i, insb, j), b->ins, b->nins-j); + b->ins = i; } + } + beg[n] = cur; } if (debug['R']) { fprintf(stderr, "\n> Register mappings:\n"); -- cgit 1.4.1