pan/midgard: Index blocks for printing
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 15 Aug 2019 17:43:56 +0000 (10:43 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 19 Aug 2019 15:32:17 +0000 (08:32 -0700)
Better than having pointers flying about.

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

index 217ab31709090320774d93942eaa117589a52fdf..1fddd3f1fe8377e8c432940fb1b827dead5a09e4 100644 (file)
@@ -160,6 +160,9 @@ typedef struct midgard_block {
         /* List of midgard_instructions emitted for the current block */
         struct list_head instructions;
 
+        /* Index of the block in source order */
+        unsigned source_id;
+
         bool is_scheduled;
 
         /* List of midgard_bundles emitted (after the scheduler has run) */
@@ -229,6 +232,9 @@ typedef struct compiler_context {
         int block_count;
         struct list_head blocks;
 
+        /* TODO merge with block_count? */
+        unsigned block_source_count;
+
         /* List of midgard_instructions emitted for the current block */
         midgard_block *current_block;
 
index 12af84d17d6868bb1e57da649534481100994946..67c5c8482144aa0c767538caafff6ebd38c98270 100644 (file)
@@ -2264,6 +2264,8 @@ create_empty_block(compiler_context *ctx)
                         _mesa_hash_pointer,
                         _mesa_key_pointer_equal);
 
+        blk->source_id = ctx->block_source_count++;
+
         return blk;
 }
 
index 5d19f6f6800a06f2fd230b2b7e681ee8d40cf957..240780a1f7d6cb513c018298e71d33a980c1c6af 100644 (file)
@@ -162,7 +162,7 @@ mir_print_instruction(midgard_instruction *ins)
 void
 mir_print_block(midgard_block *block)
 {
-        printf("%p: {\n", block);
+        printf("block%d: {\n", block->source_id);
 
         mir_foreach_instr_in_block(block, ins) {
                 mir_print_instruction(ins);
@@ -173,7 +173,7 @@ mir_print_block(midgard_block *block)
         if (block->nr_successors) {
                 printf(" -> ");
                 for (unsigned i = 0; i < block->nr_successors; ++i) {
-                        printf("%p%s", block->successors[i],
+                        printf("block%d%s", block->successors[i]->source_id,
                                         (i + 1) != block->nr_successors ? ", " : "");
                 }
         }