i965: Show opt_vector_float() and later passes in INTEL_DEBUG=optimizer.

In order to support calling opt_vector_float() inside a condition, this
patch makes OPT() a statement expression:

https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html

We've used that elsewhere already.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Kenneth Graunke 2014-12-31 16:47:25 -08:00
parent 61711316f5
commit 9b8bd67768
1 changed files with 12 additions and 8 deletions

View File

@ -1758,7 +1758,7 @@ vec4_visitor::run()
const char *stage_name = stage == MESA_SHADER_GEOMETRY ? "gs" : "vs"; const char *stage_name = stage == MESA_SHADER_GEOMETRY ? "gs" : "vs";
#define OPT(pass, args...) do { \ #define OPT(pass, args...) ({ \
pass_num++; \ pass_num++; \
bool this_progress = pass(args); \ bool this_progress = pass(args); \
\ \
@ -1771,7 +1771,8 @@ vec4_visitor::run()
} \ } \
\ \
progress = progress || this_progress; \ progress = progress || this_progress; \
} while (false) this_progress; \
})
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) { if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
@ -1784,10 +1785,11 @@ vec4_visitor::run()
bool progress; bool progress;
int iteration = 0; int iteration = 0;
int pass_num = 0;
do { do {
progress = false; progress = false;
pass_num = 0;
iteration++; iteration++;
int pass_num = 0;
OPT(opt_reduce_swizzle); OPT(opt_reduce_swizzle);
OPT(dead_code_eliminate); OPT(dead_code_eliminate);
@ -1798,11 +1800,13 @@ vec4_visitor::run()
OPT(opt_register_coalesce); OPT(opt_register_coalesce);
} while (progress); } while (progress);
if (opt_vector_float()) { pass_num = 0;
opt_cse();
opt_copy_propagation(false); if (OPT(opt_vector_float)) {
opt_copy_propagation(true); OPT(opt_cse);
dead_code_eliminate(); OPT(opt_copy_propagation, false);
OPT(opt_copy_propagation, true);
OPT(dead_code_eliminate);
} }
if (failed) if (failed)