From 7a44d832d3a36bc7a64fffdeb974bb997d58d41c Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Fri, 9 May 2025 11:26:05 +0200 Subject: [PATCH] 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 Part-of: --- src/freedreno/ir3/ir3_legalize.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index d8476a9d99c..3793fcf9fdf 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -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);