diff options
author | Eric Anholt <[email protected]> | 2010-08-05 12:07:23 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-08-05 12:56:02 -0700 |
commit | 3bd7e70bf7c4a9a52b425284c9f23689f00de93c (patch) | |
tree | ade4647b29ef1dcfffde102af602657eaf0cf9b5 | |
parent | e995f0e10c9ee51f7c8f8fa2193ff99e1b49e40d (diff) |
glsl2: Add some easy-to-enable debug printfs to ir_dead_code.cpp.
-rw-r--r-- | src/glsl/ir_dead_code.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/glsl/ir_dead_code.cpp b/src/glsl/ir_dead_code.cpp index bf032f1dc21..a8d264f39a9 100644 --- a/src/glsl/ir_dead_code.cpp +++ b/src/glsl/ir_dead_code.cpp @@ -32,6 +32,8 @@ #include "ir_variable_refcount.h" #include "glsl_types.h" +static bool debug = false; + /** * Do a dead code pass over instructions and everything that instructions * references. @@ -60,6 +62,13 @@ do_dead_code(exec_list *instructions) */ assert(entry->referenced_count >= entry->assigned_count); + if (debug) { + printf("%s@%p: %d refs, %d assigns, %sdeclared in our scope\n", + entry->var->name, entry->var, + entry->referenced_count, entry->assigned_count, + entry->declaration ? "" : "not "); + } + if ((entry->referenced_count > entry->assigned_count) || !entry->declaration) continue; @@ -72,6 +81,11 @@ do_dead_code(exec_list *instructions) entry->var->mode != ir_var_inout) { entry->assign->remove(); progress = true; + + if (debug) { + printf("Removed assignment to %s@%p\n", + entry->var->name, entry->var); + } } } else { /* If there are no assignments or references to the variable left, @@ -79,6 +93,11 @@ do_dead_code(exec_list *instructions) */ entry->var->remove(); progress = true; + + if (debug) { + printf("Removed declaration of %s@%p\n", + entry->var->name, entry->var); + } } } talloc_free(v.mem_ctx); |