broadcom/vc5: Don't annotate dumps with stale live intervals.
authorEric Anholt <eric@anholt.net>
Wed, 14 Mar 2018 18:03:23 +0000 (11:03 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 19 Mar 2018 23:44:20 +0000 (16:44 -0700)
As you're debugging register allocation, you may have changed the
intervals and not recomputed yet.  Just skip the dump in that case.

src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/vir.c
src/broadcom/compiler/vir_dump.c
src/broadcom/compiler/vir_live_variables.c

index 84cc4d290a0461477de53cf7b254b18b0a12ceaf..df81f0757e2bb5a5fa1a5f32a6aa29720489b0dc 100644 (file)
@@ -548,6 +548,7 @@ struct v3d_compile {
 
         /* Live ranges of temps. */
         int *temp_start, *temp_end;
+        bool live_intervals_valid;
 
         uint32_t *uniform_data;
         enum quniform_contents *uniform_contents;
index 0cbdc986d3fa844be0f5cbe1195cb5fe8fa1a1f5..05f557fbcd0218fd10c5f4f55a5331c9855198f3 100644 (file)
@@ -435,6 +435,7 @@ vir_emit(struct v3d_compile *c, struct qinst *inst)
         }
 
         c->cursor = vir_after_inst(inst);
+        c->live_intervals_valid = false;
 }
 
 /* Updates inst to write to a new temporary, emits it, and notes the def. */
@@ -813,6 +814,8 @@ vir_remove_instruction(struct v3d_compile *c, struct qinst *qinst)
 
         list_del(&qinst->link);
         free(qinst);
+
+        c->live_intervals_valid = false;
 }
 
 struct qreg
index ef860cbb5c1c4f537e5117ebc48753cd8a6d9433..90a3fb0ac65e6c8fcfd81be4b52b2ff19bbe4dd3 100644 (file)
@@ -321,7 +321,7 @@ vir_dump(struct v3d_compile *c)
         vir_for_each_block(block, c) {
                 fprintf(stderr, "BLOCK %d:\n", block->index);
                 vir_for_each_inst(inst, block) {
-                        if (c->temp_start) {
+                        if (c->live_intervals_valid) {
                                 bool first = true;
 
                                 for (int i = 0; i < c->num_temps; i++) {
@@ -342,7 +342,7 @@ vir_dump(struct v3d_compile *c)
                                         fprintf(stderr, " ");
                         }
 
-                        if (c->temp_end) {
+                        if (c->live_intervals_valid) {
                                 bool first = true;
 
                                 for (int i = 0; i < c->num_temps; i++) {
index 20acace1faf93043474ee3923e77440075c2ec5b..019cde145673bd1cf5eedc07775836dbb56a89fa 100644 (file)
@@ -347,4 +347,6 @@ vir_calculate_live_intervals(struct v3d_compile *c)
                 ;
 
         vir_compute_start_end(c, c->num_temps);
+
+        c->live_intervals_valid = true;
 }