i965: Add non-mutating helper functions to modify the register offset.

Yes, we could avoid having four copies of essentially the same code by
using templates here.

Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
Francisco Jerez 2014-02-19 15:19:10 +01:00
parent af25addcd0
commit 2337820d49
2 changed files with 24 additions and 0 deletions

View File

@ -129,6 +129,14 @@ public:
fs_reg *reladdr;
};
static inline fs_reg
offset(fs_reg reg, unsigned delta)
{
assert(delta == 0 || (reg.file != HW_REG && reg.file != IMM));
reg.reg_offset += delta;
return reg;
}
static inline fs_reg
byte_offset(fs_reg reg, unsigned delta)
{

View File

@ -140,6 +140,14 @@ public:
src_reg *reladdr;
};
static inline src_reg
offset(src_reg reg, unsigned delta)
{
assert(delta == 0 || (reg.file != HW_REG && reg.file != IMM));
reg.reg_offset += delta;
return reg;
}
class dst_reg : public reg
{
public:
@ -160,6 +168,14 @@ public:
src_reg *reladdr;
};
static inline dst_reg
offset(dst_reg reg, unsigned delta)
{
assert(delta == 0 || (reg.file != HW_REG && reg.file != IMM));
reg.reg_offset += delta;
return reg;
}
dst_reg
with_writemask(dst_reg const &r, int mask);