From: Connor Abbott Date: Tue, 4 May 2021 09:11:04 +0000 (+0200) Subject: ir3: Add ir3_start_block() X-Git-Tag: upstream/21.2.3~2110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ef021be4aba42e6caa0826d4952e0beddf0ca18;p=platform%2Fupstream%2Fmesa.git ir3: Add ir3_start_block() Name based on nir_start_block(). A number of places were already open-coding this, convert them. Part-of: --- diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 6a37afa..3fdcdfe 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -584,6 +584,12 @@ block_id(struct ir3_block *block) #endif } +static inline struct ir3_block * +ir3_start_block(struct ir3 *ir) +{ + return list_first_entry(&ir->block_list, struct ir3_block, node); +} + void ir3_block_add_predecessor(struct ir3_block *block, struct ir3_block *pred); void ir3_block_remove_predecessor(struct ir3_block *block, struct ir3_block *pred); unsigned ir3_block_get_pred_index(struct ir3_block *block, struct ir3_block *pred); diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index 72073f6..d706506 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -127,7 +127,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block) * with the end of the program. */ assert(input_count == 0 || !ctx->early_input_release || - block == list_first_entry(&block->shader->block_list, struct ir3_block, node)); + block == ir3_start_block(block->shader)); /* remove all the instructions from the list, we'll be adding * them back in as we go @@ -793,11 +793,10 @@ ir3_legalize(struct ir3 *ir, struct ir3_shader_variant *so, int *max_bary) * a5xx and a6xx do automatically release varying storage at the end. */ ctx->early_input_release = true; - struct ir3_block *first_block = - list_first_entry(&ir->block_list, struct ir3_block, node); + struct ir3_block *start_block = ir3_start_block(ir); foreach_block (block, &ir->block_list) { foreach_instr (instr, &block->instr_list) { - if (is_input(instr) && block != first_block) { + if (is_input(instr) && block != start_block) { ctx->early_input_release = false; break; } diff --git a/src/freedreno/ir3/tests/delay.c b/src/freedreno/ir3/tests/delay.c index ef6cd55..79a66d2 100644 --- a/src/freedreno/ir3/tests/delay.c +++ b/src/freedreno/ir3/tests/delay.c @@ -122,8 +122,7 @@ static void regs_to_ssa(struct ir3 *ir) { struct ir3_instruction *regfile[2 * MAX_REG] = {}; - struct ir3_block *block = - list_first_entry(&ir->block_list, struct ir3_block, node); + struct ir3_block *block = ir3_start_block(ir); foreach_instr_safe (instr, &block->instr_list) { foreach_src (reg, instr) {