diff options
author | Matt Turner <[email protected]> | 2014-03-27 09:40:58 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-04-05 09:47:37 -0700 |
commit | 29841fbe201e4943531cd6d4412166bf29bbc263 (patch) | |
tree | b5f96de500059e982bd8b9c95e9be2de5ec1a97f | |
parent | 0fbcdec2f6d6fd98db82c680d8bae8eee77ff9f2 (diff) |
i965/fs: Split out is_coalesce_candidate() function.
Reviewed-by: Anuj Phogat <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | 37 |
1 files changed, 23 insertions, 14 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 74b22b97266..ca9376f8a77 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp @@ -43,6 +43,28 @@ #include "brw_fs.h" #include "brw_fs_live_variables.h" +static bool +is_coalesce_candidate(const fs_inst *inst, const int *virtual_grf_sizes) +{ + if (inst->opcode != BRW_OPCODE_MOV || + inst->is_partial_write() || + inst->saturate || + inst->src[0].file != GRF || + inst->src[0].negate || + inst->src[0].abs || + !inst->src[0].is_contiguous() || + inst->dst.file != GRF || + inst->dst.type != inst->src[0].type) { + return false; + } + + if (virtual_grf_sizes[inst->src[0].reg] > + virtual_grf_sizes[inst->dst.reg]) + return false; + + return true; +} + bool fs_visitor::register_coalesce() { @@ -59,20 +81,7 @@ fs_visitor::register_coalesce() foreach_list(node, &this->instructions) { fs_inst *inst = (fs_inst *)node; - if (inst->opcode != BRW_OPCODE_MOV || - inst->is_partial_write() || - inst->saturate || - inst->src[0].file != GRF || - inst->src[0].negate || - inst->src[0].abs || - !inst->src[0].is_contiguous() || - inst->dst.file != GRF || - inst->dst.type != inst->src[0].type) { - continue; - } - - if (virtual_grf_sizes[inst->src[0].reg] > - virtual_grf_sizes[inst->dst.reg]) + if (!is_coalesce_candidate(inst, virtual_grf_sizes)) continue; int var_from = live_intervals->var_from_reg(&inst->src[0]); |