[Mesa-dev] [PATCH 3/6] glsl: Remove ir_print_visitor.h includes and usage
Kenneth Graunke
kenneth at whitecape.org
Tue Jun 18 04:12:17 PDT 2013
On 06/17/2013 04:10 PM, Eric Anholt wrote:
> 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).
This is pretty obviously three separate changes:
- Fixing missing '\n' characters
- Converting from ir_print_visitor v; ir->accept(&v); to ir->print()
- Removing unnecessary #include files.
But that is being pedantic, so I'm not going to make you redo it. As
is, patches 1-3 are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/glsl/ir_rvalue_visitor.cpp | 1 -
> src/glsl/main.cpp | 1 -
> src/glsl/opt_array_splitting.cpp | 1 -
> src/glsl/opt_noop_swizzle.cpp | 1 -
> src/glsl/opt_structure_splitting.cpp | 1 -
> src/glsl/test_optpass.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_fs.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_fs_emit.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 5 ++---
> src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_shader.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 1 -
> src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp | 1 -
> src/mesa/main/ff_fragment_shader.cpp | 1 -
> src/mesa/program/ir_to_mesa.cpp | 9 ++++-----
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 ++---
> 18 files changed, 8 insertions(+), 26 deletions(-)
>
> diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp
> index 3504a4d..8eb1c62 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 d7e35bc..5713ee5 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 67733ca..f4a7ef9 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 693719e..586ad5e 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 806c079..9f4b3dd 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 fc10cbbd..67e2ab2 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 7f8edff..97cd291 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 9e1cf4a..f390989 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 acd9846..be55533 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 b948753..e5c8372 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 9bb15d0..a67b6ed 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 ccedee3..2b2706f 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 03e4329..65df931 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 4295e6e..eb192a3 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 7149d46..abba0f2 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 d162da8..86317ef 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 a5b6699..191e291 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 d6796d7..4a68882 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;
>
More information about the mesa-dev
mailing list