[Mesa-dev] [PATCH 04/24] i965/fs: Clean up remaining uses of fs_inst::reads_flag and ::writes_flag.

Francisco Jerez currojerez at riseup.net
Fri May 27 03:46:09 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_fs.cpp                     |  2 +-
 src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp    | 10 +++++-----
 src/mesa/drivers/dri/i965/brw_fs_cse.cpp                 |  6 +++---
 src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp |  6 +++---
 src/mesa/drivers/dri/i965/brw_ir_fs.h                    | 12 ------------
 5 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index c95da29..2528876 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -5649,7 +5649,7 @@ fs_visitor::opt_drop_redundant_mov_to_flags()
             inst->remove(block);
             progress = true;
          }
-      } else if (inst->writes_flag()) {
+      } else if (inst->flags_written()) {
          flag_mov_found[inst->flag_subreg] = false;
       }
    }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
index b5badae..98d4ff6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
@@ -49,7 +49,7 @@
  */
 
 static bool
-opt_cmod_propagation_local(bblock_t *block)
+opt_cmod_propagation_local(const brw_device_info *devinfo, bblock_t *block)
 {
    bool progress = false;
    int ip = block->end_ip + 1;
@@ -123,7 +123,7 @@ opt_cmod_propagation_local(bblock_t *block)
              */
             if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
                 !inst->src[0].negate &&
-                scan_inst->writes_flag()) {
+                scan_inst->flags_written()) {
                inst->remove(block);
                progress = true;
                break;
@@ -144,10 +144,10 @@ opt_cmod_propagation_local(bblock_t *block)
             break;
          }
 
-         if (scan_inst->writes_flag())
+         if (scan_inst->flags_written())
             break;
 
-         read_flag = read_flag || scan_inst->reads_flag();
+         read_flag = read_flag || scan_inst->flags_read(devinfo);
       }
    }
 
@@ -160,7 +160,7 @@ fs_visitor::opt_cmod_propagation()
    bool progress = false;
 
    foreach_block_reverse(block, cfg) {
-      progress = opt_cmod_propagation_local(block) || progress;
+      progress = opt_cmod_propagation_local(devinfo, block) || progress;
    }
 
    if (progress)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index 159bf5d..83444b6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -303,10 +303,10 @@ fs_visitor::opt_cse_local(bblock_t *block)
          /* Kill all AEB entries that write a different value to or read from
           * the flag register if we just wrote it.
           */
-         if (inst->writes_flag()) {
+         if (inst->flags_written()) {
             bool negate; /* dummy */
-            if (entry->generator->reads_flag() ||
-                (entry->generator->writes_flag() &&
+            if (entry->generator->flags_read(devinfo) ||
+                (entry->generator->flags_written() &&
                  !instructions_match(inst, entry->generator, &negate))) {
                entry->remove();
                ralloc_free(entry);
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 a1d07ff..45f5c5e 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
@@ -68,7 +68,7 @@ fs_visitor::dead_code_eliminate()
             if (!result_live) {
                progress = true;
 
-               if (inst->writes_accumulator || inst->writes_flag()) {
+               if (inst->writes_accumulator || inst->flags_written()) {
                   inst->dst = fs_reg(retype(brw_null_reg(), inst->dst.type));
                } else {
                   inst->opcode = BRW_OPCODE_NOP;
@@ -76,7 +76,7 @@ fs_visitor::dead_code_eliminate()
             }
          }
 
-         if (inst->dst.is_null() && inst->writes_flag()) {
+         if (inst->dst.is_null() && inst->flags_written()) {
             if (!(flag_live[0] & inst->flags_written())) {
                inst->opcode = BRW_OPCODE_NOP;
                progress = true;
@@ -87,7 +87,7 @@ fs_visitor::dead_code_eliminate()
               inst->opcode != BRW_OPCODE_WHILE) &&
              inst->dst.is_null() &&
              !inst->has_side_effects() &&
-             !inst->writes_flag() &&
+             !inst->flags_written() &&
              !inst->writes_accumulator) {
             inst->opcode = BRW_OPCODE_NOP;
             progress = true;
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index 1bac3bb..7c9c933 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -286,18 +286,6 @@ public:
     */
    uint32_t flags_written() const;
 
-   bool reads_flag() const
-   {
-      /* XXX - Will get rid of this hack shortly. */
-      const brw_device_info devinfo = {};
-      return flags_read(&devinfo);
-   }
-
-   bool writes_flag() const
-   {
-      return flags_written();
-   }
-
    fs_reg dst;
    fs_reg *src;
 
-- 
2.7.3



More information about the mesa-dev mailing list