pan/midgard: Print branches in MIR
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 30 Aug 2019 18:02:52 +0000 (11:02 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 30 Aug 2019 22:50:26 +0000 (15:50 -0700)
Rather than a vague "br.??" line, annotate the branch with its target
type (useful for disambiguating discards) and whether it was inverted.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_print.c

index 2f65f2f80070276ac67b4dad5c5507a156902c26..66b17be5bf6786825766310067d7104b953bdb09 100644 (file)
@@ -99,6 +99,13 @@ mir_print_instruction(midgard_instruction *ins)
                 midgard_alu_op op = ins->alu.op;
                 const char *name = alu_opcode_props[op].name;
 
+                const char *branch_target_names[] = {
+                        "goto", "break", "continue", "discard"
+                };
+
+                if (ins->compact_branch && !ins->prepacked_branch)
+                        name = branch_target_names[ins->branch.target_type];
+
                 if (ins->unit)
                         printf("%s.", mir_get_unit(ins->unit));
 
@@ -124,7 +131,7 @@ mir_print_instruction(midgard_instruction *ins)
                 assert(0);
         }
 
-        if (ins->invert)
+        if (ins->invert || (ins->compact_branch && !ins->prepacked_branch && ins->branch.invert_conditional))
                 printf(".not");
 
         printf(" ");