aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-10-20 02:14:14 +0000
committerNate Begeman <natebegeman@mac.com>2005-10-20 02:14:14 +0000
commitd32d4a93f6aa524116e7043a1d4059febab0de9b (patch)
treedc546d43574fcf81451a95df19aab833955cb448
parentd97591a9615512120b5ce9a8071b97a36ad7c76a (diff)
Enable targets to say that integer divide is expensive, which will trigger
an upcoming optimization in the DAG Combiner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23834 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetLowering.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 02278e9e42..47ca28cea9 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -83,6 +83,10 @@ public:
/// 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 @@ protected:
/// 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 @@ private:
/// 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;