summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCRegisterInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-08 06:59:59 +0000
committerChris Lattner <sabre@nondot.org>2007-12-08 06:59:59 +0000
commit3fc027df4fca0355717515abb4d6e3753e6dee2a (patch)
tree6311d6ce97604a9baa315d5657959d0b87784eb3 /lib/Target/PowerPC/PPCRegisterInfo.cpp
parent73944fb22270697e75408cba52cca276be371a1f (diff)
downloadllvm-3fc027df4fca0355717515abb4d6e3753e6dee2a.tar.gz
llvm-3fc027df4fca0355717515abb4d6e3753e6dee2a.tar.bz2
llvm-3fc027df4fca0355717515abb4d6e3753e6dee2a.tar.xz
implement __builtin_return_addr(0) on ppc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCRegisterInfo.cpp')
-rw-r--r--lib/Target/PowerPC/PPCRegisterInfo.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCRegisterInfo.cpp b/lib/Target/PowerPC/PPCRegisterInfo.cpp
index 679ca2e58f..c574f7004a 100644
--- a/lib/Target/PowerPC/PPCRegisterInfo.cpp
+++ b/lib/Target/PowerPC/PPCRegisterInfo.cpp
@@ -646,9 +646,14 @@ bool PPCRegisterInfo::hasFP(const MachineFunction &MF) const {
}
/// MustSaveLR - Return true if this function requires that we save the LR
-/// register onto the stack in the prolog and restore it in the epilog of the function.
+/// register onto the stack in the prolog and restore it in the epilog of the
+/// function.
static bool MustSaveLR(const MachineFunction &MF) {
- return MF.getInfo<PPCFunctionInfo>()->usesLR() ||
+ const PPCFunctionInfo *MFI = MF.getInfo<PPCFunctionInfo>();
+
+ // We need an save/restore of LR if there is any use/def of LR explicitly, or
+ // if there is some use of the LR stack slot (e.g. for builtin_return_address.
+ return MFI->usesLR() || MFI->isLRStoreRequired() ||
// FIXME: Anything that has a call should clobber the LR register,
// isn't this redundant??
MF.getFrameInfo()->hasCalls();