XCore target: Optimise entsp / retsp selection

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Robert Lytton
2014-01-06 14:20:47 +00:00
parent 7d2dd96694
commit c2508e505a
3 changed files with 19 additions and 10 deletions

View File

@@ -427,12 +427,20 @@ processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS) const {
XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>();
bool LRUsed = MF.getRegInfo().isPhysRegUsed(XCore::LR);
// If we need to extend the stack it is more efficient to use entsp / retsp.
// We force the LR to be saved so these instructions are used.
if (!LRUsed && !MF.getFunction()->isVarArg() &&
MF.getFrameInfo()->estimateStackSize(MF))
LRUsed = true;
// We will handling LR in the prologue/epilogue
// and space on the stack ourselves.
if (MF.getRegInfo().isPhysRegUsed(XCore::LR)) {
if (LRUsed) {
MF.getRegInfo().setPhysRegUnused(XCore::LR);
XFI->createLRSpillSlot(MF);
}
// A callee save register is used to hold the FP.
// This needs saving / restoring in the epilogue / prologue.
if (hasFP(MF))