summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2015-03-18 19:35:31 +0200
committerFrancisco Jerez <[email protected]>2015-03-23 14:12:36 +0200
commit74c7e5d35181d31e4448c614f6aa62c1e1f60694 (patch)
treeea1acf2ded9594729811e44cf89e46681e30ed27 /src
parentbf6eb37e0b62fa61c01a32dc5ccb6a7ab00be5f4 (diff)
i965: Define method to check whether a backend_reg is inside a given range.
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp5
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp9
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h1
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 780be80e6a7..a57f501a37e 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 &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 51c965c4e77..0dda9bb823d 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -769,6 +769,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 944a8701aa3..8a3263e573d 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. */