From: Rob Clark Date: Sat, 16 May 2020 19:15:23 +0000 (-0700) Subject: freedreno/ir3: make input/output iterators declare cursor ptr X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fcfe5eff63358371b10f1cb75964e3f930d4c858;p=mesa.git freedreno/ir3: make input/output iterators declare cursor ptr Signed-off-by: Rob Clark Part-of: --- diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index 2ce37bccbac..79a40a12293 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -1120,15 +1120,17 @@ static inline bool __is_false_dep(struct ir3_instruction *instr, unsigned n) /* iterators for shader inputs: */ #define foreach_input_n(__ininstr, __cnt, __ir) \ - for (unsigned __cnt = 0; __cnt < (__ir)->inputs_count; __cnt++) \ - if ((__ininstr = (__ir)->inputs[__cnt])) + for (struct ir3_instruction *__ininstr = (void *)~0; __ininstr; __ininstr = NULL) \ + for (unsigned __cnt = 0; __cnt < (__ir)->inputs_count; __cnt++) \ + if ((__ininstr = (__ir)->inputs[__cnt])) #define foreach_input(__ininstr, __ir) \ foreach_input_n(__ininstr, __i, __ir) /* iterators for shader outputs: */ #define foreach_output_n(__outinstr, __cnt, __ir) \ - for (unsigned __cnt = 0; __cnt < (__ir)->outputs_count; __cnt++) \ - if ((__outinstr = (__ir)->outputs[__cnt])) + for (struct ir3_instruction *__outinstr = (void *)~0; __outinstr; __outinstr = NULL) \ + for (unsigned __cnt = 0; __cnt < (__ir)->outputs_count; __cnt++) \ + if ((__outinstr = (__ir)->outputs[__cnt])) #define foreach_output(__outinstr, __ir) \ foreach_output_n(__outinstr, __i, __ir) diff --git a/src/freedreno/ir3/ir3_a6xx.c b/src/freedreno/ir3/ir3_a6xx.c index cef110d6f5c..6160a855771 100644 --- a/src/freedreno/ir3/ir3_a6xx.c +++ b/src/freedreno/ir3/ir3_a6xx.c @@ -460,7 +460,6 @@ ir3_a6xx_fixup_atomic_dests(struct ir3 *ir, struct ir3_shader_variant *so) } /* we also need to fixup shader outputs: */ - struct ir3_instruction *out; foreach_output_n (out, n, ir) { if (is_atomic(out->opc) && (out->flags & IR3_INSTR_G)) { ir->outputs[n] = get_atomic_dest_mov(out); diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index e6a179dc40c..b3e23db243e 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -2963,7 +2963,7 @@ setup_input(struct ir3_context *ctx, nir_variable *in) ctx->inputs[idx] = instr; } } else if (ctx->so->type == MESA_SHADER_VERTEX) { - struct ir3_instruction *input = NULL, *in; + struct ir3_instruction *input = NULL; struct ir3_instruction *components[4]; unsigned mask = (1 << (ncomp + frac)) - 1; @@ -3362,7 +3362,6 @@ fixup_binning_pass(struct ir3_context *ctx) so->outputs[j] = so->outputs[i]; /* fixup outidx to point to new output table entry: */ - struct ir3_instruction *out; foreach_output (out, ir) { if (out->collect.outidx == i) { out->collect.outidx = j; @@ -3638,7 +3637,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, ret = ir3_ra(so, precolor, ARRAY_SIZE(precolor)); } else if (so->num_sampler_prefetch) { assert(so->type == MESA_SHADER_FRAGMENT); - struct ir3_instruction *instr, *precolor[2]; + struct ir3_instruction *precolor[2]; int idx = 0; foreach_input (instr, ir) { @@ -3685,7 +3684,6 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, for (unsigned i = 0; i < so->outputs_count; i++) so->outputs[i].regid = INVALID_REG; - struct ir3_instruction *out; foreach_output (out, ir) { assert(out->opc == OPC_META_COLLECT); unsigned outidx = out->collect.outidx; @@ -3694,7 +3692,6 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, so->outputs[outidx].half = !!(out->regs[0]->flags & IR3_REG_HALF); } - struct ir3_instruction *in; foreach_input (in, ir) { assert(in->opc == OPC_META_INPUT); unsigned inidx = in->input.inidx; diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c index 7023b327150..a7ae834d18a 100644 --- a/src/freedreno/ir3/ir3_cp.c +++ b/src/freedreno/ir3/ir3_cp.c @@ -786,7 +786,6 @@ ir3_cp(struct ir3 *ir, struct ir3_shader_variant *so) ir3_clear_mark(ir); - struct ir3_instruction *out; foreach_output_n (out, n, ir) { instr_cp(&ctx, out); ir->outputs[n] = eliminate_output_mov(&ctx, out); diff --git a/src/freedreno/ir3/ir3_dce.c b/src/freedreno/ir3/ir3_dce.c index b97b2190051..92a5d87eed8 100644 --- a/src/freedreno/ir3/ir3_dce.c +++ b/src/freedreno/ir3/ir3_dce.c @@ -118,7 +118,6 @@ find_and_remove_unused(struct ir3 *ir, struct ir3_shader_variant *so) } } - struct ir3_instruction *out; foreach_output (out, ir) instr_dce(out, false); @@ -168,7 +167,6 @@ find_and_remove_unused(struct ir3 *ir, struct ir3_shader_variant *so) } /* cleanup unused inputs: */ - struct ir3_instruction *in; foreach_input_n (in, n, ir) if (in->flags & IR3_INSTR_UNUSED) ir->inputs[n] = NULL; diff --git a/src/freedreno/ir3/ir3_group.c b/src/freedreno/ir3/ir3_group.c index 490c2216e66..35f63b79b24 100644 --- a/src/freedreno/ir3/ir3_group.c +++ b/src/freedreno/ir3/ir3_group.c @@ -164,7 +164,6 @@ find_neighbors(struct ir3 *ir) bool progress = false; unsigned i; - struct ir3_instruction *out; foreach_output (out, ir) progress |= instr_find_neighbors(out); diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index 034bcd8248e..9f2c7688b1c 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -301,7 +301,7 @@ print_block(struct ir3_block *block, int lvl) unsigned i = 0; tab(lvl+1); printf("pred: "); - set_foreach(block->predecessors, entry) { + set_foreach (block->predecessors, entry) { struct ir3_block *pred = (struct ir3_block *)entry->key; if (i++) printf(", "); @@ -342,7 +342,6 @@ ir3_print(struct ir3 *ir) foreach_block (block, &ir->block_list) print_block(block, 0); - struct ir3_instruction *out; foreach_output_n (out, i, ir) { printf("out%d: ", i); print_instr(out, 0); diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index cc05d0cac24..8196203848e 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -1269,8 +1269,6 @@ ra_block_alloc(struct ir3_ra_ctx *ctx, struct ir3_block *block) * them in the first pass: */ if (!ctx->scalar_pass) { - struct ir3_instruction *in, *out; - foreach_input (in, ctx->ir) { reg_assign(ctx, in->regs[0], in); } diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c index 18d9659eafe..652129108bf 100644 --- a/src/freedreno/ir3/ir3_shader.c +++ b/src/freedreno/ir3/ir3_shader.c @@ -456,7 +456,6 @@ ir3_shader_disasm(struct ir3_shader_variant *so, uint32_t *bin, FILE *out) uint8_t regid; unsigned i; - struct ir3_instruction *instr; foreach_input_n (instr, i, ir) { reg = instr->regs[0]; regid = reg->num;