broadcom/vc5: On QPU pack error, dump the instruction and return cleanly.
authorEric Anholt <eric@anholt.net>
Wed, 14 Mar 2018 21:39:51 +0000 (14:39 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 19 Mar 2018 23:42:59 +0000 (16:42 -0700)
This is nice for debugging when you've made a bad instruction.

src/broadcom/compiler/vir_to_qpu.c

index 568a004803b90233a9713d1f7d57c6b43e628e37..83b1936cbd9d76b5bc91b6bb21e55e6b33776c7a 100644 (file)
@@ -388,7 +388,13 @@ v3d_vir_to_qpu(struct v3d_compile *c, struct qpu_reg *temp_registers)
         vir_for_each_inst_inorder(inst, c) {
                 bool ok = v3d_qpu_instr_pack(c->devinfo, &inst->qpu,
                                              &c->qpu_insts[i++]);
-                assert(ok); (void) ok;
+                if (!ok) {
+                        fprintf(stderr, "Failed to pack instruction:\n");
+                        vir_dump_inst(c, inst);
+                        fprintf(stderr, "\n");
+                        c->failed = true;
+                        return;
+                }
         }
         assert(i == c->qpu_inst_count);