jay/liveness: use jay_foreach_preload

..and explain why.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41808>
This commit is contained in:
Alyssa Rosenzweig 2026-05-20 08:55:44 -04:00 committed by Marge Bot
parent 35470e38ef
commit 4a74c773ff

View file

@ -154,6 +154,20 @@ jay_calculate_register_demands(jay_function *func)
}
}
/* Model the implicit demand from preloading inputs. In a function like:
*
* %0 = preload r10
* %1 = add %0, %0
* return %1
*
* ...the "true" register demand is 1, but we need to clamp the demand to 11
* to make sure r10 actually exists.
*/
jay_foreach_preload(func, I) {
uint32_t max = jay_preload_reg(I) + jay_num_values(I->dst);
max_demand[I->dst.file] = MAX2(max_demand[I->dst.file], max);
}
jay_foreach_block(func, block) {
unsigned demands[JAY_NUM_SSA_FILES] = {};
@ -167,12 +181,6 @@ jay_calculate_register_demands(jay_function *func)
}
jay_foreach_inst_in_block(block, I) {
/* We must have enough register file space for the register payload */
if (I->op == JAY_OPCODE_PRELOAD) {
uint32_t max = jay_preload_reg(I) + jay_num_values(I->dst);
max_demand[I->dst.file] = MAX2(max_demand[I->dst.file], max);
}
/* Make destinations live */
jay_foreach_dst(I, d) {
demands[d.file] += util_next_power_of_two(jay_num_values(d));