Mesa (master): panfrost/midgard/disasm: Pretty-print branch tags

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 7 16:07:55 UTC 2019


Module: Mesa
Branch: master
Commit: fd6d6c1b15c16fab21cf167935e5aed39a5cf695
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd6d6c1b15c16fab21cf167935e5aed39a5cf695

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Jun  6 10:21:57 2019 -0700

panfrost/midgard/disasm: Pretty-print branch tags

Just makes it a little more obvious what's going on.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/midgard/disassemble.c | 41 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c
index c467e94fc29..dcab841b164 100644
--- a/src/gallium/drivers/panfrost/midgard/disassemble.c
+++ b/src/gallium/drivers/panfrost/midgard/disassemble.c
@@ -40,6 +40,31 @@
 
 static bool is_instruction_int = false;
 
+/* Prints a short form of the tag for branching, the minimum needed to be
+ * legible and unambiguous */
+
+static void
+print_tag_short(unsigned tag)
+{
+        switch (midgard_word_types[tag]) {
+                case midgard_word_type_texture:
+                        printf("tex/%X", tag);
+                        break;
+
+                case midgard_word_type_load_store:
+                        printf("ldst");
+                        break;
+
+                case midgard_word_type_alu:
+                        printf("alu%d/%X", midgard_word_size[tag], tag);
+                        break;
+
+                default:
+                        printf("%s%X", (tag > 0) ? "" : "unk", tag);
+                        break;
+        }
+}
+
 static void
 print_alu_opcode(midgard_alu_op op)
 {
@@ -579,9 +604,10 @@ print_compact_branch_writeout_field(uint16_t word)
                 if (br_uncond.offset >= 0)
                         printf("+");
 
-                printf("%d", br_uncond.offset);
+                printf("%d -> ", br_uncond.offset);
+                print_tag_short(br_uncond.dest_tag);
+                printf("\n");
 
-                printf(" -> %X\n", br_uncond.dest_tag);
                 break;
         }
 
@@ -602,9 +628,10 @@ print_compact_branch_writeout_field(uint16_t word)
                 if (br_cond.offset >= 0)
                         printf("+");
 
-                printf("%d", br_cond.offset);
+                printf("%d -> ", br_cond.offset);
+                print_tag_short(br_cond.dest_tag);
+                printf("\n");
 
-                printf(" -> %X\n", br_cond.dest_tag);
                 break;
         }
         }
@@ -638,9 +665,9 @@ print_extended_branch_writeout_field(uint8_t *words)
         if (br.offset >= 0)
                 printf("+");
 
-        printf("%d", br.offset);
-
-        printf(" -> %X\n", br.dest_tag);
+        printf("%d -> ", br.offset);
+        print_tag_short(br.dest_tag);
+        printf("\n");
 }
 
 static unsigned




More information about the mesa-commit mailing list