From 65f604e3b3b25bb95c96062675817a3828562e26 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 16 May 2020 12:01:08 -0700 Subject: [PATCH] freedreno/ir3: make foreach_src declare cursor ptr To match how the newer iterators work. Signed-off-by: Rob Clark Part-of: --- src/freedreno/ir3/ir3.h | 7 +++---- src/freedreno/ir3/ir3_a6xx.c | 2 -- src/freedreno/ir3/ir3_cp.c | 2 -- src/freedreno/ir3/ir3_delay.c | 3 --- src/freedreno/ir3/ir3_legalize.c | 5 ++--- src/freedreno/ir3/ir3_postsched.c | 4 +--- src/freedreno/ir3/ir3_ra.c | 4 ---- src/freedreno/ir3/ir3_ra.h | 1 - 8 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 2974be2c0b5..547cf627203 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -1063,8 +1063,9 @@ static inline unsigned ir3_cat3_absneg(opc_t opc) /* iterator for an instructions's sources (reg), also returns src #: */ #define foreach_src_n(__srcreg, __n, __instr) \ if ((__instr)->regs_count) \ - for (unsigned __cnt = (__instr)->regs_count - 1, __n = 0; __n < __cnt; __n++) \ - if ((__srcreg = (__instr)->regs[__n + 1])) + for (struct ir3_register *__srcreg = (void *)~0; __srcreg; __srcreg = NULL) \ + for (unsigned __cnt = (__instr)->regs_count - 1, __n = 0; __n < __cnt; __n++) \ + if ((__srcreg = (__instr)->regs[__n + 1])) /* iterator for an instructions's sources (reg): */ #define foreach_src(__srcreg, __instr) \ @@ -1155,8 +1156,6 @@ static inline bool __is_false_dep(struct ir3_instruction *instr, unsigned n) static inline bool check_src_cond(struct ir3_instruction *instr, bool (*cond)(struct ir3_instruction *)) { - struct ir3_register *reg; - /* Note that this is also used post-RA so skip the ssa iterator: */ foreach_src (reg, instr) { struct ir3_instruction *src = reg->instr; diff --git a/src/freedreno/ir3/ir3_a6xx.c b/src/freedreno/ir3/ir3_a6xx.c index e297e34fdf5..cef110d6f5c 100644 --- a/src/freedreno/ir3/ir3_a6xx.c +++ b/src/freedreno/ir3/ir3_a6xx.c @@ -445,8 +445,6 @@ ir3_a6xx_fixup_atomic_dests(struct ir3 *ir, struct ir3_shader_variant *so) foreach_block (block, &ir->block_list) { foreach_instr_safe (instr, &block->instr_list) { - struct ir3_register *reg; - foreach_src (reg, instr) { struct ir3_instruction *src = reg->instr; diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c index f3116b8b4c7..7b6c3657631 100644 --- a/src/freedreno/ir3/ir3_cp.c +++ b/src/freedreno/ir3/ir3_cp.c @@ -639,8 +639,6 @@ eliminate_output_mov(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr) static void instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr) { - struct ir3_register *reg; - if (instr->regs_count == 0) return; diff --git a/src/freedreno/ir3/ir3_delay.c b/src/freedreno/ir3/ir3_delay.c index 15434fdedd1..2ea8ee5ed6e 100644 --- a/src/freedreno/ir3/ir3_delay.c +++ b/src/freedreno/ir3/ir3_delay.c @@ -49,7 +49,6 @@ ignore_dep(struct ir3_instruction *assigner, if (assigner->barrier_class & IR3_BARRIER_ARRAY_W) { struct ir3_register *dst = assigner->regs[0]; - struct ir3_register *src; debug_assert(dst->flags & IR3_REG_ARRAY); @@ -198,7 +197,6 @@ delay_calc_srcn(struct ir3_block *block, unsigned delay = 0; if (is_meta(assigner)) { - struct ir3_register *src; foreach_src (src, assigner) { unsigned d; @@ -320,7 +318,6 @@ ir3_delay_calc(struct ir3_block *block, struct ir3_instruction *instr, bool soft, bool pred) { unsigned delay = 0; - struct ir3_register *src; foreach_src_n (src, i, instr) { unsigned d = 0; diff --git a/src/freedreno/ir3/ir3_legalize.c b/src/freedreno/ir3/ir3_legalize.c index a143c4dc2f9..c59c065c207 100644 --- a/src/freedreno/ir3/ir3_legalize.c +++ b/src/freedreno/ir3/ir3_legalize.c @@ -113,7 +113,6 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block) list_inithead(&block->instr_list); foreach_instr_safe (n, &instr_list) { - struct ir3_register *reg; unsigned i; n->flags &= ~(IR3_INSTR_SS | IR3_INSTR_SY); @@ -151,7 +150,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block) * resulting in undefined results: */ for (i = 0; i < n->regs_count; i++) { - reg = n->regs[i]; + struct ir3_register *reg = n->regs[i]; if (reg_gpr(reg)) { @@ -181,7 +180,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block) } if (n->regs_count > 0) { - reg = n->regs[0]; + struct ir3_register *reg = n->regs[0]; if (regmask_get(&state->needs_ss_war, reg)) { n->flags |= IR3_INSTR_SS; last_input_needs_ss = false; diff --git a/src/freedreno/ir3/ir3_postsched.c b/src/freedreno/ir3/ir3_postsched.c index a9a14d23e23..109b96438a9 100644 --- a/src/freedreno/ir3/ir3_postsched.c +++ b/src/freedreno/ir3/ir3_postsched.c @@ -400,7 +400,6 @@ static void calculate_deps(struct ir3_postsched_deps_state *state, struct ir3_postsched_node *node) { - struct ir3_register *reg; int b; /* Add dependencies on instructions that previously (or next, @@ -441,7 +440,7 @@ calculate_deps(struct ir3_postsched_deps_state *state, /* And then after we update the state for what this instruction * wrote: */ - reg = node->instr->regs[0]; + struct ir3_register *reg = node->instr->regs[0]; if (reg->flags & IR3_REG_RELATIV) { /* mark the entire array as written: */ struct ir3_array *arr = ir3_lookup_array(state->ctx->ir, reg->array.id); @@ -679,7 +678,6 @@ cleanup_self_movs(struct ir3 *ir) { foreach_block (block, &ir->block_list) { foreach_instr_safe (instr, &block->instr_list) { - struct ir3_register *reg; foreach_src (reg, instr) { if (!reg->instr) diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index 72e145c94a3..cc05d0cac24 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -156,7 +156,6 @@ get_definer(struct ir3_ra_ctx *ctx, struct ir3_instruction *instr, * need to find the distance between where actual array starts * and collect.. that probably doesn't happen currently. */ - struct ir3_register *src; int dsz, doff; /* note: don't use foreach_ssa_src as this gets called once @@ -1238,7 +1237,6 @@ static void ra_block_alloc(struct ir3_ra_ctx *ctx, struct ir3_block *block) { foreach_instr (instr, &block->instr_list) { - struct ir3_register *reg; if (writes_gpr(instr)) { if (should_assign(ctx, instr)) { @@ -1481,7 +1479,6 @@ ra_precolor_assigned(struct ir3_ra_ctx *ctx) precolor(ctx, instr); - struct ir3_register *src; foreach_src (src, instr) { if (!src->instr) continue; @@ -1519,7 +1516,6 @@ ra_sanity_check(struct ir3 *ir) debug_assert(dst->num == (src->num + instr->split.off)); } else if (instr->opc == OPC_META_COLLECT) { struct ir3_register *dst = instr->regs[0]; - struct ir3_register *src; foreach_src_n (src, n, instr) { debug_assert(dst->num == (src->num - n)); diff --git a/src/freedreno/ir3/ir3_ra.h b/src/freedreno/ir3/ir3_ra.h index 7acfdd0443d..437223bd1de 100644 --- a/src/freedreno/ir3/ir3_ra.h +++ b/src/freedreno/ir3/ir3_ra.h @@ -308,7 +308,6 @@ __ra_init_use_itr(struct ir3_ra_ctx *ctx, struct ir3_instruction *instr) ctx->namecnt = ctx->nameidx = 0; - struct ir3_register *reg; foreach_src (reg, instr) { if (reg->flags & IR3_REG_ARRAY) { struct ir3_array *arr = -- 2.30.2