IR print visitor: Move logic for printing the whole program to _mesa_print_ir
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 28 Apr 2010 20:04:15 +0000 (13:04 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Apr 2010 01:22:54 +0000 (18:22 -0700)
glsl_parser_extras.cpp
ir_print_visitor.cpp
ir_print_visitor.h

index efcb125..4255d2d 100644 (file)
@@ -789,14 +789,7 @@ main(int argc, char **argv)
    printf("\n\n");
 
    if (!state.error) {
-      printf("(\n");
-      foreach_iter(exec_list_iterator, iter, instructions) {
-        ir_print_visitor v;
-
-        ((ir_instruction *)iter.get())->accept(& v);
-        printf("\n");
-      }
-      printf("\n)");
+      _mesa_print_ir(&instructions, &state);
    }
 
    delete state.symbols;
index f1108c6..272e892 100644 (file)
 #include "ir_print_visitor.h"
 #include "glsl_types.h"
 
+void
+_mesa_print_ir(exec_list *instructions,
+              struct _mesa_glsl_parse_state *state)
+{
+   (void) state;
+
+   printf("(\n");
+   foreach_iter(exec_list_iterator, iter, *instructions) {
+      ir_print_visitor v;
+
+      ((ir_instruction *)iter.get())->accept(& v);
+      printf("\n");
+   }
+   printf("\n)");
+}
+
 static void
 print_type(const glsl_type *t)
 {
index b241f92..aeee538 100644 (file)
@@ -29,6 +29,9 @@
 #include "ir.h"
 #include "ir_visitor.h"
 
+extern void _mesa_print_ir(exec_list *instructions,
+                          struct _mesa_glsl_parse_state *state);
+
 /**
  * Abstract base class of visitors of IR instruction trees
  */