Module: Mesa
Branch: master
Commit: 00910e3057588de3fe9b5dc2ae9263c2e4ba6cc4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=00910e3057588de3fe9b5dc2ae9263c2e4ba6cc4

Author: Eric Anholt <e...@anholt.net>
Date:   Wed Mar 14 11:03:23 2018 -0700

broadcom/vc5: Don't annotate dumps with stale live intervals.

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       | 1 +
 src/broadcom/compiler/vir.c                | 3 +++
 src/broadcom/compiler/vir_dump.c           | 4 ++--
 src/broadcom/compiler/vir_live_variables.c | 2 ++
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/broadcom/compiler/v3d_compiler.h 
b/src/broadcom/compiler/v3d_compiler.h
index 84cc4d290a..df81f0757e 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -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;
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 0cbdc986d3..05f557fbcd 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -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
diff --git a/src/broadcom/compiler/vir_dump.c b/src/broadcom/compiler/vir_dump.c
index ef860cbb5c..90a3fb0ac6 100644
--- a/src/broadcom/compiler/vir_dump.c
+++ b/src/broadcom/compiler/vir_dump.c
@@ -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++) {
diff --git a/src/broadcom/compiler/vir_live_variables.c 
b/src/broadcom/compiler/vir_live_variables.c
index 20acace1fa..019cde1456 100644
--- a/src/broadcom/compiler/vir_live_variables.c
+++ b/src/broadcom/compiler/vir_live_variables.c
@@ -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;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to