pan: Pull out normal block logic from compute_w_entry

Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38181>
This commit is contained in:
Christoph Pillmayer
2025-10-28 16:21:51 +00:00
committed by Marge Bot
parent c6d9b9b4e0
commit 47f4b00cb2
+24 -13
View File
@@ -745,25 +745,16 @@ compute_w_entry_loop_header(struct spill_ctx *ctx)
}
/*
* Compute W_entry for a block. Section 4.2 in the paper.
* The W_entry will contain variables that are W_exit in
* - all predecessors
* - some predecessors, sorted by next-use distance
*/
static ATTRIBUTE_NOINLINE void
compute_w_entry(struct spill_ctx *ctx)
compute_w_entry_usual(struct spill_ctx *ctx)
{
bi_block *block = ctx->block;
struct spill_block *sb = spill_block(ctx, block);
/* Nothing to do for start blocks */
if (bi_num_predecessors(block) == 0)
return;
/* Loop headers have a different heuristic */
if (block->loop_header) {
compute_w_entry_loop_header(ctx);
return;
}
/* Usual blocks follow */
unsigned *freq = calloc(ctx->n_alloc, sizeof(unsigned));
/* Record what's written at the end of each predecessor */
@@ -845,6 +836,26 @@ compute_w_entry(struct spill_ctx *ctx)
free(candidates);
}
/*
* Compute W_entry for a block. Section 4.2 in the paper.
*/
static ATTRIBUTE_NOINLINE void
compute_w_entry(struct spill_ctx *ctx)
{
bi_block *block = ctx->block;
/* Nothing to do for start blocks */
if (bi_num_predecessors(block) == 0)
return;
/* Loop headers have a different heuristic */
if (block->loop_header) {
compute_w_entry_loop_header(ctx);
} else {
compute_w_entry_usual(ctx);
}
}
/*
* We initialize S with the union of S at the exit of (forward edge)
* predecessors and the complement of W, intersected with the live-in set. The