[Mesa-dev] [PATCH 03/32] i965/fs: Remove dependency of fs_inst on the visitor class.

Francisco Jerez currojerez at riseup.net
Fri Feb 6 06:42:43 PST 2015


The fs_visitor argument of fs_inst::regs_read() wasn't used at all.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp                     | 4 ++--
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp    | 4 ++--
 src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp | 2 +-
 src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp      | 2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp        | 2 +-
 src/mesa/drivers/dri/i965/brw_ir_fs.h                    | 3 +--
 src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp  | 8 ++++----
 7 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 3acbb0b..6d44fa7 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -916,7 +916,7 @@ fs_inst::is_partial_write() const
 }
 
 int
-fs_inst::regs_read(fs_visitor *v, int arg) const
+fs_inst::regs_read(int arg) const
 {
    if (is_tex() && arg == 0 && src[0].file == GRF) {
       return mlen;
@@ -1953,7 +1953,7 @@ fs_visitor::split_virtual_grfs()
       for (int i = 0; i < inst->sources; i++) {
          if (inst->src[i].file == GRF) {
             int reg = vgrf_to_reg[inst->src[i].reg] + inst->src[i].reg_offset;
-            for (int j = 1; j < inst->regs_read(this, i); j++)
+            for (int j = 1; j < inst->regs_read(i); j++)
                split_points[reg + j] = false;
          }
       }
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 68a266c..60a1b8c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -298,7 +298,7 @@ fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
     */
    if (inst->src[arg].reg_offset < entry->dst.reg_offset ||
        (inst->src[arg].reg_offset * 32 + inst->src[arg].subreg_offset +
-        inst->regs_read(this, arg) * inst->src[arg].stride * 32) >
+        inst->regs_read(arg) * inst->src[arg].stride * 32) >
        (entry->dst.reg_offset + entry->regs_written) * 32)
       return false;
 
@@ -444,7 +444,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
        */
       if (inst->src[i].reg_offset < entry->dst.reg_offset ||
           (inst->src[i].reg_offset * 32 + inst->src[i].subreg_offset +
-           inst->regs_read(this, i) * inst->src[i].stride * 32) >
+           inst->regs_read(i) * inst->src[i].stride * 32) >
           (entry->dst.reg_offset + entry->regs_written) * 32)
          continue;
 
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 d66808b..4b5548a 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
@@ -113,7 +113,7 @@ fs_visitor::dead_code_eliminate()
             if (inst->src[i].file == GRF) {
                int var = live_intervals->var_from_reg(inst->src[i]);
 
-               for (int j = 0; j < inst->regs_read(this, i); j++) {
+               for (int j = 0; j < inst->regs_read(i); j++) {
                   BITSET_SET(live, var + j);
                }
             }
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 968219b..502161d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -152,7 +152,7 @@ fs_live_variables::setup_def_use()
             if (reg.file != GRF)
                continue;
 
-            for (int j = 0; j < inst->regs_read(v, i); j++) {
+            for (int j = 0; j < inst->regs_read(i); j++) {
                setup_one_read(bd, inst, ip, reg);
                reg.reg_offset++;
             }
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 ebe0b12..72c490b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -859,7 +859,7 @@ fs_visitor::spill_reg(int spill_reg)
       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);
+            int regs_read = inst->regs_read(i);
             int subset_spill_offset = (spill_offset +
                                        REG_SIZE * inst->src[i].reg_offset);
             fs_reg unspill_dst(GRF, alloc.allocate(regs_read));
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 2369834..6ce2e01 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -28,7 +28,6 @@
 #include "brw_shader.h"
 
 class fs_inst;
-class fs_visitor;
 
 class fs_reg : public backend_reg {
 public:
@@ -222,7 +221,7 @@ public:
    bool overwrites_reg(const fs_reg &reg) const;
    bool is_send_from_grf() const;
    bool is_partial_write() const;
-   int regs_read(fs_visitor *v, int arg) const;
+   int regs_read(int arg) const;
    bool can_do_source_mods(struct brw_context *brw);
 
    bool reads_flag() const;
diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 78666fd..88feeca 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -793,10 +793,10 @@ fs_instruction_scheduler::calculate_deps()
       for (int i = 0; i < inst->sources; i++) {
          if (inst->src[i].file == GRF) {
             if (post_reg_alloc) {
-               for (int r = 0; r < inst->regs_read(v, i); r++)
+               for (int r = 0; r < inst->regs_read(i); r++)
                   add_dep(last_grf_write[inst->src[i].reg + r], n);
             } else {
-               for (int r = 0; r < inst->regs_read(v, i); r++) {
+               for (int r = 0; r < inst->regs_read(i); r++) {
                   add_dep(last_grf_write[inst->src[i].reg * 16 + inst->src[i].reg_offset + r], n);
                }
             }
@@ -922,10 +922,10 @@ fs_instruction_scheduler::calculate_deps()
       for (int i = 0; i < inst->sources; i++) {
          if (inst->src[i].file == GRF) {
             if (post_reg_alloc) {
-               for (int r = 0; r < inst->regs_read(v, i); r++)
+               for (int r = 0; r < inst->regs_read(i); r++)
                   add_dep(n, last_grf_write[inst->src[i].reg + r]);
             } else {
-               for (int r = 0; r < inst->regs_read(v, i); r++) {
+               for (int r = 0; r < inst->regs_read(i); r++) {
                   add_dep(n, last_grf_write[inst->src[i].reg * 16 + inst->src[i].reg_offset + r]);
                }
             }
-- 
2.1.3



More information about the mesa-dev mailing list