From 59da3f04ca7b8a98930df45369816dceb1e39fa7 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 24 Sep 2014 02:17:12 +0000 Subject: [PATCH] R600/SI: Add new helper isSGPRClassID Move these into header since they are trivial git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218360 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIRegisterInfo.cpp | 7 ------- lib/Target/R600/SIRegisterInfo.h | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/Target/R600/SIRegisterInfo.cpp b/lib/Target/R600/SIRegisterInfo.cpp index f5307f88038..3715e6a6cf8 100644 --- a/lib/Target/R600/SIRegisterInfo.cpp +++ b/lib/Target/R600/SIRegisterInfo.cpp @@ -288,13 +288,6 @@ const TargetRegisterClass *SIRegisterInfo::getPhysRegClass(unsigned Reg) const { return nullptr; } -bool SIRegisterInfo::isSGPRClass(const TargetRegisterClass *RC) const { - if (!RC) { - return false; - } - return !hasVGPRs(RC); -} - bool SIRegisterInfo::hasVGPRs(const TargetRegisterClass *RC) const { return getCommonSubClass(&AMDGPU::VReg_32RegClass, RC) || getCommonSubClass(&AMDGPU::VReg_64RegClass, RC) || diff --git a/lib/Target/R600/SIRegisterInfo.h b/lib/Target/R600/SIRegisterInfo.h index 0ac9f368d95..c7e54dbf0ec 100644 --- a/lib/Target/R600/SIRegisterInfo.h +++ b/lib/Target/R600/SIRegisterInfo.h @@ -46,7 +46,20 @@ struct SIRegisterInfo : public AMDGPURegisterInfo { const TargetRegisterClass *getPhysRegClass(unsigned Reg) const; /// \returns true if this class contains only SGPR registers - bool isSGPRClass(const TargetRegisterClass *RC) const; + bool isSGPRClass(const TargetRegisterClass *RC) const { + if (!RC) + return false; + + return !hasVGPRs(RC); + } + + /// \returns true if this class ID contains only SGPR registers + bool isSGPRClassID(unsigned RCID) const { + if (static_cast(RCID) == -1) + return false; + + return isSGPRClass(getRegClass(RCID)); + } /// \returns true if this class contains VGPR registers. bool hasVGPRs(const TargetRegisterClass *RC) const;