From: Tony Wasserka Date: Mon, 9 Nov 2020 10:12:13 +0000 (+0100) Subject: aco/ra: Use PhysRegInterval for count_zero X-Git-Tag: upstream/21.2.3~9551 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b603875482d78f02e50c57ff04f0bfb4f0d98669;p=platform%2Fupstream%2Fmesa.git aco/ra: Use PhysRegInterval for count_zero Reviewed-by: Daniel Schürmann Part-of: --- diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index ccf8248..2459e44 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 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