pan/bi: Add bi_print_block
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 5 Mar 2020 13:22:07 +0000 (08:22 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 5 Mar 2020 14:35:38 +0000 (14:35 +0000)
Almost there...

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4061>

src/panfrost/bifrost/bi_print.c
src/panfrost/bifrost/bi_print.h

index c2113eb48a563b85546f2823895c02adff1b3449..5c465db6ed17739a6f1fa7a69286a7d1cb8bd6b6 100644 (file)
@@ -385,3 +385,33 @@ bi_print_clause(bi_clause *clause, FILE *fp)
                 fprintf(fp, "\n");
         }
 }
+
+void
+bi_print_block(bi_block *block, FILE *fp)
+{
+        fprintf(fp, "block%u {\n", block->name);
+
+        if (block->scheduled) {
+                bi_foreach_clause_in_block(block, clause)
+                        bi_print_clause(clause, fp);
+        } else {
+                bi_foreach_instr_in_block(block, ins)
+                        bi_print_instruction(ins, fp);
+        }
+
+        if (block->successors[0]) {
+                fprintf(fp, " -> ");
+
+                for (unsigned i = 0; i < ARRAY_SIZE(block->successors); ++i) {
+                        if (block->successors[i])
+                                fprintf(fp, "block%u", block->successors[i]->name);
+                }
+        }
+
+        fprintf(fp, " from ");
+
+        bi_foreach_predecessor(block, pred)
+                fprintf(fp, "block%u ", pred->name);
+
+        fprintf(fp, "\n");
+}
index fb7de0bc89d2fd1b2bfbe09f1db23a866ae66199..a88844fc2449617239a8197527f7a7f07dd39235 100644 (file)
@@ -41,5 +41,6 @@ const char * bi_ldst_type_name(enum bifrost_ldst_type type);
 void bi_print_instruction(bi_instruction *ins, FILE *fp);
 void bi_print_bundle(bi_bundle *bundle, FILE *fp);
 void bi_print_clause(bi_clause *clause, FILE *fp);
+void bi_print_block(bi_block *block, FILE *fp);
 
 #endif