summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-06-22 12:09:21 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-06-22 18:18:30 -0700
commite46a454305af64710ce8deadafc718f75363ac7e (patch)
tree7119b50e95dff28694865fb574270d2c42ac1634
parent216580dbd733aa2e64df4ca95e37a0eb102c6ede (diff)
ir: Give ir_instruction a print visitor helper.
This avoids spamming each file with includes of ir_print_visitor.h because someone was doing debugging at some point, and is less typing when doing debugging.
-rw-r--r--ir.h4
-rw-r--r--ir_constant_variable.cpp1
-rw-r--r--ir_copy_propagation.cpp1
-rw-r--r--ir_dead_code_local.cpp4
-rw-r--r--ir_print_visitor.cpp11
-rw-r--r--ir_vec_index_to_swizzle.cpp1
6 files changed, 13 insertions, 9 deletions
diff --git a/ir.h b/ir.h
index d99453c602..7454947c97 100644
--- a/ir.h
+++ b/ir.h
@@ -45,6 +45,10 @@ public:
const struct glsl_type *type;
class ir_constant *constant_expression_value();
+
+ /** ir_print_visitor helper for debugging. */
+ void print(void);
+
virtual void accept(ir_visitor *) = 0;
virtual ir_visitor_status accept(ir_hierarchical_visitor *) = 0;
diff --git a/ir_constant_variable.cpp b/ir_constant_variable.cpp
index a905474d85..ef5e1e418e 100644
--- a/ir_constant_variable.cpp
+++ b/ir_constant_variable.cpp
@@ -33,7 +33,6 @@
*/
#include "ir.h"
-#include "ir_print_visitor.h"
#include "ir_visitor.h"
#include "ir_optimization.h"
#include "glsl_types.h"
diff --git a/ir_copy_propagation.cpp b/ir_copy_propagation.cpp
index da5998109f..16a2ba79bf 100644
--- a/ir_copy_propagation.cpp
+++ b/ir_copy_propagation.cpp
@@ -34,7 +34,6 @@
#include "ir.h"
#include "ir_visitor.h"
-#include "ir_print_visitor.h"
#include "ir_basic_block.h"
#include "ir_optimization.h"
#include "glsl_types.h"
diff --git a/ir_dead_code_local.cpp b/ir_dead_code_local.cpp
index 344a6ebfbf..d3b3858617 100644
--- a/ir_dead_code_local.cpp
+++ b/ir_dead_code_local.cpp
@@ -34,7 +34,6 @@
*/
#include "ir.h"
-#include "ir_print_visitor.h"
#include "ir_basic_block.h"
#include "ir_optimization.h"
#include "glsl_types.h"
@@ -192,8 +191,7 @@ dead_code_local_basic_block(ir_instruction *first,
ir_assignment *ir_assign = ir->as_assignment();
if (debug) {
- ir_print_visitor v;
- ir->accept(&v);
+ ir->print();
printf("\n");
}
diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp
index 40fac8803c..60fb33e2f5 100644
--- a/ir_print_visitor.cpp
+++ b/ir_print_visitor.cpp
@@ -28,6 +28,13 @@
static void print_type(const glsl_type *t);
void
+ir_instruction::print(void)
+{
+ ir_print_visitor v;
+ accept(&v);
+}
+
+void
_mesa_print_ir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
@@ -48,9 +55,7 @@ _mesa_print_ir(exec_list *instructions,
printf("(\n");
foreach_iter(exec_list_iterator, iter, *instructions) {
- ir_print_visitor v;
-
- ((ir_instruction *)iter.get())->accept(& v);
+ ((ir_instruction *)iter.get())->print();
printf("\n");
}
printf("\n)");
diff --git a/ir_vec_index_to_swizzle.cpp b/ir_vec_index_to_swizzle.cpp
index cb2f6ca409..eb0e556c9d 100644
--- a/ir_vec_index_to_swizzle.cpp
+++ b/ir_vec_index_to_swizzle.cpp
@@ -32,7 +32,6 @@
#include "ir.h"
#include "ir_visitor.h"
#include "ir_optimization.h"
-#include "ir_print_visitor.h"
#include "glsl_types.h"
/**