diff options
| author | 2023-06-24 18:47:05 +0200 | |
|---|---|---|
| committer | 2023-06-24 18:47:05 +0200 | |
| commit | 19bbdfa3c7ae05f4694ce5e434d9855c6f2c3682 (patch) | |
| tree | 700ca75e92f443fcb3fed30b1078b8aedde979f9 /irdump.c | |
| parent | d313c6e49bfb32ae24745e90eebe833da20efa1a (diff) | |
backend: fix regalloc to work with more complex dataflow
basically an allocation map at the beginning (in) and end (out) of each
block is kept and after the first allocation pass another pass is ran to
resolve allocation conflicts between each edge, plus another pass to
finish lowering phi functions.
also introduced `regset` and plenty of other miscellaneous fixes
Diffstat (limited to 'irdump.c')
| -rw-r--r-- | irdump.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -80,10 +80,9 @@ dumpref(enum op o, union ref ref) efmt("??"); break; case RTMP: + efmt("%%%d", ref.i); if (instrtab[ref.i].reg) - efmt("%s", mctarg->rnames[instrtab[ref.i].reg - 1]); - else - efmt("%%%d", ref.i); + efmt("(%s)", mctarg->rnames[instrtab[ref.i].reg-1]); break; case RREG: efmt("%s", mctarg->rnames[ref.i]); @@ -168,7 +167,7 @@ dumpinst(const struct instr *ins) if (ins->reg) { if (cls) efmt("%s ", clsname[cls]); - efmt("%s = ", mctarg->rnames[ins->reg - 1]); + efmt("(%%%d)%s = ", ins - instrtab, mctarg->rnames[ins->reg - 1]); } else if (cls) { efmt("%s %%%d", clsname[cls], ins - instrtab); efmt(" = "); @@ -198,7 +197,9 @@ dumpblk(struct function *fn, struct block *blk) struct instr *phi = &instrtab[blk->phi.p[i]]; union ref *refs = phitab.p[phi->l.i]; assert(phi->op == Ophi); - efmt(" %s %%%d = phi ", clsname[phi->cls], blk->phi.p[i]); + efmt(" %s ", clsname[phi->cls]); + if (!phi->reg) efmt("%%%d = phi ", blk->phi.p[i]); + else efmt("(%%%d)%s = phi ", phi - instrtab, mctarg->rnames[phi->reg-1]); for (int i = 0; i < blk->npred; ++i) { if (i) efmt(", "); efmt("@%d ", blkpred(blk, i)->id); |