pan/bi: Defer block naming until after emit
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 28 May 2020 18:44:33 +0000 (14:44 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
This ensures names are meaningful.

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

src/panfrost/bifrost/bifrost_compile.c
src/panfrost/bifrost/compiler.h

index c06fd5916388fc13f00edab1a54af4ed17948634..cb6595a9de89dd20b922b192b06293f29d376940 100644 (file)
@@ -995,8 +995,6 @@ create_empty_block(bi_context *ctx)
                         _mesa_hash_pointer,
                         _mesa_key_pointer_equal);
 
-        blk->base.name = ctx->block_name_count++;
-
         return blk;
 }
 
@@ -1289,8 +1287,15 @@ bifrost_compile_shader_nir(nir_shader *nir, panfrost_program *program, unsigned
                 break; /* TODO: Multi-function shaders */
         }
 
+        unsigned block_source_count = 0;
+
         bi_foreach_block(ctx, _block) {
                 bi_block *block = (bi_block *) _block;
+
+                /* Name blocks now that we're done emitting so the order is
+                 * consistent */
+                block->base.name = block_source_count++;
+
                 bi_lower_combine(ctx, block);
         }
 
index ad02a46a2d00f49dc9dcc83231b783905668b341..92dfb963ed71f0c720a5ccfcc4f525b4201386fe 100644 (file)
@@ -409,7 +409,6 @@ typedef struct {
        /* During NIR->BIR */
        nir_function_impl *impl;
        bi_block *current_block;
-       unsigned block_name_count;
        bi_block *after_block;
        bi_block *break_block;
        bi_block *continue_block;