diff options
author | Dale Johannesen <dalej@apple.com> | 2010-04-29 19:32:19 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2010-04-29 19:32:19 +0000 |
commit | 6feac8a39b6607c5be2a9284711b2a9da0feea8f (patch) | |
tree | 66554a856215c41f6b252ffb7b661d29123e8c1f /llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | |
parent | 080e4fb2f046cfde37e6cccb65429731f35cbe8e (diff) | |
download | bcm5719-llvm-6feac8a39b6607c5be2a9284711b2a9da0feea8f.tar.gz bcm5719-llvm-6feac8a39b6607c5be2a9284711b2a9da0feea8f.zip |
Make naked functions work on PPC.
llvm-svn: 102657
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp index 8048df21b7d..5f1e04eecb4 100644 --- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -409,6 +409,9 @@ PPCRegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const { // static bool needsFP(const MachineFunction &MF) { const MachineFrameInfo *MFI = MF.getFrameInfo(); + // Naked functions have no stack frame pushed, so we don't have a frame pointer. + if (MF.getFunction()->hasFnAttr(Attribute::Naked)) + return false; return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects() || (GuaranteedTailCallOpt && MF.getInfo<PPCFunctionInfo>()->hasFastCall()); } @@ -794,7 +797,10 @@ PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, // If we're not using a Frame Pointer that has been set to the value of the // SP before having the stack size subtracted from it, then add the stack size // to Offset to get the correct offset. - Offset += MFI->getStackSize(); + // Naked functions have stack size 0, although getStackSize may not reflect that + // because we didn't call all the pieces that compute it for naked functions. + if (!MF.getFunction()->hasFnAttr(Attribute::Naked)) + Offset += MFI->getStackSize(); // If we can, encode the offset directly into the instruction. If this is a // normal PPC "ri" instruction, any 16-bit value can be safely encoded. If |