[llvm-branch-commits] [llvm-branch] r101991 - in /llvm/branches/Apple/Morbo: include/llvm/Target/ lib/CodeGen/AsmPrinter/ lib/Target/ lib/Target/ARM/ lib/Target/Blackfin/ lib/Target/CellSPU/ lib/Target/MBlaze/ lib/Target/MSP430/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/SystemZ/ lib/Target/X86/ lib/Target/XCore/ test/CodeGen/X86/

Evan Cheng evan.cheng at apple.com
Tue Apr 20 23:20:38 PDT 2010


Author: evancheng
Date: Wed Apr 21 01:20:37 2010
New Revision: 101991

URL: http://llvm.org/viewvc/llvm-project?rev=101991&view=rev
Log:
Merge 101984.

Added:
    llvm/branches/Apple/Morbo/test/CodeGen/X86/fp-elim.ll
      - copied unchanged from r101984, llvm/trunk/test/CodeGen/X86/fp-elim.ll
Modified:
    llvm/branches/Apple/Morbo/include/llvm/Target/TargetOptions.h
    llvm/branches/Apple/Morbo/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/branches/Apple/Morbo/lib/Target/ARM/ARMBaseRegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/Blackfin/BlackfinRegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/CellSPU/SPURegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/MBlaze/MBlazeRegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/MSP430/MSP430RegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/Mips/MipsRegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCISelLowering.cpp
    llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/SystemZ/SystemZRegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/TargetMachine.cpp
    llvm/branches/Apple/Morbo/lib/Target/X86/X86RegisterInfo.cpp
    llvm/branches/Apple/Morbo/lib/Target/XCore/XCoreRegisterInfo.cpp

Modified: llvm/branches/Apple/Morbo/include/llvm/Target/TargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/include/llvm/Target/TargetOptions.h?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/include/llvm/Target/TargetOptions.h (original)
+++ llvm/branches/Apple/Morbo/include/llvm/Target/TargetOptions.h Wed Apr 21 01:20:37 2010
@@ -16,6 +16,8 @@
 #define LLVM_TARGET_TARGETOPTIONS_H
 
 namespace llvm {
+  class MachineFunction;
+
   // Possible float ABI settings. Used with FloatABIType in TargetOptions.h.
   namespace FloatABI {
     enum ABIType {
@@ -35,6 +37,16 @@
   /// elimination optimization, this option should disable it.
   extern bool NoFramePointerElim;
 
+  /// NoFramePointerElimNonLeaf - This flag is enabled when the
+  /// -disable-non-leaf-fp-elim is specified on the command line. If the target
+  /// supports the frame pointer elimination optimization, this option should
+  /// disable it for non-leaf functions.
+  extern bool NoFramePointerElimNonLeaf;
+
+  /// DisableFramePointerElim - This returns true if frame pointer elimination
+  /// optimization should be disabled for the given machine function.
+  extern bool DisableFramePointerElim(const MachineFunction &MF);
+
   /// LessPreciseFPMAD - This flag is enabled when the
   /// -enable-fp-mad is specified on the command line.  When this flag is off
   /// (the default), the code generator is not allowed to generate mad

Modified: llvm/branches/Apple/Morbo/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Apr 21 01:20:37 2010
@@ -1226,7 +1226,7 @@
   // DW_TAG_inlined_subroutine may refer to this DIE.
   ModuleCU->insertDIE(SP.getNode(), SPDie);
   
-  if (NoFramePointerElim == false)
+  if (!DisableFramePointerElim(*Asm->MF))
     addUInt(SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr, dwarf::DW_FORM_flag, 1);
 
   return SPDie;

Modified: llvm/branches/Apple/Morbo/lib/Target/ARM/ARMBaseRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/ARM/ARMBaseRegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/ARM/ARMBaseRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/ARM/ARMBaseRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -478,7 +478,7 @@
 ///
 bool ARMBaseRegisterInfo::hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return ((NoFramePointerElim && MFI->hasCalls())||
+  return ((DisableFramePointerElim(MF) && MFI->hasCalls())||
           needsStackRealignment(MF) ||
           MFI->hasVarSizedObjects() ||
           MFI->isFrameAddressTaken());
@@ -506,7 +506,7 @@
 bool ARMBaseRegisterInfo::
 cannotEliminateFrame(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  if (NoFramePointerElim && MFI->hasCalls())
+  if (DisableFramePointerElim(MF) && MFI->hasCalls())
     return true;
   return MFI->hasVarSizedObjects() || MFI->isFrameAddressTaken()
     || needsStackRealignment(MF);

Modified: llvm/branches/Apple/Morbo/lib/Target/Blackfin/BlackfinRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/Blackfin/BlackfinRegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/Blackfin/BlackfinRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/Blackfin/BlackfinRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -110,7 +110,8 @@
 // if frame pointer elimination is disabled.
 bool BlackfinRegisterInfo::hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return NoFramePointerElim || MFI->hasCalls() || MFI->hasVarSizedObjects();
+  return DisableFramePointerElim(MF) ||
+    MFI->hasCalls() || MFI->hasVarSizedObjects();
 }
 
 bool BlackfinRegisterInfo::

Modified: llvm/branches/Apple/Morbo/lib/Target/CellSPU/SPURegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/CellSPU/SPURegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/CellSPU/SPURegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/CellSPU/SPURegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -302,7 +302,7 @@
 //
 static bool needsFP(const MachineFunction &MF) {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return NoFramePointerElim || MFI->hasVarSizedObjects();
+  return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects();
 }
 
 //--------------------------------------------------------------------------

Modified: llvm/branches/Apple/Morbo/lib/Target/MBlaze/MBlazeRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/MBlaze/MBlazeRegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/MBlaze/MBlazeRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/MBlaze/MBlazeRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -243,7 +243,7 @@
 // if frame pointer elimination is disabled.
 bool MBlazeRegisterInfo::hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return NoFramePointerElim || MFI->hasVarSizedObjects();
+  return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects();
 }
 
 // This function eliminate ADJCALLSTACKDOWN,

Modified: llvm/branches/Apple/Morbo/lib/Target/MSP430/MSP430RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/MSP430/MSP430RegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/MSP430/MSP430RegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/MSP430/MSP430RegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -138,7 +138,7 @@
 bool MSP430RegisterInfo::hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
 
-  return (NoFramePointerElim ||
+  return (DisableFramePointerElim(MF) ||
           MF.getFrameInfo()->hasVarSizedObjects() ||
           MFI->isFrameAddressTaken());
 }

Modified: llvm/branches/Apple/Morbo/lib/Target/Mips/MipsRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/Mips/MipsRegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/Mips/MipsRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -338,7 +338,7 @@
 bool MipsRegisterInfo::
 hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return NoFramePointerElim || MFI->hasVarSizedObjects();
+  return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects();
 }
 
 // This function eliminate ADJCALLSTACKDOWN, 

Modified: llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCISelLowering.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCISelLowering.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCISelLowering.cpp Wed Apr 21 01:20:37 2010
@@ -5522,7 +5522,7 @@
 
   MachineFunction &MF = DAG.getMachineFunction();
   MachineFrameInfo *MFI = MF.getFrameInfo();
-  bool is31 = (NoFramePointerElim || MFI->hasVarSizedObjects())
+  bool is31 = (DisableFramePointerElim(MF) || MFI->hasVarSizedObjects())
                   && MFI->getStackSize();
 
   if (isPPC64)

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=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/PowerPC/PPCRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -405,7 +405,7 @@
 //
 static bool needsFP(const MachineFunction &MF) {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return NoFramePointerElim || MFI->hasVarSizedObjects() ||
+  return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects() ||
     (GuaranteedTailCallOpt && MF.getInfo<PPCFunctionInfo>()->hasFastCall());
 }
 

Modified: llvm/branches/Apple/Morbo/lib/Target/SystemZ/SystemZRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/SystemZ/SystemZRegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/SystemZ/SystemZRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/SystemZ/SystemZRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -77,7 +77,7 @@
 /// allocas or if frame pointer elimination is disabled.
 bool SystemZRegisterInfo::hasFP(const MachineFunction &MF) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
-  return NoFramePointerElim || MFI->hasVarSizedObjects();
+  return DisableFramePointerElim(MF) || MFI->hasVarSizedObjects();
 }
 
 void SystemZRegisterInfo::

Modified: llvm/branches/Apple/Morbo/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/TargetMachine.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/TargetMachine.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/TargetMachine.cpp Wed Apr 21 01:20:37 2010
@@ -11,6 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
@@ -25,6 +27,7 @@
   bool LessPreciseFPMADOption;
   bool PrintMachineCode;
   bool NoFramePointerElim;
+  bool NoFramePointerElimNonLeaf;
   bool NoExcessFPPrecision;
   bool UnsafeFPMath;
   bool FiniteOnlyFPMathOption;
@@ -58,6 +61,11 @@
   cl::location(NoFramePointerElim),
   cl::init(false));
 static cl::opt<bool, true>
+DisableFPElimNonLeaf("disable-non-leaf-fp-elim",
+  cl::desc("Disable frame pointer elimination optimization for non-leaf funcs"),
+  cl::location(NoFramePointerElimNonLeaf),
+  cl::init(false));
+static cl::opt<bool, true>
 DisableExcessPrecision("disable-excess-fp-precision",
   cl::desc("Disable optimizations that may increase FP precision"),
   cl::location(NoExcessFPPrecision),
@@ -268,6 +276,18 @@
 }
 
 namespace llvm {
+  /// DisableFramePointerElim - This returns true if frame pointer elimination
+  /// optimization should be disabled for the given machine function.
+  bool DisableFramePointerElim(const MachineFunction &MF) {
+    if (NoFramePointerElim)
+      return true;
+    if (NoFramePointerElimNonLeaf) {
+      const MachineFrameInfo *MFI = MF.getFrameInfo();
+      return MFI->hasCalls();
+    }
+    return false;
+  }
+
   /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
   /// is specified on the command line.  When this flag is off(default), the
   /// code generator is not allowed to generate mad (multiply add) if the

Modified: llvm/branches/Apple/Morbo/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/X86/X86RegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/X86/X86RegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -445,7 +445,7 @@
   const MachineFrameInfo *MFI = MF.getFrameInfo();
   const MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
 
-  return (NoFramePointerElim ||
+  return (DisableFramePointerElim(MF) ||
           needsStackRealignment(MF) ||
           MFI->hasVarSizedObjects() ||
           MFI->isFrameAddressTaken() ||

Modified: llvm/branches/Apple/Morbo/lib/Target/XCore/XCoreRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/XCore/XCoreRegisterInfo.cpp?rev=101991&r1=101990&r2=101991&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/XCore/XCoreRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/XCore/XCoreRegisterInfo.cpp Wed Apr 21 01:20:37 2010
@@ -117,7 +117,7 @@
 }
 
 bool XCoreRegisterInfo::hasFP(const MachineFunction &MF) const {
-  return NoFramePointerElim || MF.getFrameInfo()->hasVarSizedObjects();
+  return DisableFramePointerElim(MF) || MF.getFrameInfo()->hasVarSizedObjects();
 }
 
 // This function eliminates ADJCALLSTACKDOWN,





More information about the llvm-branch-commits mailing list