From: Ian Romanick Date: Wed, 28 Apr 2010 20:04:15 +0000 (-0700) Subject: IR print visitor: Move logic for printing the whole program to _mesa_print_ir X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=36d8a64a95354d09685e65c5e721038ff81b6d1f;p=mesa.git IR print visitor: Move logic for printing the whole program to _mesa_print_ir --- diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index efcb125dfc5..4255d2d66e7 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -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; diff --git a/ir_print_visitor.cpp b/ir_print_visitor.cpp index f1108c6fe41..272e892a1ec 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -24,6 +24,22 @@ #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) { diff --git a/ir_print_visitor.h b/ir_print_visitor.h index b241f92e040..aeee538df29 100644 --- a/ir_print_visitor.h +++ b/ir_print_visitor.h @@ -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 */