[llvm-branch-commits] [llvm-branch] r102660 - in /llvm/branches/Apple/Morbo/lib: CodeGen/PrologEpilogInserter.cpp Target/PowerPC/PPCRegisterInfo.cpp

Dale Johannesen dalej at apple.com
Thu Apr 29 13:12:04 PDT 2010


Author: johannes
Date: Thu Apr 29 15:12:04 2010
New Revision: 102660

URL: http://llvm.org/viewvc/llvm-project?rev=102660&view=rev
Log:
7533078
--- Merging r102657 into '.':
U    lib/CodeGen/PrologEpilogInserter.cpp
U    lib/Target/PowerPC/PPCRegisterInfo.cpp


Modified:
    llvm/branches/Apple/Morbo/lib/CodeGen/PrologEpilogInserter.cpp
    llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp

Modified: llvm/branches/Apple/Morbo/lib/CodeGen/PrologEpilogInserter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/CodeGen/PrologEpilogInserter.cpp?rev=102660&r1=102659&r2=102660&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/CodeGen/PrologEpilogInserter.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/CodeGen/PrologEpilogInserter.cpp Thu Apr 29 15:12:04 2010
@@ -203,6 +203,10 @@
   if (CSRegs == 0 || CSRegs[0] == 0)
     return;
 
+  // In Naked functions we aren't going to save any registers.
+  if (Fn.getFunction()->hasFnAttr(Attribute::Naked))
+    return;
+
   // Figure out which *callee saved* registers are modified by the current
   // function, thus needing to be saved and restored in the prolog/epilog.
   const TargetRegisterClass * const *CSRegClasses =

Modified: llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=102660&r1=102659&r2=102660&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp Thu Apr 29 15:12:04 2010
@@ -405,6 +405,9 @@
 //
 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());
 }
@@ -790,7 +793,10 @@
   // 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





More information about the llvm-branch-commits mailing list