From: Daniel Schürmann Date: Wed, 11 Mar 2020 12:12:08 +0000 (+0100) Subject: aco: guarantee that Temp fits in 4 bytes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f962a9362ec8bc8b03b7d44a13b44291e3b599d;p=mesa.git aco: guarantee that Temp fits in 4 bytes Reviewed-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index e9d7534088c..3bd211f925f 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -262,25 +262,25 @@ static constexpr RegClass v8b{RegClass::v8b}; * and SSA id. */ struct Temp { - Temp() noexcept : id_(0), reg_class(RegType::sgpr, 0) {} + Temp() noexcept : id_(0), reg_class(0) {} constexpr Temp(uint32_t id, RegClass cls) noexcept - : id_(id), reg_class(cls) {} + : id_(id), reg_class(uint8_t(cls)) {} constexpr uint32_t id() const noexcept { return id_; } - constexpr RegClass regClass() const noexcept { return reg_class; } + constexpr RegClass regClass() const noexcept { return (RegClass::RC)reg_class; } - constexpr unsigned bytes() const noexcept { return reg_class.bytes(); } - constexpr unsigned size() const noexcept { return reg_class.size(); } - constexpr RegType type() const noexcept { return reg_class.type(); } - constexpr bool is_linear() const noexcept { return reg_class.is_linear(); } + constexpr unsigned bytes() const noexcept { return regClass().bytes(); } + constexpr unsigned size() const noexcept { return regClass().size(); } + constexpr RegType type() const noexcept { return regClass().type(); } + constexpr bool is_linear() const noexcept { return regClass().is_linear(); } constexpr bool operator <(Temp other) const noexcept { return id() < other.id(); } constexpr bool operator==(Temp other) const noexcept { return id() == other.id(); } constexpr bool operator!=(Temp other) const noexcept { return id() != other.id(); } private: - uint32_t id_:24; - RegClass reg_class; + uint32_t id_: 24; + uint32_t reg_class : 8; }; /**