vc4: Print live variable start/ends during QIR dumping.
authorEric Anholt <eric@anholt.net>
Wed, 6 Jul 2016 19:49:52 +0000 (12:49 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 13 Jul 2016 00:42:37 +0000 (17:42 -0700)
This only happens when live variables are set up, which is not in the
normal dump, but is set up when we've failed to register allocate.

src/gallium/drivers/vc4/vc4_qir.c

index 3f59fceede9350ef43e9d598fdff00cd2b1a96fb..4c81b567927e932e38efb33513cf0c952ecceb19 100644 (file)
@@ -361,11 +361,56 @@ qir_dump_inst(struct vc4_compile *c, struct qinst *inst)
 void
 qir_dump(struct vc4_compile *c)
 {
+        int ip = 0;
+
         qir_for_each_block(block, c) {
                 fprintf(stderr, "BLOCK %d:\n", block->index);
                 qir_for_each_inst(inst, block) {
+                        if (c->temp_start) {
+                                bool first = true;
+
+                                for (int i = 0; i < c->num_temps; i++) {
+                                        if (c->temp_start[i] != ip)
+                                                continue;
+
+                                        if (first) {
+                                                first = false;
+                                        } else {
+                                                fprintf(stderr, ", ");
+                                        }
+                                        fprintf(stderr, "S%4d", i);
+                                }
+
+                                if (first)
+                                        fprintf(stderr, "      ");
+                                else
+                                        fprintf(stderr, " ");
+                        }
+
+                        if (c->temp_end) {
+                                bool first = true;
+
+                                for (int i = 0; i < c->num_temps; i++) {
+                                        if (c->temp_end[i] != ip)
+                                                continue;
+
+                                        if (first) {
+                                                first = false;
+                                        } else {
+                                                fprintf(stderr, ", ");
+                                        }
+                                        fprintf(stderr, "E%4d", i);
+                                }
+
+                                if (first)
+                                        fprintf(stderr, "      ");
+                                else
+                                        fprintf(stderr, " ");
+                        }
+
                         qir_dump_inst(c, inst);
                         fprintf(stderr, "\n");
+                        ip++;
                 }
         }
 }