diff options
author | Matt Turner <[email protected]> | 2014-03-17 10:39:43 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-06-01 13:29:24 -0700 |
commit | b1dcdcde2e323f960833f5c7da65d5c2c20113c9 (patch) | |
tree | 6852fd268a2aa5ad096322a9f624879bc6293bd2 | |
parent | 27e12a8ea933e2f978e0ce9286422e6025c7377d (diff) |
i965/fs: Loop from 0 to inst->sources, not 0 to 3.
Reviewed-by: Chris Forbes <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
10 files changed, 28 insertions, 28 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 5a7e270aba4..ba69107b100 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1472,7 +1472,7 @@ fs_visitor::assign_curb_setup() foreach_list(node, &this->instructions) { fs_inst *inst = (fs_inst *)node; - for (unsigned int i = 0; i < 3; i++) { + for (unsigned int i = 0; i < inst->sources; i++) { if (inst->src[i].file == UNIFORM) { int uniform_nr = inst->src[i].reg + inst->src[i].reg_offset; int constant_nr; @@ -1670,7 +1670,7 @@ fs_visitor::split_virtual_grfs() * the send is reading the whole thing. */ if (inst->is_send_from_grf()) { - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) { split_grf[inst->src[i].reg] = false; } @@ -1703,7 +1703,7 @@ fs_visitor::split_virtual_grfs() inst->dst.reg_offset - 1); inst->dst.reg_offset = 0; } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF && split_grf[inst->src[i].reg] && inst->src[i].reg_offset != 0) { @@ -1741,7 +1741,7 @@ fs_visitor::compact_virtual_grfs() if (inst->dst.file == GRF) remap_table[inst->dst.reg] = 0; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) remap_table[inst->src[i].reg] = 0; } @@ -1767,7 +1767,7 @@ fs_visitor::compact_virtual_grfs() if (inst->dst.file == GRF) inst->dst.reg = remap_table[inst->dst.reg]; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) inst->src[i].reg = remap_table[inst->src[i].reg]; } @@ -1807,7 +1807,7 @@ fs_visitor::move_uniform_array_access_to_pull_constants() foreach_list_safe(node, &this->instructions) { fs_inst *inst = (fs_inst *)node; - for (int i = 0 ; i < 3; i++) { + for (int i = 0 ; i < inst->sources; i++) { if (inst->src[i].file != UNIFORM || !inst->src[i].reladdr) continue; @@ -1857,7 +1857,7 @@ fs_visitor::assign_constant_locations() foreach_list(node, &this->instructions) { fs_inst *inst = (fs_inst *) node; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file != UNIFORM) continue; @@ -1928,7 +1928,7 @@ fs_visitor::demote_pull_constants() foreach_list(node, &this->instructions) { fs_inst *inst = (fs_inst *)node; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file != UNIFORM) continue; @@ -2180,7 +2180,7 @@ fs_visitor::compute_to_mrf() * MRF's source GRF that we wanted to rewrite, that stops us. */ bool interfered = false; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < scan_inst->sources; i++) { if (scan_inst->src[i].file == GRF && scan_inst->src[i].reg == inst->src[0].reg && scan_inst->src[i].reg_offset == inst->src[0].reg_offset) { @@ -2319,7 +2319,7 @@ clear_deps_for_inst_src(fs_inst *inst, int dispatch_width, bool *deps, !inst->force_sechalf); /* Clear the flag for registers that actually got read (as expected). */ - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { int grf; if (inst->src[i].file == GRF) { grf = inst->src[i].reg; @@ -2699,7 +2699,7 @@ fs_visitor::dump_instruction(backend_instruction *be_inst, FILE *file) } fprintf(file, ":%s, ", brw_reg_type_letters(inst->dst.type)); - for (int i = 0; i < 3 && inst->src[i].file != BAD_FILE; i++) { + for (int i = 0; i < inst->sources && inst->src[i].file != BAD_FILE; i++) { if (inst->src[i].negate) fprintf(file, "-"); if (inst->src[i].abs) @@ -2788,7 +2788,7 @@ fs_visitor::dump_instruction(backend_instruction *be_inst, FILE *file) fprintf(file, ":%s", brw_reg_type_letters(inst->src[i].type)); } - if (i < 2 && inst->src[i + 1].file != BAD_FILE) + if (i < inst->sources - 1 && inst->src[i + 1].file != BAD_FILE) fprintf(file, ", "); } diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp index 069b60fe22a..a1aff21fd3a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp @@ -353,7 +353,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry) if (entry->src.file != IMM) return false; - for (int i = 2; i >= 0; i--) { + for (int i = inst->sources - 1; i >= 0; i--) { if (inst->src[i].file != entry->dst.file || inst->src[i].reg != entry->dst.reg || inst->src[i].reg_offset != entry->dst.reg_offset || @@ -492,7 +492,7 @@ fs_visitor::opt_copy_propagate_local(void *copy_prop_ctx, bblock_t *block, inst = (fs_inst *)inst->next) { /* Try propagating into this instruction. */ - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file != GRF) continue; diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index ea610bd554c..94f657dd213 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp @@ -228,7 +228,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb) } } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < entry->generator->sources; i++) { fs_reg *src_reg = &entry->generator->src[i]; /* Kill all AEB entries that use the destination we just diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp index dfeceb00619..962d8c6f414 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp @@ -90,7 +90,7 @@ fs_visitor::dead_code_eliminate() } } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) { int var = live_intervals->var_from_vgrf[inst->src[i].reg]; diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index 6ba8bb98295..a5be0ec47bf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -1352,7 +1352,7 @@ fs_generator::generate_code(exec_list *instructions, if (unlikely(debug_flag)) annotate(brw, annotation, cfg, inst, p->next_insn_offset); - for (unsigned int i = 0; i < 3; i++) { + for (unsigned int i = 0; i < inst->sources; i++) { src[i] = brw_reg_from_fs_reg(&inst->src[i]); /* The accumulator result appears to get used for the diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp index a3ccf9931a7..d39724a5ce3 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp @@ -149,7 +149,7 @@ fs_live_variables::setup_def_use() inst = (fs_inst *)inst->next) { /* Set use[] for this instruction */ - for (unsigned int i = 0; i < 3; i++) { + for (unsigned int i = 0; i < inst->sources; i++) { fs_reg reg = inst->src[i]; if (reg.file != GRF) diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp index bbaf8107ec7..4ff6f18ffde 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp @@ -273,7 +273,7 @@ fs_visitor::setup_payload_interference(struct ra_graph *g, * assign_curbe_setup(), and interpolation uses fixed hardware regs from * the start (see interp_reg()). */ - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == HW_REG && inst->src[i].fixed_hw_reg.file == BRW_GENERAL_REGISTER_FILE) { int node_nr = inst->src[i].fixed_hw_reg.nr / reg_width; @@ -583,7 +583,7 @@ fs_visitor::choose_spill_reg(struct ra_graph *g) foreach_list(node, &this->instructions) { fs_inst *inst = (fs_inst *)node; - for (unsigned int i = 0; i < 3; i++) { + for (unsigned int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) { spill_costs[inst->src[i].reg] += loop_scale; @@ -682,7 +682,7 @@ fs_visitor::spill_reg(int spill_reg) foreach_list(node, &this->instructions) { fs_inst *inst = (fs_inst *)node; - for (unsigned int i = 0; i < 3; i++) { + for (unsigned int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF && inst->src[i].reg == spill_reg) { int regs_read = inst->regs_read(this, i); diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp index 01b672f36dd..a0aa1691c95 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp @@ -209,7 +209,7 @@ fs_visitor::register_coalesce() scan_inst->dst.reg = reg_to; scan_inst->dst.reg_offset = reg_to_offset[i]; } - for (int j = 0; j < 3; j++) { + for (int j = 0; j < scan_inst->sources; j++) { if (scan_inst->src[j].file == GRF && scan_inst->src[j].reg == reg_from && scan_inst->src[j].reg_offset == i) { diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp index 35e67740137..1b3d3b76d13 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp @@ -70,7 +70,7 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block) } break; } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < scan_inst->sources; i++) { if (scan_inst->src[i].file == GRF && scan_inst->src[i].reg == inst->src[0].reg && scan_inst->src[i].reg_offset == inst->src[0].reg_offset) { diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index 42fc5e476b9..34b036f3212 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -505,7 +505,7 @@ fs_instruction_scheduler::count_remaining_grf_uses(backend_instruction *be) if (inst->dst.file == GRF) remaining_grf_uses[inst->dst.reg]++; - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file != GRF) continue; @@ -526,7 +526,7 @@ fs_instruction_scheduler::update_register_pressure(backend_instruction *be) grf_active[inst->dst.reg] = true; } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) { remaining_grf_uses[inst->src[i].reg]--; grf_active[inst->src[i].reg] = true; @@ -547,7 +547,7 @@ fs_instruction_scheduler::get_register_pressure_benefit(backend_instruction *be) benefit -= v->virtual_grf_sizes[inst->dst.reg]; } - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file != GRF) continue; @@ -781,7 +781,7 @@ fs_instruction_scheduler::calculate_deps() add_barrier_deps(n); /* read-after-write deps. */ - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) { if (post_reg_alloc) { for (int r = 0; r < reg_width * inst->regs_read(v, i); r++) @@ -905,7 +905,7 @@ fs_instruction_scheduler::calculate_deps() fs_inst *inst = (fs_inst *)n->inst; /* write-after-read deps. */ - for (int i = 0; i < 3; i++) { + for (int i = 0; i < inst->sources; i++) { if (inst->src[i].file == GRF) { if (post_reg_alloc) { for (int r = 0; r < reg_width * inst->regs_read(v, i); r++) |