From 7d430fc05e8f0a6211fb587f1bc7b2a76ed7de10 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Wed, 18 May 2016 22:40:40 -0700 Subject: [PATCH] i965/fs: Clean up remaining uses of fs_inst::reads_flag and ::writes_flag. Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +- .../drivers/dri/i965/brw_fs_cmod_propagation.cpp | 10 +++++----- src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 6 +++--- .../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 33b3afcfd2d..abbf4d89cf8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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; } } 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 b5badaef977..98d4ff6007f 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 159bf5dd6e0..83444b6d615 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 a1d07ff3e8e..45f5c5ebb9b 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 ca4b40a3a14..cae41a02b8c 100644 --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h @@ -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; -- 2.30.2