Mesa (master): aco/ra: Use PhysRegInterval for count_zero

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 13 18:31:40 UTC 2021


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

Author: Tony Wasserka <tony.wasserka at gmx.de>
Date:   Mon Nov  9 11:12:13 2020 +0100

aco/ra: Use PhysRegInterval for count_zero

Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7799>

---

 src/amd/compiler/aco_register_allocation.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index ccf8248f893..2459e4489fb 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -248,10 +248,10 @@ public:
       return regs[index];
    }
 
-   unsigned count_zero(PhysReg start, unsigned size) {
+   unsigned count_zero(PhysRegInterval reg_interval) {
       unsigned res = 0;
-      for (unsigned i = 0; i < size; i++)
-         res += !regs[start + i];
+      for (PhysReg reg : reg_interval)
+         res += !regs[reg];
       return res;
    }
 
@@ -1050,7 +1050,7 @@ std::pair<PhysReg, bool> get_reg_impl(ra_ctx& ctx,
    RegClass rc = info.rc;
 
    /* check how many free regs we have */
-   unsigned regs_free = reg_file.count_zero(bounds.lo(), bounds.size);
+   unsigned regs_free = reg_file.count_zero(bounds);
 
    /* mark and count killed operands */
    unsigned killed_ops = 0;
@@ -1339,7 +1339,7 @@ PhysReg get_reg(ra_ctx& ctx,
 
    /* We should only fail here because keeping under the limit would require
     * too many moves. */
-   assert(reg_file.count_zero(info.bounds.lo(), info.bounds.size) >= info.size);
+   assert(reg_file.count_zero(info.bounds) >= info.size);
 
    //FIXME: if nothing helps, shift-rotate the registers to make space
 



More information about the mesa-commit mailing list