summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-09-19 16:42:10 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2014-09-30 10:29:14 -0700
commit1030ee6e9b0cc6c05a7f25c17c0cf722a6731c89 (patch)
tree9ac9985b5dee422ed585d5f2298386ae8c275520
parentf91b566f55390d1a0e472ac970d017374b91ee83 (diff)
i965/fs: A little harmless refactoring of register_coalesce
Just pass the visitor into is_copy_payload() and is_coalesce_candidate() instead of a register size and the virtual_grf_sizes array. Among other things, this makes the code more obvious because you don't have to figure out where src_size came from. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
index 318bfa610d4..73f18f9d62b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -64,9 +64,9 @@ is_nop_mov(const fs_inst *inst)
}
static bool
-is_copy_payload(const fs_inst *inst, int src_size)
+is_copy_payload(const fs_visitor *v, const fs_inst *inst)
{
- if (src_size != inst->sources)
+ if (v->virtual_grf_sizes[inst->src[0].reg] != inst->regs_written)
return false;
const int reg = inst->src[0].reg;
@@ -83,7 +83,7 @@ is_copy_payload(const fs_inst *inst, int src_size)
}
static bool
-is_coalesce_candidate(const fs_inst *inst, const int *virtual_grf_sizes)
+is_coalesce_candidate(const fs_visitor *v, const fs_inst *inst)
{
if ((inst->opcode != BRW_OPCODE_MOV &&
inst->opcode != SHADER_OPCODE_LOAD_PAYLOAD) ||
@@ -98,12 +98,12 @@ is_coalesce_candidate(const fs_inst *inst, const int *virtual_grf_sizes)
return false;
}
- if (virtual_grf_sizes[inst->src[0].reg] >
- virtual_grf_sizes[inst->dst.reg])
+ if (v->virtual_grf_sizes[inst->src[0].reg] >
+ v->virtual_grf_sizes[inst->dst.reg])
return false;
if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
- if (!is_copy_payload(inst, virtual_grf_sizes[inst->src[0].reg])) {
+ if (!is_copy_payload(v, inst)) {
return false;
}
}
@@ -171,7 +171,7 @@ fs_visitor::register_coalesce()
int var_from[MAX_SAMPLER_MESSAGE_SIZE];
foreach_block_and_inst(block, fs_inst, inst, cfg) {
- if (!is_coalesce_candidate(inst, virtual_grf_sizes))
+ if (!is_coalesce_candidate(this, inst))
continue;
if (is_nop_mov(inst)) {