From: Eric Anholt Date: Wed, 12 Jun 2013 23:21:28 +0000 (-0700) Subject: glsl: Remove ir_print_visitor.h includes and usage X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=426ca34b7a2c3b9edfc0189daece8de3aff80627;p=mesa.git glsl: Remove ir_print_visitor.h includes and usage We have ir->print() to do the old declaration of a visitor and having the IR accept the visitor (yuck!). And now you can call _mesa_print_ir() safely anywhere that you know what an ir_instruction is. A couple of missing printf("\n")s are added in error paths -- when an expression is handed to the visitor, it doesn't print '\n' (since it might be a step in printing a whole expression tree). Reviewed-by: Kenneth Graunke Reviewed-by: Paul Berry --- diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp index 3504a4dda4d..8eb1c62c30a 100644 --- a/src/glsl/ir_rvalue_visitor.cpp +++ b/src/glsl/ir_rvalue_visitor.cpp @@ -32,7 +32,6 @@ #include "ir.h" #include "ir_visitor.h" #include "ir_rvalue_visitor.h" -#include "ir_print_visitor.h" #include "glsl_types.h" ir_visitor_status diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index d7e35bcb3a2..5713ee5dc2f 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -34,7 +34,6 @@ #include "ast.h" #include "glsl_parser_extras.h" #include "ir_optimization.h" -#include "ir_print_visitor.h" #include "program.h" #include "loop_analysis.h" #include "standalone_scaffolding.h" diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index 67733ca6ba6..f4a7ef99bcd 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -36,7 +36,6 @@ #include "ir.h" #include "ir_visitor.h" #include "ir_rvalue_visitor.h" -#include "ir_print_visitor.h" #include "glsl_types.h" static bool debug = false; diff --git a/src/glsl/opt_noop_swizzle.cpp b/src/glsl/opt_noop_swizzle.cpp index 693719e3dc7..586ad5e6107 100644 --- a/src/glsl/opt_noop_swizzle.cpp +++ b/src/glsl/opt_noop_swizzle.cpp @@ -32,7 +32,6 @@ #include "ir.h" #include "ir_visitor.h" #include "ir_rvalue_visitor.h" -#include "ir_print_visitor.h" #include "glsl_types.h" namespace { diff --git a/src/glsl/opt_structure_splitting.cpp b/src/glsl/opt_structure_splitting.cpp index 806c079e585..9f4b3dd8ff5 100644 --- a/src/glsl/opt_structure_splitting.cpp +++ b/src/glsl/opt_structure_splitting.cpp @@ -34,7 +34,6 @@ #include "ir.h" #include "ir_visitor.h" -#include "ir_print_visitor.h" #include "ir_rvalue_visitor.h" #include "glsl_types.h" diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp index fc10cbbde57..67e2ab2b15c 100644 --- a/src/glsl/test_optpass.cpp +++ b/src/glsl/test_optpass.cpp @@ -39,7 +39,6 @@ #include "ast.h" #include "ir_optimization.h" -#include "ir_print_visitor.h" #include "program.h" #include "ir_reader.h" #include "standalone_scaffolding.h" diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 7f8edff57ec..97cd291f974 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -48,7 +48,6 @@ extern "C" { } #include "brw_fs.h" #include "glsl/glsl_types.h" -#include "glsl/ir_print_visitor.h" void fs_inst::init() diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp index 9e1cf4a2b62..f3909891c45 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp @@ -35,7 +35,6 @@ extern "C" { #include "brw_fs.h" #include "brw_cfg.h" -#include "glsl/ir_print_visitor.h" fs_generator::fs_generator(struct brw_context *brw, struct brw_wm_compile *c, diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp index acd98466860..be55533f378 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp @@ -28,7 +28,6 @@ #include "brw_fs.h" #include "glsl/glsl_types.h" #include "glsl/ir_optimization.h" -#include "glsl/ir_print_visitor.h" static void assign_reg(int *reg_hw_locations, fs_reg *reg, int reg_width) diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp index b9487532c59..e5c8372aeed 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp @@ -43,7 +43,6 @@ extern "C" { } #include "glsl/ir.h" #include "glsl/ir_visitor.h" -#include "glsl/ir_print_visitor.h" #include "glsl/ir_rvalue_visitor.h" #include "glsl/glsl_types.h" diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 9bb15d037c1..a67b6ed21fc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -47,7 +47,6 @@ extern "C" { #include "brw_fs.h" #include "glsl/glsl_types.h" #include "glsl/ir_optimization.h" -#include "glsl/ir_print_visitor.h" void fs_visitor::visit(ir_variable *ir) @@ -333,9 +332,9 @@ fs_visitor::visit(ir_expression *ir) for (operand = 0; operand < ir->get_num_operands(); operand++) { ir->operands[operand]->accept(this); if (this->result.file == BAD_FILE) { - ir_print_visitor v; fail("Failed to get tree for expression operand:\n"); - ir->operands[operand]->accept(&v); + ir->operands[operand]->print(); + printf("\n"); } op[operand] = this->result; diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp index ccedee3ba58..2b2706ff0b6 100644 --- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp +++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp @@ -29,7 +29,6 @@ #include "brw_vec4.h" #include "glsl/glsl_types.h" #include "glsl/ir_optimization.h" -#include "glsl/ir_print_visitor.h" using namespace brw; diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 03e43297023..65df9316506 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -28,7 +28,6 @@ extern "C" { } #include "brw_fs.h" #include "glsl/ir_optimization.h" -#include "glsl/ir_print_visitor.h" struct gl_shader * brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 4295e6e1513..eb192a3df9b 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -23,7 +23,6 @@ #include "brw_vec4.h" #include "brw_cfg.h" -#include "glsl/ir_print_visitor.h" extern "C" { #include "main/macros.h" diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp index 7149d46b47f..abba0f2f9b5 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp @@ -27,7 +27,6 @@ extern "C" { } /* extern "C" */ #include "brw_vec4.h" -#include "glsl/ir_print_visitor.h" using namespace brw; diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index d162da8db0c..86317efcd51 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -51,7 +51,6 @@ extern "C" { #include "../glsl/glsl_symbol_table.h" #include "../glsl/glsl_parser_extras.h" #include "../glsl/ir_optimization.h" -#include "../glsl/ir_print_visitor.h" #include "../program/ir_to_mesa.h" using namespace ir_builder; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index a5b6699c2b6..191e2911912 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -33,7 +33,6 @@ #include "main/compiler.h" #include "ir.h" #include "ir_visitor.h" -#include "ir_print_visitor.h" #include "ir_expression_flattening.h" #include "ir_uniform.h" #include "glsl_types.h" @@ -1057,9 +1056,9 @@ ir_to_mesa_visitor::emit_swz(ir_expression *ir) this->result.file = PROGRAM_UNDEFINED; deref->accept(this); if (this->result.file == PROGRAM_UNDEFINED) { - ir_print_visitor v; printf("Failed to get tree for expression operand:\n"); - deref->accept(&v); + deref->print(); + printf("\n"); exit(1); } @@ -1129,9 +1128,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir) this->result.file = PROGRAM_UNDEFINED; ir->operands[operand]->accept(this); if (this->result.file == PROGRAM_UNDEFINED) { - ir_print_visitor v; printf("Failed to get tree for expression operand:\n"); - ir->operands[operand]->accept(&v); + ir->operands[operand]->print(); + printf("\n"); exit(1); } op[operand] = this->result; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index d6796d7a11e..4a68882603f 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -34,7 +34,6 @@ #include "main/compiler.h" #include "ir.h" #include "ir_visitor.h" -#include "ir_print_visitor.h" #include "ir_expression_flattening.h" #include "glsl_types.h" #include "glsl_parser_extras.h" @@ -1396,9 +1395,9 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) this->result.file = PROGRAM_UNDEFINED; ir->operands[operand]->accept(this); if (this->result.file == PROGRAM_UNDEFINED) { - ir_print_visitor v; printf("Failed to get tree for expression operand:\n"); - ir->operands[operand]->accept(&v); + ir->operands[operand]->print(); + printf("\n"); exit(1); } op[operand] = this->result;