diff options
author | Matt Turner <[email protected]> | 2014-10-29 13:58:45 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-12-01 16:42:13 -0800 |
commit | b37273b92431a2d986235774f04a9fba2aa1bf74 (patch) | |
tree | 60e2fe60bb77359d6d6cf8aa739ae1190d65a564 | |
parent | 60d507c3c5c7caed57119df0ab4d824ad1ea85dc (diff) |
i965/fs: Use const fs_reg & rather than a copy or pointer.
Also while we're touching var_from_reg, just make it an inline function.
Reviewed-by: Kenneth Graunke <[email protected]>
4 files changed, 17 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp index fa471829e8e..81be4def30b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp @@ -56,10 +56,10 @@ fs_visitor::dead_code_eliminate() 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); } @@ -87,7 +87,7 @@ fs_visitor::dead_code_eliminate() 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); } @@ -100,7 +100,7 @@ fs_visitor::dead_code_eliminate() 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); diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp index 2512b799f03..189a119025d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp @@ -54,9 +54,9 @@ using namespace brw; 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 @@ -106,9 +106,9 @@ fs_live_variables::setup_one_read(struct block_data *bd, fs_inst *inst, 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); @@ -273,12 +273,6 @@ fs_live_variables::compute_start_end() } } -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) { diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.h b/src/mesa/drivers/dri/i965/brw_fs_live_variables.h index 2bfb583233e..a52f922d959 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.h +++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.h @@ -66,7 +66,10 @@ public: ~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; @@ -96,8 +99,10 @@ public: 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(); diff --git a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp index 347a78e5efd..a4145ac27d9 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp @@ -45,7 +45,7 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block) !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; |