From: Francisco Jerez Date: Wed, 18 Mar 2015 17:35:31 +0000 (+0200) Subject: i965: Define method to check whether a backend_reg is inside a given range. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74c7e5d35181d31e4448c614f6aa62c1e1f60694;p=mesa.git i965: Define method to check whether a backend_reg is inside a given range. Reviewed-by: Matt Turner --- 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 ®) 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 @@ -768,6 +768,15 @@ backend_reg::is_accumulator() const fixed_hw_reg.nr == BRW_ARF_ACCUMULATOR; } +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 { 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. */