Also while we're touching var_from_reg, just make it an inline function.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
bool result_live = false;
if (inst->regs_written == 1) {
- int var = live_intervals->var_from_reg(&inst->dst);
+ int var = live_intervals->var_from_reg(inst->dst);
result_live = BITSET_TEST(live, var);
} else {
- int var = live_intervals->var_from_reg(&inst->dst);
+ int var = live_intervals->var_from_reg(inst->dst);
for (int i = 0; i < inst->regs_written; i++) {
result_live = result_live || BITSET_TEST(live, var + i);
}
if (inst->dst.file == GRF) {
if (!inst->is_partial_write()) {
- int var = live_intervals->var_from_reg(&inst->dst);
+ int var = live_intervals->var_from_reg(inst->dst);
for (int i = 0; i < inst->regs_written; i++) {
BITSET_CLEAR(live, var + i);
}
for (int i = 0; i < inst->sources; i++) {
if (inst->src[i].file == GRF) {
- int var = live_intervals->var_from_reg(&inst->src[i]);
+ int var = live_intervals->var_from_reg(inst->src[i]);
for (int j = 0; j < inst->regs_read(this, i); j++) {
BITSET_SET(live, var + j);
void
fs_live_variables::setup_one_read(struct block_data *bd, fs_inst *inst,
- int ip, fs_reg reg)
+ int ip, const fs_reg ®)
{
- int var = var_from_reg(®);
+ int var = var_from_reg(reg);
assert(var < num_vars);
/* In most cases, a register can be written over safely by the
void
fs_live_variables::setup_one_write(struct block_data *bd, fs_inst *inst,
- int ip, fs_reg reg)
+ int ip, const fs_reg ®)
{
- int var = var_from_reg(®);
+ int var = var_from_reg(reg);
assert(var < num_vars);
start[var] = MIN2(start[var], ip);
}
}
-int
-fs_live_variables::var_from_reg(fs_reg *reg)
-{
- return var_from_vgrf[reg->reg] + reg->reg_offset;
-}
-
fs_live_variables::fs_live_variables(fs_visitor *v, const cfg_t *cfg)
: v(v), cfg(cfg)
{
~fs_live_variables();
bool vars_interfere(int a, int b);
- int var_from_reg(fs_reg *reg);
+ int var_from_reg(const fs_reg ®) const
+ {
+ return var_from_vgrf[reg.reg] + reg.reg_offset;
+ }
/** Map from virtual GRF number to index in block_data arrays. */
int *var_from_vgrf;
protected:
void setup_def_use();
- void setup_one_read(struct block_data *bd, fs_inst *inst, int ip, fs_reg reg);
- void setup_one_write(struct block_data *bd, fs_inst *inst, int ip, fs_reg reg);
+ void setup_one_read(struct block_data *bd, fs_inst *inst, int ip,
+ const fs_reg ®);
+ void setup_one_write(struct block_data *bd, fs_inst *inst, int ip,
+ const fs_reg ®);
void compute_live_variables();
void compute_start_end();
!inst->saturate)
continue;
- int src_var = v->live_intervals->var_from_reg(&inst->src[0]);
+ int src_var = v->live_intervals->var_from_reg(inst->src[0]);
int src_end_ip = v->live_intervals->end[src_var];
bool interfered = false;