i965: Define method to check whether a backend_reg is inside a given range.

Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Francisco Jerez 2015-03-18 19:35:31 +02:00
parent bf6eb37e0b
commit 74c7e5d351
3 changed files with 11 additions and 4 deletions

View file

@ -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

View file

@ -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
{

View file

@ -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. */