ir3/legalize: add ir3_update_legalize_state helper

This is a convenience helper that updates 1) the sync state, 2) the
delay state, and 3) the block's current cycle value.

Signed-off-by: Job Noorman <job@noorman.info>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34108>
This commit is contained in:
Job Noorman 2025-05-09 11:26:05 +02:00 committed by Marge Bot
parent 0e9b7c6ff3
commit 7a44d832d3

View file

@ -618,6 +618,23 @@ delay_update(struct ir3_compiler *compiler,
}
}
static void
ir3_update_legalize_state(struct ir3_legalize_state *state,
struct ir3_compiler *compiler,
struct ir3_instruction *n)
{
sync_update(state, compiler, n);
bool count = count_instruction(n, compiler);
if (count)
state->cycle += 1;
delay_update(compiler, state, n);
if (count)
state->cycle += n->repeat + n->nop;
}
/* We want to evaluate each block from the position of any other
* predecessor block, in order that the flags set are the union of
* all possible program paths.
@ -791,8 +808,6 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
list_addtail(&n->node, &block->instr_list);
}
sync_update(state, ctx->compiler, n);
if (n->opc == OPC_META_TEX_PREFETCH) {
assert(n->dsts_count > 0);
ctx->has_tex_prefetch = true;
@ -807,14 +822,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
is_bindless_atomic(n->opc))
ctx->so->has_ssbo = true;
bool count = count_instruction(n, ctx->compiler);
if (count)
state->cycle += 1;
delay_update(ctx->compiler, state, n);
if (count)
state->cycle += n->repeat + n->nop;
ir3_update_legalize_state(state, ctx->compiler, n);
if (ctx->early_input_release && is_input(n)) {
last_input_needs_ss |= (n->opc == OPC_LDLV);