From 0bbf458a32b6f9e259118b75a81d4385271b999a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 1 Aug 2023 11:03:10 -0400 Subject: [PATCH] nir: Remove impl->{registers,reg_alloc} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alyssa Rosenzweig Reviewed-by: Faith Ekstrand Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir.c | 1 - src/compiler/nir/nir.h | 6 ------ src/compiler/nir/nir_inline_functions.c | 1 - src/compiler/nir/nir_sweep.c | 3 +-- src/gallium/drivers/etnaviv/etnaviv_compiler_nir_ra.c | 2 +- src/gallium/drivers/lima/ir/pp/nir.c | 1 - src/panfrost/compiler/bifrost_compile.c | 1 - 7 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index 55cb79b861b..09830bd6ec8 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -568,7 +568,6 @@ nir_function_impl_create_bare(nir_shader *shader) exec_list_make_empty(&impl->body); exec_list_make_empty(&impl->locals); - impl->reg_alloc = 0; impl->ssa_alloc = 0; impl->num_blocks = 0; impl->valid_metadata = nir_metadata_none; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index e21eb7b042c..db9bfe2e25c 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3225,12 +3225,6 @@ typedef struct { /** list for all local variables in the function */ struct exec_list locals; - /** list of local registers in the function */ - struct exec_list registers; - - /** next available local register index */ - unsigned reg_alloc; - /** next available SSA value index */ unsigned ssa_alloc; diff --git a/src/compiler/nir/nir_inline_functions.c b/src/compiler/nir/nir_inline_functions.c index f46a3096608..e18ce253432 100644 --- a/src/compiler/nir/nir_inline_functions.c +++ b/src/compiler/nir/nir_inline_functions.c @@ -40,7 +40,6 @@ void nir_inline_function_impl(struct nir_builder *b, nir_function_impl *copy = nir_function_impl_clone(b->shader, impl); exec_list_append(&b->impl->locals, ©->locals); - exec_list_append(&b->impl->registers, ©->registers); nir_foreach_block(block, copy) { nir_foreach_instr_safe(instr, block) { diff --git a/src/compiler/nir/nir_sweep.c b/src/compiler/nir/nir_sweep.c index 4ebe12f928e..5ac7f59dae0 100644 --- a/src/compiler/nir/nir_sweep.c +++ b/src/compiler/nir/nir_sweep.c @@ -120,7 +120,6 @@ sweep_impl(nir_shader *nir, nir_function_impl *impl) ralloc_steal(nir, impl); steal_list(nir, nir_variable, &impl->locals); - steal_list(nir, nir_register, &impl->registers); foreach_list_typed(nir_cf_node, cf_node, node, &impl->body) { sweep_cf_node(nir, cf_node); @@ -161,7 +160,7 @@ nir_sweep(nir_shader *nir) if (nir->info.label) ralloc_steal(nir, (char *)nir->info.label); - /* Variables and registers are not dead. Steal them back. */ + /* Variables are not dead. Steal them back. */ steal_list(nir, nir_variable, &nir->variables); /* Recurse into functions, stealing their contents back. */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_ra.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_ra.c index ae61ffa53a8..64013f3bf4e 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_ra.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_ra.c @@ -136,7 +136,7 @@ etna_ra_assign(struct etna_compile *c, nir_shader *shader) /* this gives an approximation/upper limit on how many nodes are needed * (some ssa values do not represent an allocated register) */ - unsigned max_nodes = impl->ssa_alloc + impl->reg_alloc; + unsigned max_nodes = impl->ssa_alloc; unsigned *live_map = ralloc_array(NULL, unsigned, max_nodes); memset(live_map, 0xff, sizeof(unsigned) * max_nodes); struct live_def *defs = rzalloc_array(NULL, struct live_def, max_nodes); diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c index fe093bb66e5..995b46ae5e3 100644 --- a/src/gallium/drivers/lima/ir/pp/nir.c +++ b/src/gallium/drivers/lima/ir/pp/nir.c @@ -952,7 +952,6 @@ bool ppir_compile_nir(struct lima_fs_compiled_shader *prog, struct nir_shader *n struct util_debug_callback *debug) { nir_function_impl *func = nir_shader_get_entrypoint(nir); - assert(func->reg_alloc == 0); ppir_compiler *comp = ppir_compiler_create(prog, func->ssa_alloc); if (!comp) return false; diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index a442dd08c8c..37ab72a4ad4 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -4817,7 +4817,6 @@ bi_compile_variant_nir(nir_shader *nir, rzalloc_array(ctx, bi_block *, impl->num_blocks); ctx->ssa_alloc += impl->ssa_alloc; - ctx->reg_alloc += impl->reg_alloc; emit_cf_list(ctx, &impl->body); bi_emit_phis_deferred(ctx);