From c697992ca18e6f059d167fa0a1a9af53b3f93fea Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 28 May 2020 14:44:33 -0400 Subject: [PATCH] pan/bi: Defer block naming until after emit This ensures names are meaningful. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 9 +++++++-- src/panfrost/bifrost/compiler.h | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index c06fd591638..cb6595a9de8 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -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); } diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index ad02a46a2d0..92dfb963ed7 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -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; -- 2.30.2