[llvm] 898dc8a - AMDGPU: Use subtarget in class instead of querying function
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 15 18:28:16 PST 2022
Author: Matt Arsenault
Date: 2022-02-15T21:28:12-05:00
New Revision: 898dc8a4b18d8f115357969634dcbf16fecdf2fa
URL: https://github.com/llvm/llvm-project/commit/898dc8a4b18d8f115357969634dcbf16fecdf2fa
DIFF: https://github.com/llvm/llvm-project/commit/898dc8a4b18d8f115357969634dcbf16fecdf2fa.diff
LOG: AMDGPU: Use subtarget in class instead of querying function
Added:
Modified:
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
index 81742a845bfea..3eaa28a0afeb0 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -392,13 +392,11 @@ const MCPhysReg *SIRegisterInfo::getCalleeSavedRegs(
case CallingConv::C:
case CallingConv::Fast:
case CallingConv::Cold:
- return MF->getSubtarget<GCNSubtarget>().hasGFX90AInsts()
- ? CSR_AMDGPU_HighRegs_With_AGPRs_SaveList
- : CSR_AMDGPU_HighRegs_SaveList;
+ return ST.hasGFX90AInsts() ? CSR_AMDGPU_HighRegs_With_AGPRs_SaveList
+ : CSR_AMDGPU_HighRegs_SaveList;
case CallingConv::AMDGPU_Gfx:
- return MF->getSubtarget<GCNSubtarget>().hasGFX90AInsts()
- ? CSR_AMDGPU_SI_Gfx_With_AGPRs_SaveList
- : CSR_AMDGPU_SI_Gfx_SaveList;
+ return ST.hasGFX90AInsts() ? CSR_AMDGPU_SI_Gfx_With_AGPRs_SaveList
+ : CSR_AMDGPU_SI_Gfx_SaveList;
default: {
// Dummy to not crash RegisterClassInfo.
static const MCPhysReg NoCalleeSavedReg = AMDGPU::NoRegister;
@@ -418,13 +416,11 @@ const uint32_t *SIRegisterInfo::getCallPreservedMask(const MachineFunction &MF,
case CallingConv::C:
case CallingConv::Fast:
case CallingConv::Cold:
- return MF.getSubtarget<GCNSubtarget>().hasGFX90AInsts()
- ? CSR_AMDGPU_HighRegs_With_AGPRs_RegMask
- : CSR_AMDGPU_HighRegs_RegMask;
+ return ST.hasGFX90AInsts() ? CSR_AMDGPU_HighRegs_With_AGPRs_RegMask
+ : CSR_AMDGPU_HighRegs_RegMask;
case CallingConv::AMDGPU_Gfx:
- return MF.getSubtarget<GCNSubtarget>().hasGFX90AInsts()
- ? CSR_AMDGPU_SI_Gfx_With_AGPRs_RegMask
- : CSR_AMDGPU_SI_Gfx_RegMask;
+ return ST.hasGFX90AInsts() ? CSR_AMDGPU_SI_Gfx_With_AGPRs_RegMask
+ : CSR_AMDGPU_SI_Gfx_RegMask;
default:
return nullptr;
}
@@ -441,8 +437,7 @@ SIRegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC,
// equivalent AV class. If used one, the verifier will crash after
// RegBankSelect in the GISel flow. The aligned regclasses are not fully given
// until Instruction selection.
- if (MF.getSubtarget<GCNSubtarget>().hasMAIInsts() &&
- (isVGPRClass(RC) || isAGPRClass(RC))) {
+ if (ST.hasMAIInsts() && (isVGPRClass(RC) || isAGPRClass(RC))) {
if (RC == &AMDGPU::VGPR_32RegClass || RC == &AMDGPU::AGPR_32RegClass)
return &AMDGPU::AV_32RegClass;
if (RC == &AMDGPU::VReg_64RegClass || RC == &AMDGPU::AReg_64RegClass)
@@ -491,8 +486,7 @@ SIRegisterInfo::getLargestLegalSuperClass(const TargetRegisterClass *RC,
}
Register SIRegisterInfo::getFrameRegister(const MachineFunction &MF) const {
- const SIFrameLowering *TFI =
- MF.getSubtarget<GCNSubtarget>().getFrameLowering();
+ const SIFrameLowering *TFI = ST.getFrameLowering();
const SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
// During ISel lowering we always reserve the stack pointer in entry
// functions, but never actually want to reference it when accessing our own
More information about the llvm-commits
mailing list