pan/bi: Clean up destination printing

Now we can trust in I->nr_dests, avoiding a bunch of special cases and incorrect
printing for instructions without a destination. To compensate for those
instructions being hard to scan now, indent.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>
This commit is contained in:
Alyssa Rosenzweig 2022-07-21 14:45:49 -04:00 committed by Marge Bot
parent 4f8ee2c00e
commit aaa2fa4e7a

View file

@ -160,22 +160,18 @@ bi_${mod}_as_str(enum bi_${mod} ${mod})
void
bi_print_instr(const bi_instr *I, FILE *fp)
{
if (I->op == BI_OPCODE_SPLIT_I32) {
for (unsigned d = 0; d < I->nr_dests; ++d) {
if (d > 0) fprintf(fp, ", ");
fputs(" ", fp);
bi_print_index(fp, I->dest[d]);
}
} else {
bi_foreach_dest(I, d) {
if (bi_is_null(I->dest[d])) break;
if (d > 0) fprintf(fp, ", ");
bi_foreach_dest(I, d) {
if (d > 0) fprintf(fp, ", ");
bi_print_index(fp, I->dest[d]);
}
bi_print_index(fp, I->dest[d]);
}
fprintf(fp, " = %s", bi_opcode_props[I->op].name);
if (I->nr_dests > 0)
fputs(" = ", fp);
fprintf(fp, "%s", bi_opcode_props[I->op].name);
if (I->table)
fprintf(fp, ".table%u", I->table);