ir: Give ir_instruction a print visitor helper.
authorEric Anholt <eric@anholt.net>
Tue, 22 Jun 2010 19:09:21 +0000 (12:09 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 23 Jun 2010 01:18:30 +0000 (18:18 -0700)
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.

ir.h
ir_constant_variable.cpp
ir_copy_propagation.cpp
ir_dead_code_local.cpp
ir_print_visitor.cpp
ir_vec_index_to_swizzle.cpp

diff --git a/ir.h b/ir.h
index d99453c602511866d8997f82d9d22597b7ac0782..7454947c97c10f93ef6b62391f91fff21c24993c 100644 (file)
--- 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;
 
index a905474d858f3695b18a5218467cbb176a16f318..ef5e1e418e54071010e2bd3dd917796b0437ef80 100644 (file)
@@ -33,7 +33,6 @@
  */
 
 #include "ir.h"
-#include "ir_print_visitor.h"
 #include "ir_visitor.h"
 #include "ir_optimization.h"
 #include "glsl_types.h"
index da5998109ff4000df200a264d6822c9e1bf46b9b..16a2ba79bf6f562774663ce8fe21bee0cdb4bf51 100644 (file)
@@ -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"
index 344a6ebfbf5439ec6fc31a12c120fb66b231bf9a..d3b3858617d611e7105d47447951af4bc311ccaa 100644 (file)
@@ -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");
       }
 
index 40fac8803c10b972da68818acfbb3c93ed2e5926..60fb33e2f552cd170dd61b78e329d5cab7118540 100644 (file)
 
 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)");
index cb2f6ca4097f122e5f3b11eae0a86bf84709fb0e..eb0e556c9dba0576ddb293b53418806ba75d4aab 100644 (file)
@@ -32,7 +32,6 @@
 #include "ir.h"
 #include "ir_visitor.h"
 #include "ir_optimization.h"
-#include "ir_print_visitor.h"
 #include "glsl_types.h"
 
 /**