From 211a9fc2510556bf5efb58789509325e49dbdc26 Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 21 Nov 2025 09:38:39 +0100 Subject: ir/dump: print block predecessors --- ir/dump.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ir') diff --git a/ir/dump.c b/ir/dump.c index 48ef921..3d4338b 100644 --- a/ir/dump.c +++ b/ir/dump.c @@ -211,7 +211,15 @@ dumpblk(struct function *fn, struct block *blk) { static const char *jnames[] = { 0, "b", "ret", "trap" }; int i; - bfmt(out, " @%d:\n", blk->id); + bfmt(out, " @%d:", blk->id); + if (blk->npred) { + bfmt(out, " \t; preds:"); + for (i = 0; i < blk->npred; ++i) { + if (i) ioputc(out, ','); + bfmt(out, " @%d", blkpred(blk, i)->id); + } + } + ioputc(out, '\n'); for (i = 0; i < blk->phi.n; ++i) { struct instr *phi = &instrtab[blk->phi.p[i]]; union ref *refs = phitab.p[phi->l.i]; @@ -225,7 +233,7 @@ dumpblk(struct function *fn, struct block *blk) bfmt(out, "@%d ", blkpred(blk, i)->id); dumpref(0, refs[i]); } - bfmt(out, "\n"); + ioputc(out, '\n'); } for (i = 0; i < blk->ins.n; ++i) { bfmt(out, "%-4d ", blk->inumstart + 1 + i); -- cgit v1.2.3