i965: Make dump_instructions be a virtual method of the visitor.
authorEric Anholt <eric@anholt.net>
Mon, 29 Apr 2013 21:21:14 +0000 (14:21 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 2 May 2013 22:54:26 +0000 (15:54 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h

index a8610eea92ac60b481db741b326cef31b8dd6c59..9a764089a64a90ee732d24908ade8ac491d357b8 100644 (file)
@@ -2665,8 +2665,10 @@ fs_visitor::lower_uniform_pull_constant_loads()
 }
 
 void
-fs_visitor::dump_instruction(fs_inst *inst)
+fs_visitor::dump_instruction(backend_instruction *be_inst)
 {
+   fs_inst *inst = (fs_inst *)be_inst;
+
    if (inst->predicate) {
       printf("(%cf0.%d) ",
              inst->predicate_inverse ? '-' : '+',
@@ -2769,17 +2771,6 @@ fs_visitor::dump_instruction(fs_inst *inst)
    printf("\n");
 }
 
-void
-fs_visitor::dump_instructions()
-{
-   int ip = 0;
-   foreach_list(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
-      printf("%d: ", ip++);
-      dump_instruction(inst);
-   }
-}
-
 /**
  * Possibly returns an instruction that set up @param reg.
  *
index c9c9856748d8e68645c8442f7188d53cf148ccbe..bf7635779b20fd6a37906e7357d589bd749e8d82 100644 (file)
@@ -422,8 +422,7 @@ public:
    void setup_builtin_uniform_values(ir_variable *ir);
    int implied_mrf_writes(fs_inst *inst);
 
-   void dump_instructions();
-   void dump_instruction(fs_inst *inst);
+   void dump_instruction(backend_instruction *inst);
 
    struct gl_fragment_program *fp;
    struct brw_wm_compile *c;
index 75468b1d194a117d20d923ed48ee18f933de244c..3c63ba36aeb4f2f5948be079b1e66b3953bec0dd 100644 (file)
@@ -552,3 +552,14 @@ backend_instruction::is_control_flow()
       return false;
    }
 }
+
+void
+backend_visitor::dump_instructions()
+{
+   int ip = 0;
+   foreach_list(node, &this->instructions) {
+      backend_instruction *inst = (backend_instruction *)node;
+      printf("%d: ", ip++);
+      dump_instruction(inst);
+   }
+}
index 5189fdcb07e6716c25302dae259ddeebea072e29..4b2b399c62e6f1f9b8f689f93271b08561710103 100644 (file)
@@ -56,6 +56,9 @@ public:
     * backend_instruction)
     */
    exec_list instructions;
+
+   virtual void dump_instruction(backend_instruction *inst) = 0;
+   void dump_instructions();
 };
 
 int brw_type_for_base_type(const struct glsl_type *type);
index ab4668f425fd6775284f58681ddb53a86bc1ebff..a3ae4a155a1068b844e7f49ec846dbd7d99b675e 100644 (file)
@@ -1064,8 +1064,10 @@ vec4_visitor::split_virtual_grfs()
 }
 
 void
-vec4_visitor::dump_instruction(vec4_instruction *inst)
+vec4_visitor::dump_instruction(backend_instruction *be_inst)
 {
+   vec4_instruction *inst = (vec4_instruction *)be_inst;
+
    printf("%s ", brw_instruction_name(inst->opcode));
 
    switch (inst->dst.file) {
@@ -1146,17 +1148,6 @@ vec4_visitor::dump_instruction(vec4_instruction *inst)
    printf("\n");
 }
 
-void
-vec4_visitor::dump_instructions()
-{
-   int ip = 0;
-   foreach_list_safe(node, &this->instructions) {
-      vec4_instruction *inst = (vec4_instruction *)node;
-      printf("%d: ", ip++);
-      dump_instruction(inst);
-   }
-}
-
 /**
  * Replace each register of type ATTR in this->instructions with a reference
  * to a fixed HW register.
index a4fca2d732aee81e31161536f43a5977ec0360cc..cb97a863bc30cba6e4c7b999ae3961faa7a96641 100644 (file)
@@ -477,8 +477,7 @@ public:
 
    bool process_move_condition(ir_rvalue *ir);
 
-   void dump_instruction(vec4_instruction *inst);
-   void dump_instructions();
+   void dump_instruction(backend_instruction *inst);
 
 protected:
    void emit_vertex();