aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-06-06 10:57:54 -0700
committerEric Anholt <[email protected]>2012-07-03 12:55:47 -0700
commit458f7f014139deb48a4cf0a9e6bdca3a57d24208 (patch)
tree0332e6b946da7d63afdf07f92f500fa041820f4d /src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
parent5fb178ee43fbc364b150fe6c6f0f79e8d8b0b179 (diff)
i965/fs: Move copy propagation test out to a separate function.
It's going to get more complicated in a moment. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 23960514bf0..d510e5b3609 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -31,6 +31,21 @@ struct acp_entry : public exec_node {
};
}
+bool
+fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
+{
+ if (inst->src[arg].file != entry->dst.file ||
+ inst->src[arg].reg != entry->dst.reg ||
+ inst->src[arg].reg_offset != entry->dst.reg_offset) {
+ return false;
+ }
+
+ inst->src[arg].reg = entry->src.reg;
+ inst->src[arg].reg_offset = entry->src.reg_offset;
+
+ return true;
+}
+
/** @file brw_fs_copy_propagation.cpp
*
* Support for local copy propagation by walking the list of instructions
@@ -58,13 +73,8 @@ fs_visitor::opt_copy_propagate_local(void *mem_ctx,
acp_entry *entry = (acp_entry *)entry_node;
for (int i = 0; i < 3; i++) {
- if (inst->src[i].file == entry->dst.file &&
- inst->src[i].reg == entry->dst.reg &&
- inst->src[i].reg_offset == entry->dst.reg_offset) {
- inst->src[i].reg = entry->src.reg;
- inst->src[i].reg_offset = entry->src.reg_offset;
+ if (try_copy_propagate(inst, i, entry))
progress = true;
- }
}
}