PEI: Delay checking requiresFrameIndexReplacementScavenging

Currently this is called before the frame size is set on the
function. For AMDGPU, the scavenger is used for large frames where
part of the offset needs to be materialized in a register, so
estimating the frame size is useful for knowing whether the scavenger
is useful.

llvm-svn: 357087
This commit is contained in:
Matt Arsenault 2019-03-27 16:37:31 +00:00
parent f8819bd510
commit b19361243b
1 changed files with 10 additions and 4 deletions

View File

@ -218,8 +218,6 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) {
RS = TRI->requiresRegisterScavenging(MF) ? new RegScavenger() : nullptr;
FrameIndexVirtualScavenging = TRI->requiresFrameIndexScavenging(MF);
FrameIndexEliminationScavenging = (RS && !FrameIndexVirtualScavenging) ||
TRI->requiresFrameIndexReplacementScavenging(MF);
ORE = &getAnalysis<MachineOptimizationRemarkEmitterPass>().getORE();
// Calculate the MaxCallFrameSize and AdjustsStack variables for the
@ -1074,8 +1072,16 @@ void PEI::insertPrologEpilogCode(MachineFunction &MF) {
/// replaceFrameIndices - Replace all MO_FrameIndex operands with physical
/// register references and actual offsets.
void PEI::replaceFrameIndices(MachineFunction &MF) {
const TargetFrameLowering &TFI = *MF.getSubtarget().getFrameLowering();
if (!TFI.needsFrameIndexResolution(MF)) return;
const auto &ST = MF.getSubtarget();
const TargetFrameLowering &TFI = *ST.getFrameLowering();
if (!TFI.needsFrameIndexResolution(MF))
return;
const TargetRegisterInfo *TRI = ST.getRegisterInfo();
// Allow the target to determine this after knowing the frame size.
FrameIndexEliminationScavenging = (RS && !FrameIndexVirtualScavenging) ||
TRI->requiresFrameIndexReplacementScavenging(MF);
// Store SPAdj at exit of a basic block.
SmallVector<int, 8> SPState;