From 7f962a9362ec8bc8b03b7d44a13b44291e3b599d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 11 Mar 2020 13:12:08 +0100 Subject: [PATCH] aco: guarantee that Temp fits in 4 bytes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_ir.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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; }; /** -- 2.30.2