summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-07-21 20:06:23 -0700
committerKenneth Graunke <[email protected]>2014-07-23 15:44:16 -0700
commit36a4a6bbdca0c30e16d56e6b406ea7c94831048f (patch)
tree66c96b9551b6c752f031d0c5fe945a21bcb6dd6f
parent8d2e95bd4b0f652aabddff53cb157eb002d415f0 (diff)
i965: Port INTEL_DEBUG=optimizer to the vec4 backend.
Largely via copy and paste. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp42
1 files changed, 36 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 045e1c5d413..9a73f8fa1a6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1668,15 +1668,45 @@ vec4_visitor::run()
move_push_constants_to_pull_constants();
split_virtual_grfs();
+ const char *stage_name = stage == MESA_SHADER_GEOMETRY ? "gs" : "vs";
+
+#define OPT(pass, args...) do { \
+ pass_num++; \
+ bool this_progress = pass(args); \
+ \
+ if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) { \
+ char filename[64]; \
+ snprintf(filename, 64, "%s-%04d-%02d-%02d-" #pass, \
+ stage_name, shader_prog->Name, iteration, pass_num); \
+ \
+ backend_visitor::dump_instructions(filename); \
+ } \
+ \
+ progress = progress || this_progress; \
+ } while (false)
+
+
+ if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
+ char filename[64];
+ snprintf(filename, 64, "%s-%04d-00-start",
+ stage_name, shader_prog->Name);
+
+ backend_visitor::dump_instructions(filename);
+ }
+
bool progress;
+ int iteration = 0;
do {
progress = false;
- progress = dead_code_eliminate() || progress;
- progress = dead_control_flow_eliminate(this) || progress;
- progress = opt_copy_propagation() || progress;
- progress = opt_algebraic() || progress;
- progress = opt_cse() || progress;
- progress = opt_register_coalesce() || progress;
+ iteration++;
+ int pass_num = 0;
+
+ OPT(dead_code_eliminate);
+ OPT(dead_control_flow_eliminate, this);
+ OPT(opt_copy_propagation);
+ OPT(opt_algebraic);
+ OPT(opt_cse);
+ OPT(opt_register_coalesce);
} while (progress);