From 2dc6be52093af5347162f1ff71c61df8b9d0fdf8 Mon Sep 17 00:00:00 2001 From: Sebastian Neubauer Date: Thu, 1 Apr 2021 14:50:59 +0200 Subject: [PATCH] [AMDGPU] Update SGPRSpillVGPRCSR name. NFC The struct is used for both, callee and caller-save registers now. The frame index is not set for entrypoints, as we do not need to save the registers then. Update the struct name to reflect that. Differential Revision: https://reviews.llvm.org/D99722 --- llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | 6 +++--- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp | 4 ++-- llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h | 14 ++++++-------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index afa69b2..dd7d1f3 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -879,8 +879,8 @@ void SIFrameLowering::emitPrologue(MachineFunction &MF, Optional FPSaveIndex = FuncInfo->FramePointerSaveIndex; Optional BPSaveIndex = FuncInfo->BasePointerSaveIndex; - for (const SIMachineFunctionInfo::SGPRSpillVGPRCSR &Reg - : FuncInfo->getSGPRSpillVGPRs()) { + for (const SIMachineFunctionInfo::SGPRSpillVGPR &Reg : + FuncInfo->getSGPRSpillVGPRs()) { if (!Reg.FI.hasValue()) continue; @@ -1174,7 +1174,7 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF, } } - for (const SIMachineFunctionInfo::SGPRSpillVGPRCSR &Reg : + for (const SIMachineFunctionInfo::SGPRSpillVGPR &Reg : FuncInfo->getSGPRSpillVGPRs()) { if (!Reg.FI.hasValue()) continue; diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp index 4ed5c9c..a86f720 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp @@ -321,7 +321,7 @@ bool SIMachineFunctionInfo::allocateSGPRSpillToVGPR(MachineFunction &MF, SpillFI = FrameInfo.CreateSpillStackObject(4, Align(4)); } - SpillVGPRs.push_back(SGPRSpillVGPRCSR(LaneVGPR, SpillFI)); + SpillVGPRs.push_back(SGPRSpillVGPR(LaneVGPR, SpillFI)); // Add this register as live-in to all blocks to avoid machine verifer // complaining about use of an undefined physical register. @@ -347,7 +347,7 @@ bool SIMachineFunctionInfo::reserveVGPRforSGPRSpills(MachineFunction &MF) { MF.getRegInfo(), &AMDGPU::VGPR_32RegClass, MF, true); if (LaneVGPR == Register()) return false; - SpillVGPRs.push_back(SGPRSpillVGPRCSR(LaneVGPR, None)); + SpillVGPRs.push_back(SGPRSpillVGPR(LaneVGPR, None)); FuncInfo->VGPRReservedForSGPRSpill = LaneVGPR; return true; } diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h index 35fb431..3009c33 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h @@ -445,15 +445,15 @@ public: bool hasReg() { return VGPR != 0;} }; - struct SGPRSpillVGPRCSR { + struct SGPRSpillVGPR { // VGPR used for SGPR spills Register VGPR; - // If the VGPR is a CSR, the stack slot used to save/restore it in the - // prolog/epilog. + // If the VGPR is is used for SGPR spills in a non-entrypoint function, the + // stack slot used to save/restore it in the prolog/epilog. Optional FI; - SGPRSpillVGPRCSR(Register V, Optional F) : VGPR(V), FI(F) {} + SGPRSpillVGPR(Register V, Optional F) : VGPR(V), FI(F) {} }; struct VGPRSpillToAGPR { @@ -470,7 +470,7 @@ private: // frameindex key. DenseMap> SGPRToVGPRSpills; unsigned NumVGPRSpillLanes = 0; - SmallVector SpillVGPRs; + SmallVector SpillVGPRs; DenseMap VGPRToAGPRSpills; @@ -505,9 +505,7 @@ public: ArrayRef() : makeArrayRef(I->second); } - ArrayRef getSGPRSpillVGPRs() const { - return SpillVGPRs; - } + ArrayRef getSGPRSpillVGPRs() const { return SpillVGPRs; } void setSGPRSpillVGPRs(Register NewVGPR, Optional newFI, int Index) { SpillVGPRs[Index].VGPR = NewVGPR; -- 2.7.4