[Mesa-dev] [PATCH 02/11] i965: Define method to check whether a backend_reg is inside a given range.
Francisco Jerez
currojerez at riseup.net
Fri Mar 20 07:50:37 PDT 2015
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +----
src/mesa/drivers/dri/i965/brw_shader.cpp | 9 +++++++++
src/mesa/drivers/dri/i965/brw_shader.h | 1 +
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 2ed7b35..e82df66 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -487,10 +487,7 @@ fs_inst::equals(fs_inst *inst) const
bool
fs_inst::overwrites_reg(const fs_reg ®) const
{
- return (reg.file == dst.file &&
- reg.reg == dst.reg &&
- reg.reg_offset >= dst.reg_offset &&
- reg.reg_offset < dst.reg_offset + regs_written);
+ return reg.in_range(dst, regs_written);
}
bool
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 3acbead..a5a56d7 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -782,6 +782,15 @@ backend_reg::is_accumulator() const
}
bool
+backend_reg::in_range(const backend_reg &r, unsigned n) const
+{
+ return (file == r.file &&
+ reg == r.reg &&
+ reg_offset >= r.reg_offset &&
+ reg_offset < r.reg_offset + n);
+}
+
+bool
backend_instruction::is_commutative() const
{
switch (opcode) {
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 944a870..8a3263e 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -54,6 +54,7 @@ struct backend_reg
bool is_negative_one() const;
bool is_null() const;
bool is_accumulator() const;
+ bool in_range(const backend_reg &r, unsigned n) const;
#endif
enum register_file file; /**< Register file: GRF, MRF, IMM. */
--
2.1.3
More information about the mesa-dev
mailing list