Add target hook to specify block size limit for if-conversion.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 16 May 2007 23:45:53 +0000 (23:45 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 16 May 2007 23:45:53 +0000 (23:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37134 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetInstrInfo.h
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 00a05569b95d8ff0478d4dcbc67d84b80e21816f..4c0e1b8e941d14c2dd98c5f04cf5ed7d8b927a4d 100644 (file)
@@ -394,6 +394,11 @@ public:
   virtual bool PredicateInstruction(MachineInstr *MI,
                                     std::vector<MachineOperand> &Cond) const;
 
+  /// getBlockSize - Calculate the size of the specified MachineBasicBlock.
+  /// Note the result may not be 100% accurate especially if there are inline
+  /// asm's in the block.
+  virtual unsigned getBlockSize(MachineBasicBlock *MBB) const;
+
   /// getPointerRegClass - Returns a TargetRegisterClass used for pointer
   /// values.
   virtual const TargetRegisterClass *getPointerRegClass() const {
index 68807081305b1454dc55a9d8a2896012e102aebb..d736a3ad202104e07ee04fc7b1573f034c8fc546 100644 (file)
@@ -434,6 +434,12 @@ public:
     return JumpBufAlignment;
   }
 
+  /// getIfCvtBlockLimit - returns the target specific if-conversion block size
+  /// limit. Any block whose size is greater should not be predicated.
+  virtual unsigned getIfCvtBlockSizeLimit() const {
+    return IfCvtBlockSizeLimit;
+  }
+
   /// getPreIndexedAddressParts - returns true by value, base pointer and
   /// offset pointer and addressing mode by reference if the node's address
   /// can be legally represented as pre-indexed load / store address.
@@ -750,6 +756,12 @@ protected:
   void setJumpBufAlignment(unsigned Align) {
     JumpBufAlignment = Align;
   }
+
+  /// setIfCvtBlockSizeLimit - Set the target's if-conversion block size limit;
+  /// default is 2.
+  void setIfCvtBlockSizeLimit(unsigned Limit) {
+    IfCvtBlockSizeLimit = Limit;
+  }
   
 public:
 
@@ -982,6 +994,10 @@ private:
   /// JumpBufAlignment - The alignment, in bytes, of the target's jmp_buf
   /// buffers
   unsigned JumpBufAlignment;
+
+  /// IfCvtBlockSizeLimit - The maximum allowed block size for if-conversion.
+  /// 
+  unsigned IfCvtBlockSizeLimit;
   
   /// StackPointerRegisterToSaveRestore - If set to a physical register, this
   /// specifies the register that llvm.savestack/llvm.restorestack should save
index 1a8a4bc349feea77e975f9719289fc86c00ee47d..970533b9a5133b6ea6516e810c49862323af112d 100644 (file)
@@ -157,6 +157,7 @@ TargetLowering::TargetLowering(TargetMachine &tm)
   SchedPreferenceInfo = SchedulingForLatency;
   JumpBufSize = 0;
   JumpBufAlignment = 0;
+  IfCvtBlockSizeLimit = 2;
 
   InitLibcallNames(LibcallRoutineNames);
   InitCmpLibcallCCs(CmpLibcallCCs);