[Mesa-dev] [PATCH] vc4: Fix failed instruction path of QIR validate pass

Rhys Kidd rhyskidd at gmail.com
Fri May 20 03:17:20 UTC 2016


Correct use of qir_dump_inst() within QIR validate pass.

Reported by the following GCC warning:

mesa/src/gallium/drivers/vc4/vc4_qir_validate.c: In function 'fail_instr':
mesa/src/gallium/drivers/vc4/vc4_qir_validate.c:31:23: warning: passing argument 1 of 'qir_dump_inst' from incompatible pointer type
         qir_dump_inst(stderr, inst);
                       ^
In file included from mesa/src/gallium/drivers/vc4/vc4_qir_validate.c:24:0:
mesa/src/gallium/drivers/vc4/vc4_qir.h:489:6: note: expected 'struct vc4_compile *' but argument is of type 'struct _IO_FILE *'
 void qir_dump_inst(struct vc4_compile *c, struct qinst *inst);
      ^

Introduced in 8e2d0843c02daf5280184f179ae8ed440ac90d7f.

Signed-off-by: Rhys Kidd <rhyskidd at gmail.com>
---
 src/gallium/drivers/vc4/vc4_qir_validate.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_qir_validate.c b/src/gallium/drivers/vc4/vc4_qir_validate.c
index af2e3ba..da6457c 100644
--- a/src/gallium/drivers/vc4/vc4_qir_validate.c
+++ b/src/gallium/drivers/vc4/vc4_qir_validate.c
@@ -25,10 +25,10 @@
 #include "vc4_qpu.h"
 
 static void
-fail_instr(struct qinst *inst, const char *msg)
+fail_instr(struct vc4_compile *c, struct qinst *inst, const char *msg)
 {
         fprintf(stderr, "qir_validate: %s: ", msg);
-        qir_dump_inst(stderr, inst);
+        qir_dump_inst(c, inst);
         fprintf(stderr, "\n");
         abort();
 }
@@ -50,18 +50,18 @@ void qir_validate(struct vc4_compile *c)
                 struct qinst *def = c->defs[i];
 
                 if (def && def->cond != QPU_COND_ALWAYS)
-                        fail_instr(def, "SSA def with condition");
+                        fail_instr(c, def, "SSA def with condition");
         }
 
         list_for_each_entry(struct qinst, inst, &c->instructions, link) {
                 switch (inst->dst.file) {
                 case QFILE_TEMP:
                         if (inst->dst.index >= c->num_temps)
-                                fail_instr(inst, "bad temp index");
+                                fail_instr(c, inst, "bad temp index");
 
                         if (c->defs[inst->dst.index] &&
                             already_assigned[inst->dst.index]) {
-                                fail_instr(inst, "Re-assignment of SSA value");
+                                fail_instr(c, inst, "Re-assignment of SSA value");
                         }
                         already_assigned[inst->dst.index] = true;
                         break;
@@ -81,7 +81,7 @@ void qir_validate(struct vc4_compile *c)
                 case QFILE_FRAG_REV_FLAG:
                 case QFILE_SMALL_IMM:
                 case QFILE_LOAD_IMM:
-                        fail_instr(inst, "Bad dest file");
+                        fail_instr(c, inst, "Bad dest file");
                         break;
                 }
 
@@ -91,7 +91,7 @@ void qir_validate(struct vc4_compile *c)
                         switch (src.file) {
                         case QFILE_TEMP:
                                 if (src.index >= c->num_temps)
-                                        fail_instr(inst, "bad temp index");
+                                        fail_instr(c, inst, "bad temp index");
                                 break;
 
                         case QFILE_VARY:
@@ -102,14 +102,14 @@ void qir_validate(struct vc4_compile *c)
 
                         case QFILE_SMALL_IMM:
                                 if (qpu_encode_small_immediate(src.index) == ~0)
-                                        fail_instr(inst, "bad small immediate");
+                                        fail_instr(c, inst, "bad small immediate");
                                 break;
 
                         case QFILE_FRAG_X:
                         case QFILE_FRAG_Y:
                         case QFILE_FRAG_REV_FLAG:
                                 if (c->stage != QSTAGE_FRAG)
-                                        fail_instr(inst, "frag access in VS/CS");
+                                        fail_instr(c, inst, "frag access in VS/CS");
                                 break;
 
                         case QFILE_NULL:
@@ -117,7 +117,7 @@ void qir_validate(struct vc4_compile *c)
                         case QFILE_TLB_COLOR_WRITE_MS:
                         case QFILE_TLB_Z_WRITE:
                         case QFILE_TLB_STENCIL_SETUP:
-                                fail_instr(inst, "Bad src file");
+                                fail_instr(c, inst, "Bad src file");
                                 break;
                         }
                 }
-- 
2.7.4



More information about the mesa-dev mailing list