aco: use RegisterDemand::operator[] more
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39690>
This commit is contained in:
Rhys Perry 2026-02-06 16:16:36 +00:00 committed by Marge Bot
parent 176b075129
commit bddd8b36a6

View file

@ -1042,13 +1042,7 @@ private:
struct RegisterDemand {
constexpr RegisterDemand() = default;
constexpr RegisterDemand(const int16_t v, const int16_t s) noexcept : vgpr{v}, sgpr{s} {}
constexpr RegisterDemand(Temp t) noexcept
{
if (t.regClass().type() == RegType::sgpr)
sgpr = t.size();
else
vgpr = t.size();
}
constexpr RegisterDemand(Temp t) noexcept { (*this)[t.type()] = t.size(); }
int16_t vgpr = 0;
int16_t sgpr = 0;
@ -1113,19 +1107,13 @@ struct RegisterDemand {
constexpr RegisterDemand& operator+=(const Temp t) noexcept
{
if (t.type() == RegType::sgpr)
sgpr += t.size();
else
vgpr += t.size();
(*this)[t.type()] += t.size();
return *this;
}
constexpr RegisterDemand& operator-=(const Temp t) noexcept
{
if (t.type() == RegType::sgpr)
sgpr -= t.size();
else
vgpr -= t.size();
(*this)[t.type()] -= t.size();
return *this;
}