pan/bi: Factor nir_function_impl out of the context
Unnecessary and complicates unit testing. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
This commit is contained in:
parent
114a0f9798
commit
7434f31e09
|
@ -2356,7 +2356,9 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir,
|
|||
if (!func->impl)
|
||||
continue;
|
||||
|
||||
ctx->impl = func->impl;
|
||||
ctx->ssa_alloc += func->impl->ssa_alloc;
|
||||
ctx->reg_alloc += func->impl->reg_alloc;
|
||||
|
||||
emit_cf_list(ctx, &func->impl->body);
|
||||
break; /* TODO: Multi-function shaders */
|
||||
}
|
||||
|
|
|
@ -494,7 +494,6 @@ typedef struct {
|
|||
uint64_t blend_desc;
|
||||
|
||||
/* During NIR->BIR */
|
||||
nir_function_impl *impl;
|
||||
bi_block *current_block;
|
||||
bi_block *after_block;
|
||||
bi_block *break_block;
|
||||
|
@ -503,7 +502,8 @@ typedef struct {
|
|||
nir_alu_type *blend_types;
|
||||
|
||||
/* For creating temporaries */
|
||||
unsigned temp_alloc;
|
||||
unsigned ssa_alloc;
|
||||
unsigned reg_alloc;
|
||||
|
||||
/* Analysis results */
|
||||
bool has_liveness;
|
||||
|
@ -550,25 +550,21 @@ bi_fau(enum bir_fau value, bool hi)
|
|||
static inline unsigned
|
||||
bi_max_temp(bi_context *ctx)
|
||||
{
|
||||
unsigned alloc = MAX2(ctx->impl->reg_alloc, ctx->impl->ssa_alloc);
|
||||
return ((alloc + 2 + ctx->temp_alloc) << 1);
|
||||
return (MAX2(ctx->reg_alloc, ctx->ssa_alloc) + 2) << 1;
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_temp(bi_context *ctx)
|
||||
{
|
||||
unsigned alloc = (ctx->impl->ssa_alloc + ctx->temp_alloc++);
|
||||
return bi_get_index(alloc, false, 0);
|
||||
return bi_get_index(ctx->ssa_alloc++, false, 0);
|
||||
}
|
||||
|
||||
static inline bi_index
|
||||
bi_temp_reg(bi_context *ctx)
|
||||
{
|
||||
unsigned alloc = (ctx->impl->reg_alloc + ctx->temp_alloc++);
|
||||
return bi_get_index(alloc, true, 0);
|
||||
return bi_get_index(ctx->reg_alloc++, true, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Inline constants automatically, will be lowered out by bi_lower_fau where a
|
||||
* constant is not allowed. load_const_to_scalar gaurantees that this makes
|
||||
* sense */
|
||||
|
|
Loading…
Reference in New Issue