From a70119010fa7b4cba9facb7f90930de4dc3dc80a Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 29 Jan 2016 10:06:33 -0500 Subject: more fp integration in rega --- lisc/rega.c | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'lisc/rega.c') diff --git a/lisc/rega.c b/lisc/rega.c index 62d7043..6c9ab95 100644 --- a/lisc/rega.c +++ b/lisc/rega.c @@ -18,7 +18,7 @@ static Tmp *tmp; /* function temporaries */ static Mem *mem; /* function mem references */ static struct { Ref src, dst; - int wide; + int cls; } *pm; /* parallel move constructed */ static int cpm, npm; /* capacity and size of pm */ @@ -154,7 +154,7 @@ mdump(RMap *m) } static void -pmadd(Ref src, Ref dst, int w) +pmadd(Ref src, Ref dst, int k) { if (npm == cpm) { cpm = cpm * 2 + 16; @@ -164,33 +164,47 @@ pmadd(Ref src, Ref dst, int w) } pm[npm].src = src; pm[npm].dst = dst; - pm[npm].wide = w; + pm[npm].cls = k; npm++; } enum PMStat { ToMove, Moving, Moved }; static Ref -pmrec(enum PMStat *status, int i, int *w) +pmrec(enum PMStat *status, int i, int *k) { Ref swp, swp1; - int j, w1; + int j, k1; + + /* note, this routine might emit + * too many large instructions: + * + * , x -- x + * x -- x -- x | + * ` x -- x + * + * if only the first move is wide + * the whole cycle will be wide, + * this is safe but not necessary + */ if (req(pm[i].src, pm[i].dst)) return R; status[i] = Moving; - *w |= pm[i].wide; + assert(KBASE(*k) == KBASE(pm[i].cls)); + assert((Kw|1) == Kl && (Ks|1) == Kd); + *k |= KWIDE(pm[i].cls); /* see above */ swp = R; for (j=0; jr[n]; r = rfind(&m0, t); if (r != -1) - pmadd(TMP(r1), TMP(r), tmp[t].wide); + pmadd(TMP(r1), TMP(r), tmp[t].cls); else if (s != -1) - pmadd(TMP(r1), SLOT(s), tmp[t].wide); + pmadd(TMP(r1), SLOT(s), tmp[t].cls); } for (ip=i; ipto, R)) @@ -478,7 +492,7 @@ rega(Fn *fn) if (!BGET(cur.b, r)) { rfree(&cur, t); radd(&cur, t, r); - x = tmp[t].wide; + x = tmp[t].cls; emit(OCopy, x, TMP(r1), TMP(r), R); } } @@ -523,13 +537,13 @@ rega(Fn *fn) src = p->arg[u]; if (rtype(src) == RTmp) src = rref(&end[b->id], src.val); - pmadd(src, dst, p->wide); + pmadd(src, dst, p->cls); } for (t=Tmp0; tntmp; t++) if (BGET(s->in, t)) { src = rref(&end[b->id], t); dst = rref(&beg[s->id], t); - pmadd(src, dst, tmp[t].wide); + pmadd(src, dst, tmp[t].cls); } pmgen(); if (curi == insb) @@ -552,8 +566,7 @@ rega(Fn *fn) } } for (b=fn->start; b; b=b->link) - while (b->phi) - b->phi = b->phi->link; + b->phi = 0; fn->reg = regu; if (debug['R']) { -- cgit 1.4.1