[llvm-branch-commits] [llvm-branch] r71733 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/SelectionDAG.h include/llvm/Target/TargetLowering.h lib/CodeGen/CodePlacementOpt.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp

Bill Wendling isanbard at gmail.com
Wed May 13 14:56:10 PDT 2009


Author: void
Date: Wed May 13 16:56:05 2009
New Revision: 71733

URL: http://llvm.org/viewvc/llvm-project?rev=71733&view=rev
Log:
--- Merging r71726 into '.':
U    include/llvm/Target/TargetLowering.h
U    lib/CodeGen/CodePlacementOpt.cpp
U    lib/CodeGen/SelectionDAG/TargetLowering.cpp
U    lib/Target/ARM/ARMISelLowering.cpp
U    lib/Target/X86/X86ISelLowering.cpp

Run code placement optimization for targets that want it (arm and x86 for now).

Modified:
    llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h
    llvm/branches/Apple/Dib/include/llvm/Target/TargetLowering.h
    llvm/branches/Apple/Dib/lib/CodeGen/CodePlacementOpt.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    llvm/branches/Apple/Dib/lib/Target/ARM/ARMISelLowering.cpp
    llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h?rev=71733&r1=71732&r2=71733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/SelectionDAG.h Wed May 13 16:56:05 2009
@@ -316,7 +316,7 @@
   // indicates that there is potentially an incoming flag value (if Flag is not
   // null) and that there should be a flag result.
   SDValue getCopyToReg(SDValue Chain, DebugLoc dl, unsigned Reg, SDValue N,
-                         SDValue Flag) {
+                       SDValue Flag) {
     SDVTList VTs = getVTList(MVT::Other, MVT::Flag);
     SDValue Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag };
     return getNode(ISD::CopyToReg, dl, VTs, Ops, Flag.getNode() ? 4 : 3);

Modified: llvm/branches/Apple/Dib/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Target/TargetLowering.h?rev=71733&r1=71732&r2=71733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/Target/TargetLowering.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/Target/TargetLowering.h Wed May 13 16:56:05 2009
@@ -618,6 +618,13 @@
     return allowUnalignedMemoryAccesses;
   }
 
+  /// This function returns true if the target would benefit from code placement
+  /// optimization.
+  /// @brief Determine if the target should perform code placement optimization.
+  bool shouldOptimizeCodePlacement() const {
+    return benefitFromCodePlacementOpt;
+  }
+
   /// getOptimalMemOpType - Returns the target specific optimal type for load
   /// and store operations as a result of memset, memcpy, and memmove lowering.
   /// It returns MVT::iAny if SelectionDAG should be responsible for
@@ -1648,6 +1655,10 @@
   /// operations when copying small arrays and other similar tasks.
   /// @brief Indicate whether the target permits unaligned memory accesses.
   bool allowUnalignedMemoryAccesses;
+
+  /// This field specifies whether the target can benefit from code placement
+  /// optimization.
+  bool benefitFromCodePlacementOpt;
 };
 } // end llvm namespace
 

Modified: llvm/branches/Apple/Dib/lib/CodeGen/CodePlacementOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/CodePlacementOpt.cpp?rev=71733&r1=71732&r2=71733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/CodePlacementOpt.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/CodePlacementOpt.cpp Wed May 13 16:56:05 2009
@@ -104,6 +104,9 @@
 ///       jcc <cond> C, [exit]
 ///
 bool CodePlacementOpt::OptimizeIntraLoopEdges() {
+  if (!TLI->shouldOptimizeCodePlacement())
+    return false;
+
   bool Changed = false;
   for (unsigned i = 0, e = UncondJmpMBBs.size(); i != e; ++i) {
     MachineBasicBlock *MBB = UncondJmpMBBs[i].first;

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=71733&r1=71732&r2=71733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed May 13 16:56:05 2009
@@ -478,6 +478,7 @@
   memset(TargetDAGCombineArray, 0, array_lengthof(TargetDAGCombineArray));
   maxStoresPerMemset = maxStoresPerMemcpy = maxStoresPerMemmove = 8;
   allowUnalignedMemoryAccesses = false;
+  benefitFromCodePlacementOpt = false;
   UseUnderscoreSetJmp = false;
   UseUnderscoreLongJmp = false;
   SelectIsExpensive = false;

Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMISelLowering.cpp?rev=71733&r1=71732&r2=71733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMISelLowering.cpp Wed May 13 16:56:05 2009
@@ -288,6 +288,7 @@
   setIfCvtDupBlockSizeLimit(Subtarget->isThumb() ? 0 : 2);
 
   maxStoresPerMemcpy = 1;   //// temporary - rewrite interface to use type
+  benefitFromCodePlacementOpt = true;
 }
 
 const char *ARMTargetLowering::getTargetNodeName(unsigned Opcode) const {

Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=71733&r1=71732&r2=71733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Wed May 13 16:56:05 2009
@@ -844,6 +844,7 @@
   maxStoresPerMemmove = 3; // For @llvm.memmove -> sequence of stores
   allowUnalignedMemoryAccesses = true; // x86 supports it!
   setPrefLoopAlignment(16);
+  benefitFromCodePlacementOpt = true;
 }
 
 





More information about the llvm-branch-commits mailing list