i965/fs: Clean up remaining uses of fs_inst::reads_flag and ::writes_flag.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 19 May 2016 05:40:40 +0000 (22:40 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Sat, 28 May 2016 06:29:05 +0000 (23:29 -0700)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
src/mesa/drivers/dri/i965/brw_fs_cse.cpp
src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
src/mesa/drivers/dri/i965/brw_ir_fs.h

index 33b3afcfd2dbee2d29705260ad3a956e94b80b61..abbf4d89cf83ebbaf3792cb0705003bfff68b154 100644 (file)
@@ -5640,7 +5640,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;
       }
    }
index b5badaef9774e375c76eb1cdf09ca50a20568d15..98d4ff6007fefa718c285cdaf323977b2510c9fc 100644 (file)
@@ -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)
index 159bf5dd6e09a038522aea9b7e7f5249318a6e69..83444b6d6159dc76175e2441ea1e92f6764e32f4 100644 (file)
@@ -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);
index a1d07ff3e8e03f660cf389b8c1a28697cc358e44..45f5c5ebb9b42c3372c54e5309bfcecc865bde91 100644 (file)
@@ -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;
index ca4b40a3a1408fa0657aee945baec237cf884c4d..cae41a02b8c36f67886724cb8aa89ef3bdd1e17f 100644 (file)
@@ -288,18 +288,6 @@ public:
     */
    unsigned 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;