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 | c2508e505aa70a3764199ca97cf4d417a8de91cd (patch) | |
tree | ed1c90049256d67413de2dcab9a073f131a8a3c8 /lib/Target/XCore/XCoreFrameLowering.cpp | |
parent | 7d2dd96694fc1fd29120a01a7f180445c7aabede (diff) | |
download | llvm-c2508e505aa70a3764199ca97cf4d417a8de91cd.tar.gz llvm-c2508e505aa70a3764199ca97cf4d417a8de91cd.tar.bz2 llvm-c2508e505aa70a3764199ca97cf4d417a8de91cd.tar.xz |
XCore target: Optimise entsp / retsp selection
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/XCore/XCoreFrameLowering.cpp')
-rw-r--r-- | lib/Target/XCore/XCoreFrameLowering.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/XCore/XCoreFrameLowering.cpp b/lib/Target/XCore/XCoreFrameLowering.cpp index 22d0e6604b..3d1fb9cafc 100644 --- a/lib/Target/XCore/XCoreFrameLowering.cpp +++ b/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)) |