[llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h

Nate Begeman natebegeman at mac.com
Wed Oct 19 19:14:25 PDT 2005



Changes in directory llvm/include/llvm/Target:

TargetLowering.h updated: 1.25 -> 1.26
---
Log message:

Enable targets to say that integer divide is expensive, which will trigger
an upcoming optimization in the DAG Combiner.


---
Diffs of the changes:  (+16 -0)

 TargetLowering.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)


Index: llvm/include/llvm/Target/TargetLowering.h
diff -u llvm/include/llvm/Target/TargetLowering.h:1.25 llvm/include/llvm/Target/TargetLowering.h:1.26
--- llvm/include/llvm/Target/TargetLowering.h:1.25	Tue Oct 18 18:23:37 2005
+++ llvm/include/llvm/Target/TargetLowering.h	Wed Oct 19 21:14:14 2005
@@ -83,6 +83,10 @@
   /// isSetCCExpensive - Return true if the setcc operation is expensive for
   /// this target.
   bool isSetCCExpensive() const { return SetCCIsExpensive; }
+  
+  /// isIntDivExpensive() - Return true if integer divide is more expensive than
+  /// a sequence of several shifts, adds, and multiplies for this target.
+  bool isIntDivExpensive() const { return IntDivIsExpensive; }
 
   /// getSetCCResultTy - Return the ValueType of the result of setcc operations.
   ///
@@ -262,6 +266,11 @@
   /// setcc operations into other operations if possible.
   void setSetCCIsExpensive() { SetCCIsExpensive = true; }
 
+  /// setIntDivIsExpensive - Tells the code generator that integer divide is
+  /// expensive, and if possible, should be replaced by an alternate sequence
+  /// of instructions not containing an integer divide.
+  void setIntDivIsExpensive() { IntDivIsExpensive = true; }
+  
   /// addRegisterClass - Add the specified register class as an available
   /// regclass for the specified value type.  This indicates the selector can
   /// handle values of that class natively.
@@ -391,6 +400,13 @@
   /// setcc operations into other operations if possible.
   bool SetCCIsExpensive;
 
+  /// IntDivIsExpensive - This is a hack until a real costs model is in place
+  /// that tells the code generator whether integer divide will always be more
+  /// expensive than a sequence of multiplies, shifts, and adds that performs
+  /// the same operation.  If we ever optimize for size, this will be set to
+  /// false unconditionally.
+  bool IntDivIsExpensive;
+  
   /// SetCCResultTy - The type that SetCC operations use.  This defaults to the
   /// PointerTy.
   MVT::ValueType SetCCResultTy;






More information about the llvm-commits mailing list