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

Author: Tony Wasserka <[email protected]>
Date:   Tue Jan 26 16:05:01 2021 +0100

aco/ra: Fix build with print_regs enabled

Reviewed-by: Rhys Perry <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8719>

---

 src/amd/compiler/aco_register_allocation.cpp | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp 
b/src/amd/compiler/aco_register_allocation.cpp
index 821536d4f6d..6233f0449d2 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -359,14 +359,13 @@ private:
 void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& reg_file)
 {
    unsigned max = vgprs ? ctx.program->max_reg_demand.vgpr : 
ctx.program->max_reg_demand.sgpr;
-   unsigned lb = vgprs ? 256 : 0;
-   unsigned ub = lb + max;
+   PhysRegInterval regs { vgprs ? PhysReg{256} : PhysReg{0}, max };
    char reg_char = vgprs ? 'v' : 's';
 
    /* print markers */
    printf("       ");
-   for (unsigned i = lb; i < ub; i += 3) {
-      printf("%.2u ", i - lb);
+   for (unsigned i = 0; i < regs.size; i += 3) {
+      printf("%.2u ", i);
    }
    printf("\n");
 
@@ -375,12 +374,12 @@ void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& 
reg_file)
    unsigned free_regs = 0;
    unsigned prev = 0;
    bool char_select = false;
-   for (unsigned i = lb; i < ub; i++) {
-      if (reg_file[i] == 0xFFFFFFFF) {
+   for (auto reg : regs) {
+      if (reg_file[reg] == 0xFFFFFFFF) {
          printf("~");
-      } else if (reg_file[i]) {
-         if (reg_file[i] != prev) {
-            prev = reg_file[i];
+      } else if (reg_file[reg]) {
+         if (reg_file[reg] != prev) {
+            prev = reg_file[reg];
             char_select = !char_select;
          }
          printf(char_select ? "#" : "@");
@@ -396,18 +395,18 @@ void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& 
reg_file)
    /* print assignments */
    prev = 0;
    unsigned size = 0;
-   for (unsigned i = lb; i < ub; i++) {
+   for (auto i : regs) {
       if (reg_file[i] != prev) {
          if (prev && size > 1)
-            printf("-%d]\n", i - 1 - lb);
+            printf("-%d]\n", i - regs.lo() - 1);
          else if (prev)
             printf("]\n");
          prev = reg_file[i];
          if (prev && prev != 0xFFFFFFFF) {
             if (ctx.orig_names.count(reg_file[i]) && 
ctx.orig_names[reg_file[i]].id() != reg_file[i])
-               printf("%%%u (was %%%d) = %c[%d", reg_file[i], 
ctx.orig_names[reg_file[i]].id(), reg_char, i - lb);
+               printf("%%%u (was %%%d) = %c[%d", reg_file[i], 
ctx.orig_names[reg_file[i]].id(), reg_char, i - regs.lo());
             else
-               printf("%%%u = %c[%d", reg_file[i], reg_char, i - lb);
+               printf("%%%u = %c[%d", reg_file[i], reg_char, i - regs.lo());
          }
          size = 1;
       } else {
@@ -415,7 +414,7 @@ void print_regs(ra_ctx& ctx, bool vgprs, RegisterFile& 
reg_file)
       }
    }
    if (prev && size > 1)
-      printf("-%d]\n", ub - lb - 1);
+      printf("-%d]\n", regs.size - 1);
    else if (prev)
       printf("]\n");
 }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to