diff options
-rw-r--r-- | cfg.c | 12 | ||||
-rw-r--r-- | rega.c | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/cfg.c b/cfg.c index b1c80c7..81da842 100644 --- a/cfg.c +++ b/cfg.c @@ -297,12 +297,19 @@ simpljmp(Fn *fn) { Blk **uf; /* union-find */ - Blk *b; + Blk **p, *b, *ret; int c; + ret = blknew(); + ret->id = fn->nblk++; + ret->jmp.type = Jret0; uf = emalloc(fn->nblk * sizeof uf[0]); for (b=fn->start; b; b=b->link) { assert(!b->phi); + if (b->jmp.type == Jret0) { + b->jmp.type = Jjmp; + b->s1 = ret; + } if (b->nins == 0) if (b->jmp.type == Jjmp) { uffind(&b->s1, uf); @@ -310,7 +317,7 @@ simpljmp(Fn *fn) uf[b->id] = b->s1; } } - for (b=fn->start; b; b=b->link) { + for (p=&fn->start; (b=*p); p=&b->link) { if (b->s1) uffind(&b->s1, uf); if (b->s2) @@ -322,5 +329,6 @@ simpljmp(Fn *fn) b->s2 = 0; } } + *p = ret; free(uf); } diff --git a/rega.c b/rega.c index 8f2fbd0..ba405e5 100644 --- a/rega.c +++ b/rega.c @@ -417,10 +417,11 @@ doblk(Blk *b, RMap *cur) } for (r=0; r<nr; r++) *ra[r] = ralloc(cur, ra[r]->val); + if (i->op == Ocopy && req(i->to, i->arg[0])) + curi++; /* try to change the register of a hinted * temporary if rf is available */ - x = 1; if (rf != -1 && (t = cur->w[rf]) != 0) if (!bshas(cur->b, rf) && *hint(t) == rf && (rt = rfree(cur, t)) != -1) { |