aboutsummaryrefslogtreecommitdiffhomepage
path: root/irdump.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-09-08 22:05:33 +0200
committerlemon <lsof@mailbox.org>2025-09-08 22:05:33 +0200
commite043811980db560fc2507bb53b644e54c80527dc (patch)
tree6ea563d81c9d3767f439e361fc2c884cf4f9b64d /irdump.c
parent36b5b19bf183cb01525201ccbddd6afa692f21bb (diff)
regalloc: start implementing linear scan
Diffstat (limited to 'irdump.c')
-rw-r--r--irdump.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/irdump.c b/irdump.c
index 60964c0..d94b9bb 100644
--- a/irdump.c
+++ b/irdump.c
@@ -142,18 +142,10 @@ dumpcall(struct call *call)
}
}
-static const uchar opnarg[] = {
- 0,
-#define _(o,n) n,
-#include "op.def"
-#undef _
-};
-
static void
dumpinst(const struct instr *ins)
{
int i;
- efmt(" ");
if (ins->op == Omove) {
efmt("move %s ", clsname[ins->cls]);
} else {
@@ -190,7 +182,9 @@ dumpblk(struct function *fn, struct block *blk)
for (i = 0; i < blk->phi.n; ++i) {
struct instr *phi = &instrtab[blk->phi.p[i]];
union ref *refs = phitab.p[phi->l.i];
- efmt(" %s ", clsname[phi->cls]);
+ if (i == 0) efmt("%-4d", blk->inumstart);
+ else efmt(" |> ");
+ efmt(" %s ", clsname[phi->cls]);
if (!phi->reg) efmt("%%%d = %s ", blk->phi.p[i], opnames[phi->op]);
else efmt("(%%%d)%s = %s ", phi - instrtab, mctarg->rnames[phi->reg-1], opnames[phi->op]);
for (int i = 0; i < blk->npred; ++i) {
@@ -201,9 +195,10 @@ dumpblk(struct function *fn, struct block *blk)
efmt("\n");
}
for (i = 0; i < blk->ins.n; ++i) {
+ efmt("%-4d ", blk->inumstart + 1 + i);
dumpinst(&instrtab[blk->ins.p[i]]);
}
- efmt(" %s ", jnames[blk->jmp.t]);
+ efmt("%-4d %s ", blk->inumstart + 1 + i, jnames[blk->jmp.t]);
if (blk->jmp.arg[0].bits && !fn->nabiret && isagg(fn->retty)) {
/* un-lowered struct return */
dumpref(0, mktyperef(mkirtype(fn->retty)));
@@ -248,6 +243,7 @@ irdump(struct function *fn)
}
efmt("\n");
}
+ numberinstrs(fn);
blk = fn->entry;
do {
dumpblk(fn, blk);