do not account for interferences in phi classes
Before this commit, I tried to make sure that two interfering temporaries never ended up in the same phi class. This was to make sure that their register hints were not counterproductively stepping on each other's toes. The idea is fine, but: * the implementation is clumsy because it mixes the orthogonal concepts of (i) interference and (ii) phi classes; * the hinting process in the register allocator is hard to understand because the disjoint-set data structure used for phi classes is cut in arbitrary places. After this commit, the phi classes *really* are phi classes represented with a proper disjoint-set data structure.
This commit is contained in:
parent
51c46ba691
commit
425a2ed09c
3 changed files with 19 additions and 66 deletions
17
ssa.c
17
ssa.c
|
@ -40,7 +40,7 @@ filluse(Fn *fn)
|
|||
Blk *b;
|
||||
Phi *p;
|
||||
Ins *i;
|
||||
int m, t, w;
|
||||
int m, t, tp, w;
|
||||
uint a;
|
||||
Tmp *tmp;
|
||||
|
||||
|
@ -49,8 +49,8 @@ filluse(Fn *fn)
|
|||
for (t=Tmp0; t<fn->ntmp; t++) {
|
||||
tmp[t].ndef = 0;
|
||||
tmp[t].nuse = 0;
|
||||
tmp[t].phi = 0;
|
||||
tmp[t].cls = 0;
|
||||
tmp[t].phi = 0;
|
||||
tmp[t].width = WFull;
|
||||
if (tmp[t].use == 0)
|
||||
tmp[t].use = vnew(0, sizeof(Use), Pfn);
|
||||
|
@ -58,16 +58,17 @@ filluse(Fn *fn)
|
|||
for (b=fn->start; b; b=b->link) {
|
||||
for (p=b->phi; p; p=p->link) {
|
||||
assert(rtype(p->to) == RTmp);
|
||||
t = p->to.val;
|
||||
tmp[t].ndef++;
|
||||
tmp[t].cls = p->cls;
|
||||
tmp[t].phi = p->to.val;
|
||||
tp = p->to.val;
|
||||
tmp[tp].ndef++;
|
||||
tmp[tp].cls = p->cls;
|
||||
tp = phicls(tp, fn->tmp);
|
||||
for (a=0; a<p->narg; a++)
|
||||
if (rtype(p->arg[a]) == RTmp) {
|
||||
t = p->arg[a].val;
|
||||
adduse(&tmp[t], UPhi, b, p);
|
||||
if (!tmp[t].phi)
|
||||
tmp[t].phi = p->to.val;
|
||||
t = phicls(t, fn->tmp);
|
||||
if (t != tp)
|
||||
tmp[t].phi = tp;
|
||||
}
|
||||
}
|
||||
for (i=b->ins; i-b->ins < b->nins; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue