diff options
author | Robert Lytton <robert@xmos.com> | 2014-01-06 14:20:47 +0000 |
---|---|---|
committer | Robert Lytton <robert@xmos.com> | 2014-01-06 14:20:47 +0000 |
commit | cbb588a26486527f71028a3c8e6a979053d7ccd5 (patch) | |
tree | 09a34367217acc098bfd6e6eda40c0fe7b90722c /llvm/lib/Target/XCore/XCoreFrameLowering.cpp | |
parent | a53360a339998a4523b2f819d727b77454ea6fa5 (diff) | |
download | bcm5719-llvm-cbb588a26486527f71028a3c8e6a979053d7ccd5.tar.gz bcm5719-llvm-cbb588a26486527f71028a3c8e6a979053d7ccd5.zip |
XCore target: Optimise entsp / retsp selection
llvm-svn: 198612
Diffstat (limited to 'llvm/lib/Target/XCore/XCoreFrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/XCore/XCoreFrameLowering.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp index 22d0e6604bd..3d1fb9cafc1 100644 --- a/llvm/lib/Target/XCore/XCoreFrameLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreFrameLowering.cpp @@ -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)) |