diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 1e929f833dd..72be6f7f8ea 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -4811,19 +4811,16 @@ bi_compile_variant_nir(nir_shader *nir, ctx->allocated_vec = _mesa_hash_table_u64_create(ctx); - nir_foreach_function(func, nir) { - if (!func->impl) - continue; - - nir_index_blocks(func->impl); + nir_foreach_function_impl(impl, nir) { + nir_index_blocks(impl); ctx->indexed_nir_blocks = - rzalloc_array(ctx, bi_block *, func->impl->num_blocks); + rzalloc_array(ctx, bi_block *, impl->num_blocks); - ctx->ssa_alloc += func->impl->ssa_alloc; - ctx->reg_alloc += func->impl->reg_alloc; + ctx->ssa_alloc += impl->ssa_alloc; + ctx->reg_alloc += impl->reg_alloc; - emit_cf_list(ctx, &func->impl->body); + emit_cf_list(ctx, &impl->body); bi_emit_phis_deferred(ctx); break; /* TODO: Multi-function shaders */ } diff --git a/src/panfrost/midgard/nir_fuse_io_16.c b/src/panfrost/midgard/nir_fuse_io_16.c index 28f1fcf44c4..88434443e4d 100644 --- a/src/panfrost/midgard/nir_fuse_io_16.c +++ b/src/panfrost/midgard/nir_fuse_io_16.c @@ -49,11 +49,8 @@ nir_fuse_io_16(nir_shader *shader) { bool progress = false; - nir_foreach_function(function, shader) { - if (!function->impl) - continue; - - nir_foreach_block(block, function->impl) { + nir_foreach_function_impl(impl, shader) { + nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -84,7 +81,7 @@ nir_fuse_io_16(nir_shader *shader) intr->dest.ssa.bit_size = 16; - nir_builder b = nir_builder_create(function->impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_instr(instr); /* The f2f32(f2fmp(x)) will cancel by opt_algebraic */ @@ -96,7 +93,7 @@ nir_fuse_io_16(nir_shader *shader) } } - nir_metadata_preserve(function->impl, + nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance); } diff --git a/src/panfrost/util/pan_lower_writeout.c b/src/panfrost/util/pan_lower_writeout.c index 83d565e4af1..dd7a33304a1 100644 --- a/src/panfrost/util/pan_lower_writeout.c +++ b/src/panfrost/util/pan_lower_writeout.c @@ -85,14 +85,11 @@ pan_nir_lower_zs_store(nir_shader *nir) if (nir->info.stage != MESA_SHADER_FRAGMENT) return false; - nir_foreach_function(function, nir) { - if (!function->impl) - continue; - + nir_foreach_function_impl(impl, nir) { nir_intrinsic_instr *stores[3] = {NULL}; unsigned writeout = 0; - nir_foreach_block(block, function->impl) { + nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -135,7 +132,7 @@ pan_nir_lower_zs_store(nir_shader *nir) bool replaced = false; - nir_foreach_block(block, function->impl) { + nir_foreach_block(block, impl) { nir_foreach_instr_safe(instr, block) { if (instr->type != nir_instr_type_intrinsic) continue; @@ -154,7 +151,7 @@ pan_nir_lower_zs_store(nir_shader *nir) assert(nir_src_is_const(intr->src[1]) && "no indirect outputs"); - nir_builder b = nir_builder_create(function->impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_block_before_jump(instr->block); /* Trying to write depth twice results in the @@ -172,7 +169,7 @@ pan_nir_lower_zs_store(nir_shader *nir) /* Insert a store to the depth RT (0xff) if needed */ if (!replaced) { - nir_builder b = nir_builder_create(function->impl); + nir_builder b = nir_builder_create(impl); b.cursor = nir_after_block_before_jump(common_block); pan_nir_emit_combined_store(&b, NULL, writeout, stores); @@ -183,7 +180,7 @@ pan_nir_lower_zs_store(nir_shader *nir) nir_instr_remove(&stores[i]->instr); } - nir_metadata_preserve(function->impl, + nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance); progress = true; }