From: Eric Anholt Date: Tue, 22 Jun 2010 19:09:21 +0000 (-0700) Subject: ir: Give ir_instruction a print visitor helper. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e46a454305af64710ce8deadafc718f75363ac7e;p=mesa.git 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. --- diff --git a/ir.h b/ir.h index d99453c6025..7454947c97c 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 a905474d858..ef5e1e418e5 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 da5998109ff..16a2ba79bf6 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 344a6ebfbf5..d3b3858617d 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 40fac8803c1..60fb33e2f55 100644 --- a/ir_print_visitor.cpp +++ b/ir_print_visitor.cpp @@ -27,6 +27,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 cb2f6ca4097..eb0e556c9db 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" /**