pan/bi: Fixup bi_reindex_ssa.c for bi

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39305>
This commit is contained in:
Christoph Pillmayer 2025-12-12 11:15:38 +00:00 committed by Marge Bot
parent 63a8232c1a
commit f29fa1e9df
3 changed files with 13 additions and 11 deletions

View file

@ -4,27 +4,25 @@
*/
#include <stdlib.h>
#include "agx_compiler.h"
/* Reindex SSA to reduce memory usage */
#include "compiler.h"
void
agx_reindex_ssa(agx_context *ctx)
bi_reindex_ssa(bi_context *ctx)
{
unsigned *remap = calloc(ctx->alloc, sizeof(*remap));
unsigned *remap = calloc(ctx->ssa_alloc, sizeof(*remap));
ctx->alloc = 0;
ctx->ssa_alloc = 0;
agx_foreach_instr_global(ctx, I) {
agx_foreach_ssa_dest(I, d) {
bi_foreach_instr_global(ctx, I) {
bi_foreach_ssa_dest(I, d) {
assert(!remap[I->dest[d].value] && "input is SSA");
remap[I->dest[d].value] = ctx->alloc++;
remap[I->dest[d].value] = ctx->ssa_alloc++;
I->dest[d].value = remap[I->dest[d].value];
}
}
agx_foreach_instr_global(ctx, I) {
agx_foreach_ssa_src(I, s) {
bi_foreach_instr_global(ctx, I) {
bi_foreach_ssa_src(I, s) {
I->src[s].value = remap[I->src[s].value];
}
}

View file

@ -1476,6 +1476,9 @@ uint64_t MUST_CHECK bi_postra_liveness_ins(uint64_t live, bi_instr *ins);
/* SSA spilling; returns number of spilled registers */
unsigned bi_spill_ssa(bi_context *ctx, unsigned num_registers, unsigned tls_size);
/* Reindex SSA to reduce memory usage */
void bi_reindex_ssa(bi_context *ctx);
/* Layout */
signed bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target);

View file

@ -26,6 +26,7 @@ libpanfrost_bifrost_files = files(
'bi_ra.c',
'bi_ra_ssa.c',
'bi_spill_ssa.c',
'bi_reindex_ssa.c',
'bi_validate.c',
'bi_dominance.c',
'bir.c',