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 efcb125dfc54a5d4762a9b35dbaa8d2eb66f4128..4255d2d66e77c928542f924733a4fda16a2794f9 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 f1108c6fe418d9e074a8547163afb8b8f3facacc..272e892a1ec65c50715ac977a7d6bc64c4403488 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 b241f92e04067b7fa9bca9fe34fbbe293e8f4f85..aeee538df291563035fdb983e5143ef5e0fc04f0 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
  */