From: Rob Clark Date: Thu, 18 Feb 2021 23:28:17 +0000 (-0800) Subject: freedreno/ir3/print: More sane ssa src/dst display X-Git-Tag: upstream/21.2.3~7535 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03762a956eac4686b861cb96df97b3bb17701b9b;p=platform%2Fupstream%2Fmesa.git freedreno/ir3/print: More sane ssa src/dst display Give src/dst a "ssa_%u" name generated from the instruction's unique serialno. Signed-off-by: Rob Clark Part-of: --- diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index cb7a507..c75033b 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -217,9 +217,9 @@ static void insert_instr(struct ir3_block *block, struct ir3_instruction *instr) { struct ir3 *shader = block->shader; -#ifdef DEBUG + instr->serialno = ++shader->instr_count; -#endif + list_addtail(&instr->node, &block->instr_list); if (is_input(instr)) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 0b9c389..50eee637 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -414,9 +414,7 @@ struct ir3_instruction { /* Entry in ir3_block's instruction list: */ struct list_head node; -#ifdef DEBUG uint32_t serialno; -#endif // TODO only computerator/assembler: int line; @@ -499,8 +497,9 @@ struct ir3 { struct list_head array_list; #ifdef DEBUG - unsigned block_count, instr_count; + unsigned block_count; #endif + unsigned instr_count; }; struct ir3_array { diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index dc1e6a9..fe601cf 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -160,7 +160,7 @@ static void print_instr_name(struct ir3_instruction *instr, bool flags) } } -static void print_reg_name(struct ir3_register *reg) +static void print_reg_name(struct ir3_instruction *instr, struct ir3_register *reg) { if ((reg->flags & (IR3_REG_FABS | IR3_REG_SABS)) && (reg->flags & (IR3_REG_FNEG | IR3_REG_SNEG | IR3_REG_BNOT))) @@ -185,18 +185,18 @@ static void print_reg_name(struct ir3_register *reg) reg->array.offset, reg->size); /* for ARRAY we could have null src, for example first write * instruction.. + * + * Note for array writes from another block, we aren't really + * sure who wrote it so skip trying to show this */ - if (reg->instr) { + if (reg->instr && (reg->instr->block == instr->block)) { printf(SYN_ARRAY(", ")); - printf(SYN_SSA("_[")); - print_instr_name(reg->instr, false); - printf(SYN_SSA("]")); + printf(SYN_SSA("ssa_%u"), reg->instr->serialno); } printf(SYN_ARRAY("]")); } else if (reg->flags & IR3_REG_SSA) { - printf(SYN_SSA("_[")); - print_instr_name(reg->instr, false); - printf(SYN_SSA("]")); + /* For dst regs, reg->instr will be NULL: */ + printf(SYN_SSA("ssa_%u"), reg->instr ? reg->instr->serialno : instr->serialno); } else if (reg->flags & IR3_REG_RELATIV) { if (reg->flags & IR3_REG_CONST) printf(SYN_CONST("c"), reg->array.offset); @@ -243,7 +243,7 @@ print_instr(struct ir3_instruction *instr, int lvl) struct ir3_register *reg = instr->regs[i]; printf(i ? ", " : ""); - print_reg_name(reg); + print_reg_name(instr, reg); } if (is_tex(instr) && !(instr->flags & IR3_INSTR_S2EN)) { @@ -324,12 +324,13 @@ print_instr(struct ir3_instruction *instr, int lvl) if (instr->deps_count) { printf(", false-deps:"); + unsigned n = 0; for (unsigned i = 0; i < instr->deps_count; i++) { - if (i > 0) + if (!instr->deps[i]) + continue; + if (n++ > 0) printf(", "); - printf("_["); - print_instr_name(instr->deps[i], false); - printf("]"); + printf(SYN_SSA("ssa_%u"), instr->deps[i]->serialno); } } @@ -375,9 +376,8 @@ print_block(struct ir3_block *block, int lvl) if (block->successors[1]) { /* leading into if/else: */ tab(lvl+1); - printf("/* succs: if _["); - print_instr_name(block->condition, false); - printf("] block%u; else block%u; */\n", + printf("/* succs: if "SYN_SSA("ssa_%u")" block%u; else block%u */\n", + block->condition->serialno, block_id(block->successors[0]), block_id(block->successors[1])); } else if (block->successors[0]) {