diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h @@ -17,6 +17,8 @@ #define GET_REGINFO_HEADER #include "AMDGPUGenRegisterInfo.inc" +#include "SIDefines.h" + namespace llvm { class GCNSubtarget; @@ -157,7 +159,7 @@ const TargetRegisterClass *getPhysRegClass(MCRegister Reg) const; /// \returns true if this class contains only SGPR registers - bool isSGPRClass(const TargetRegisterClass *RC) const { + static bool isSGPRClass(const TargetRegisterClass *RC) { return !hasVGPRs(RC) && !hasAGPRs(RC); } @@ -169,23 +171,27 @@ bool isSGPRReg(const MachineRegisterInfo &MRI, Register Reg) const; /// \returns true if this class contains only VGPR registers - bool isVGPRClass(const TargetRegisterClass *RC) const { + static bool isVGPRClass(const TargetRegisterClass *RC) { return hasVGPRs(RC) && !hasAGPRs(RC); } /// \returns true if this class contains only AGPR registers - bool isAGPRClass(const TargetRegisterClass *RC) const { + static bool isAGPRClass(const TargetRegisterClass *RC) { return hasAGPRs(RC) && !hasVGPRs(RC); } /// \returns true if this class contains VGPR registers. - bool hasVGPRs(const TargetRegisterClass *RC) const; + static bool hasVGPRs(const TargetRegisterClass *RC) { + return RC->TSFlags & SIRCFlags::HasVGPR; + } /// \returns true if this class contains AGPR registers. - bool hasAGPRs(const TargetRegisterClass *RC) const; + static bool hasAGPRs(const TargetRegisterClass *RC) { + return RC->TSFlags & SIRCFlags::HasAGPR; + } /// \returns true if this class contains any vector registers. - bool hasVectorRegisters(const TargetRegisterClass *RC) const { + static bool hasVectorRegisters(const TargetRegisterClass *RC) { return hasVGPRs(RC) || hasAGPRs(RC); } diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp --- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp @@ -2166,14 +2166,6 @@ return isSGPRClass(RC); } -bool SIRegisterInfo::hasVGPRs(const TargetRegisterClass *RC) const { - return RC->TSFlags & SIRCFlags::HasVGPR; -} - -bool SIRegisterInfo::hasAGPRs(const TargetRegisterClass *RC) const { - return RC->TSFlags & SIRCFlags::HasAGPR; -} - const TargetRegisterClass * SIRegisterInfo::getEquivalentVGPRClass(const TargetRegisterClass *SRC) const { unsigned Size = getRegSizeInBits(*SRC);