freedreno/ir3: make input/output iterators declare cursor ptr

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5048>
This commit is contained in:
Rob Clark 2020-05-16 12:15:23 -07:00 committed by Marge Bot
parent c1d33eed41
commit fcfe5eff63
9 changed files with 9 additions and 19 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);
}

View file

@ -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;