[PATCH] D63796: AMDGPU: Check MRI for callee saved regs instead of TRI
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 25 16:08:58 PDT 2019
arsenm created this revision.
arsenm added a reviewer: rampitec.
Herald added subscribers: t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl.
This should the same, but MRI does allow dynamically changing the CSR
set, although currently not used.
https://reviews.llvm.org/D63796
Files:
lib/Target/AMDGPU/GCNNSAReassign.cpp
lib/Target/AMDGPU/GCNRegBankReassign.cpp
lib/Target/AMDGPU/SIFrameLowering.cpp
lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
Index: lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
===================================================================
--- lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
+++ lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
@@ -250,7 +250,7 @@
int NumLanes = Size / 4;
- const MCPhysReg *CSRegs = TRI->getCalleeSavedRegs(&MF);
+ const MCPhysReg *CSRegs = MRI.getCalleeSavedRegs();
// Make sure to handle the case where a wide SGPR spill may span between two
// VGPRs.
Index: lib/Target/AMDGPU/SIFrameLowering.cpp
===================================================================
--- lib/Target/AMDGPU/SIFrameLowering.cpp
+++ lib/Target/AMDGPU/SIFrameLowering.cpp
@@ -527,15 +527,13 @@
LivePhysRegs &LiveRegs,
const TargetRegisterClass &RC) {
const GCNSubtarget &Subtarget = MF.getSubtarget<GCNSubtarget>();
- const SIRegisterInfo &TRI = *Subtarget.getRegisterInfo();
+ MachineRegisterInfo &MRI = MF.getRegInfo();
// Mark callee saved registers as used so we will not choose them.
- const MCPhysReg *CSRegs = TRI.getCalleeSavedRegs(&MF);
+ const MCPhysReg *CSRegs = MRI.getCalleeSavedRegs();
for (unsigned i = 0; CSRegs[i]; ++i)
LiveRegs.addReg(CSRegs[i]);
- MachineRegisterInfo &MRI = MF.getRegInfo();
-
for (unsigned Reg : RC) {
if (LiveRegs.available(MRI, Reg))
return Reg;
Index: lib/Target/AMDGPU/GCNRegBankReassign.cpp
===================================================================
--- lib/Target/AMDGPU/GCNRegBankReassign.cpp
+++ lib/Target/AMDGPU/GCNRegBankReassign.cpp
@@ -740,7 +740,7 @@
MaxNumVGPRs = std::min(ST->getMaxNumVGPRs(Occupancy), MaxNumVGPRs);
MaxNumSGPRs = std::min(ST->getMaxNumSGPRs(Occupancy, true), MaxNumSGPRs);
- CSRegs = TRI->getCalleeSavedRegs(&MF);
+ CSRegs = MRI->getCalleeSavedRegs();
RegsUsed.resize(AMDGPU::VGPR_32RegClass.getNumRegs() +
TRI->getEncodingValue(AMDGPU::SGPR_NULL) / 2 + 1);
Index: lib/Target/AMDGPU/GCNNSAReassign.cpp
===================================================================
--- lib/Target/AMDGPU/GCNNSAReassign.cpp
+++ lib/Target/AMDGPU/GCNNSAReassign.cpp
@@ -234,7 +234,7 @@
const SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();
MaxNumVGPRs = ST->getMaxNumVGPRs(MF);
MaxNumVGPRs = std::min(ST->getMaxNumVGPRs(MFI->getOccupancy()), MaxNumVGPRs);
- CSRegs = TRI->getCalleeSavedRegs(&MF);
+ CSRegs = MRI->getCalleeSavedRegs();
using Candidate = std::pair<const MachineInstr*, bool>;
SmallVector<Candidate, 32> Candidates;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63796.206545.patch
Type: text/x-patch
Size: 2606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190625/419a1133/attachment.bin>
More information about the llvm-commits
mailing list