glsl: Remove ir_print_visitor.h includes and usage
authorEric Anholt <eric@anholt.net>
Wed, 12 Jun 2013 23:21:28 +0000 (16:21 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 21 Jun 2013 17:04:29 +0000 (10:04 -0700)
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 <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
18 files changed:
src/glsl/ir_rvalue_visitor.cpp
src/glsl/main.cpp
src/glsl/opt_array_splitting.cpp
src/glsl/opt_noop_swizzle.cpp
src/glsl/opt_structure_splitting.cpp
src/glsl/test_optpass.cpp
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_emit.cpp
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
src/mesa/main/ff_fragment_shader.cpp
src/mesa/program/ir_to_mesa.cpp
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 3504a4dda4db027f3e5bd5de42e07467884e4ba1..8eb1c62c30ab98600fca470e2a36f5cffdeafc0b 100644 (file)
@@ -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
index d7e35bcb3a2916071a964d3ce8ddca246544879f..5713ee5dc2f76bfee92d4e6968eaf8593a8f1f68 100644 (file)
@@ -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"
index 67733ca6ba6895d72db149b8f59e42f8c7cfe5d7..f4a7ef99bcd903c5f54438b9cc36b15c24168de5 100644 (file)
@@ -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;
index 693719e3dc790046620cf8f7e534aaa835c5e6af..586ad5e6107bf69a2e35a1cac81748aa496b5c5c 100644 (file)
@@ -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 {
index 806c079e585da3c36c691c97a3e4ca544dd81e15..9f4b3dd8ff574fb9627f2a347c5e61a1b979ebe4 100644 (file)
@@ -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"
 
index fc10cbbde5734a0e3d494a7d7b07b5a7270460f3..67e2ab2b15c02092791996ba608c18a800ffa6ab 100644 (file)
@@ -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"
index 7f8edff57eca24918439ac36a08a746195e49858..97cd291f97427d91084afa9c58a935d6c5fb4fc2 100644 (file)
@@ -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()
index 9e1cf4a2b62fd86f005d3d8bda4975ef06bda618..f3909891c457a5d79a95c6289d7da9577669c670 100644 (file)
@@ -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,
index acd98466860d95631d090351892b8f8d1bdeab33..be55533f378ca11426843b0e9b6129817ce445cb 100644 (file)
@@ -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)
index b9487532c59f5bbc89a1b8491b07a0d0756d5047..e5c8372aeed2a86f6268dc5e742537ad2231630a 100644 (file)
@@ -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"
 
index 9bb15d037c164c13a267113e03a1c43c2b3f02e3..a67b6ed21fcf654e5a8fbc1ac5ece1bd96937627 100644 (file)
@@ -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;
 
index ccedee3ba58f87cd64bcc003ead22cd73f5b78bd..2b2706ff0b6652a1f38439f557496accff67d560 100644 (file)
@@ -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;
 
index 03e432970232ba555c94c66ecf7acbbb3f1405d6..65df93165065168962e41ee462f300dbe1429a46 100644 (file)
@@ -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)
index 4295e6e151368ca369fc7093b26ad0159c6437b0..eb192a3df9bbc803d2c58cba9761a5969d4f82d4 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "brw_vec4.h"
 #include "brw_cfg.h"
-#include "glsl/ir_print_visitor.h"
 
 extern "C" {
 #include "main/macros.h"
index 7149d46b47f3546d025527f142ff7b043adba72a..abba0f2f9b5bc0b7c4c3302d481e49f3ed48d133 100644 (file)
@@ -27,7 +27,6 @@ extern "C" {
 } /* extern "C" */
 
 #include "brw_vec4.h"
-#include "glsl/ir_print_visitor.h"
 
 using namespace brw;
 
index d162da8db0c6878f6ae3a6db188f92a2ee6dfbc7..86317efcd5156d96492e4df11d2413566fd3345f 100644 (file)
@@ -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;
index a5b6699c2b674fd37247dec14e80f93339e6dc93..191e2911912012946a207a66c41eba045f354cbb 100644 (file)
@@ -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;
index d6796d7a11ea0f18c2685b845e8f7d6fa3ad47f2..4a68882603ff341af72de9c3983ab38d7c5608ef 100644 (file)
@@ -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;