Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | void SIMachineFunctionInfo::allocateWWMSpill(MachineFunction &MF, Register VGPR, | ||||
// Skip if it is an entry function or the register is already added. | // Skip if it is an entry function or the register is already added. | ||||
if (isEntryFunction() || WWMSpills.count(VGPR)) | if (isEntryFunction() || WWMSpills.count(VGPR)) | ||||
return; | return; | ||||
WWMSpills.insert(std::make_pair( | WWMSpills.insert(std::make_pair( | ||||
VGPR, MF.getFrameInfo().CreateSpillStackObject(Size, Alignment))); | VGPR, MF.getFrameInfo().CreateSpillStackObject(Size, Alignment))); | ||||
} | } | ||||
bool SIMachineFunctionInfo::isCalleeSavedReg(const MCPhysReg *CSRegs, | |||||
MCPhysReg Reg) { | |||||
for (unsigned I = 0; CSRegs[I]; ++I) { | |||||
if (CSRegs[I] == Reg) | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
bool SIMachineFunctionInfo::allocateVGPRForSGPRSpills(MachineFunction &MF, | bool SIMachineFunctionInfo::allocateVGPRForSGPRSpills(MachineFunction &MF, | ||||
int FI, | int FI, | ||||
unsigned LaneIndex) { | unsigned LaneIndex) { | ||||
const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>(); | const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>(); | ||||
const SIRegisterInfo *TRI = ST.getRegisterInfo(); | const SIRegisterInfo *TRI = ST.getRegisterInfo(); | ||||
MachineRegisterInfo &MRI = MF.getRegInfo(); | MachineRegisterInfo &MRI = MF.getRegInfo(); | ||||
Register LaneVGPR; | Register LaneVGPR; | ||||
if (!LaneIndex) { | if (!LaneIndex) { | ||||
▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | bool SIMachineFunctionInfo::removeDeadFrameIndices( | ||||
for (auto &R : make_early_inc_range(SGPRToVGPRSpills)) { | for (auto &R : make_early_inc_range(SGPRToVGPRSpills)) { | ||||
MFI.RemoveStackObject(R.first); | MFI.RemoveStackObject(R.first); | ||||
SGPRToVGPRSpills.erase(R.first); | SGPRToVGPRSpills.erase(R.first); | ||||
} | } | ||||
bool HaveSGPRToMemory = false; | bool HaveSGPRToMemory = false; | ||||
if (ResetSGPRSpillStackIDs) { | if (ResetSGPRSpillStackIDs) { | ||||
// All other SPGRs must be allocated on the default stack, so reset the | // All other SGPRs must be allocated on the default stack, so reset the | ||||
// stack ID. | // stack ID. | ||||
for (int i = MFI.getObjectIndexBegin(), e = MFI.getObjectIndexEnd(); i != e; | for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd(); I != E; | ||||
++i) { | ++I) { | ||||
if (i != FramePointerSaveIndex && i != BasePointerSaveIndex) { | if (!checkIndexInCustomSGPRSpills(I)) { | ||||
if (MFI.getStackID(i) == TargetStackID::SGPRSpill) { | if (MFI.getStackID(I) == TargetStackID::SGPRSpill) { | ||||
MFI.setStackID(i, TargetStackID::Default); | MFI.setStackID(I, TargetStackID::Default); | ||||
HaveSGPRToMemory = true; | HaveSGPRToMemory = true; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
for (auto &R : VGPRToAGPRSpills) { | for (auto &R : VGPRToAGPRSpills) { | ||||
if (R.second.IsDead) | if (R.second.IsDead) | ||||
▲ Show 20 Lines • Show All 256 Lines • Show Last 20 Lines |