summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PrologEpilogInserter.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-11-24 00:26:47 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-11-24 00:26:47 +0000
commit94b32ffe8e28c9efeeacd1b1157dc26428e32e11 (patch)
tree3a2227be80ecfd4f9f039a7634cf43774fefa797 /llvm/lib/CodeGen/PrologEpilogInserter.cpp
parent5ee33253589755df83bd111136e4ffbdd0478b3a (diff)
downloadbcm5719-llvm-94b32ffe8e28c9efeeacd1b1157dc26428e32e11.tar.gz
bcm5719-llvm-94b32ffe8e28c9efeeacd1b1157dc26428e32e11.zip
TRI: Add hook to pass scavenger during frame elimination
The scavenger was not passed if requiresFrameIndexScavenging was enabled. I need to be able to test for the availability of an unallocatable register here, so I can't create a virtual register for it. It might be better to just always use the scavenger and stop creating virtual registers. llvm-svn: 287843
Diffstat (limited to 'llvm/lib/CodeGen/PrologEpilogInserter.cpp')
-rw-r--r--llvm/lib/CodeGen/PrologEpilogInserter.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
index 8013c115726..5fca7fa5536 100644
--- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
@@ -117,6 +117,10 @@ private:
// TRI->requiresFrameIndexScavenging() for the current function.
bool FrameIndexVirtualScavenging;
+ // Flag to control whether the scavenger should be passed even though
+ // FrameIndexVirtualScavenging is used.
+ bool FrameIndexEliminationScavenging;
+
void calculateCallFrameInfo(MachineFunction &Fn);
void calculateSaveRestoreBlocks(MachineFunction &Fn);
@@ -176,6 +180,8 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
RS = TRI->requiresRegisterScavenging(Fn) ? new RegScavenger() : nullptr;
FrameIndexVirtualScavenging = TRI->requiresFrameIndexScavenging(Fn);
+ FrameIndexEliminationScavenging = (RS && !FrameIndexVirtualScavenging) ||
+ TRI->requiresFrameIndexReplacementScavenging(Fn);
// Calculate the MaxCallFrameSize and AdjustsStack variables for the
// function's frame information. Also eliminates call frame pseudo
@@ -1046,7 +1052,8 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
unsigned FrameSetupOpcode = TII.getCallFrameSetupOpcode();
unsigned FrameDestroyOpcode = TII.getCallFrameDestroyOpcode();
- if (RS && !FrameIndexVirtualScavenging) RS->enterBasicBlock(*BB);
+ if (RS && FrameIndexEliminationScavenging)
+ RS->enterBasicBlock(*BB);
bool InsideCallSequence = false;
@@ -1115,7 +1122,7 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
// use that target machine register info object to eliminate
// it.
TRI.eliminateFrameIndex(MI, SPAdj, i,
- FrameIndexVirtualScavenging ? nullptr : RS);
+ FrameIndexEliminationScavenging ? RS : nullptr);
// Reset the iterator if we were at the beginning of the BB.
if (AtBeginning) {
@@ -1131,7 +1138,7 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
// the SP adjustment made by each instruction in the sequence.
// This includes both the frame setup/destroy pseudos (handled above),
// as well as other instructions that have side effects w.r.t the SP.
- // Note that this must come after eliminateFrameIndex, because
+ // Note that this must come after eliminateFrameIndex, because
// if I itself referred to a frame index, we shouldn't count its own
// adjustment.
if (DidFinishLoop && InsideCallSequence)
@@ -1140,7 +1147,7 @@ void PEI::replaceFrameIndices(MachineBasicBlock *BB, MachineFunction &Fn,
if (DoIncr && I != BB->end()) ++I;
// Update register states.
- if (RS && !FrameIndexVirtualScavenging && DidFinishLoop)
+ if (RS && FrameIndexEliminationScavenging && DidFinishLoop)
RS->forward(MI);
}
}
OpenPOWER on IntegriCloud