aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombine.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-04 07:37:31 +0000
committerChris Lattner <sabre@nondot.org>2010-01-04 07:37:31 +0000
commit02446fc99abb06d3117d65c0b1f5fba4f906db2e (patch)
tree594c4fcf9a773405fb795f55c7bf4dfaa5b45106 /lib/Transforms/InstCombine/InstCombine.h
parenta766e19705df9e2005cb0b6e09ea9d1d9e237cdc (diff)
split instcombine of compares (visit[FI]Cmp) out to
a new InstCombineCompares.cpp file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombine.h')
-rw-r--r--lib/Transforms/InstCombine/InstCombine.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombine.h b/lib/Transforms/InstCombine/InstCombine.h
index d4d26f8e34..a1e9f2ffe3 100644
--- a/lib/Transforms/InstCombine/InstCombine.h
+++ b/lib/Transforms/InstCombine/InstCombine.h
@@ -32,6 +32,20 @@ enum SelectPatternFlavor {
SPF_SMAX, SPF_UMAX
//SPF_ABS - TODO.
};
+
+/// getComplexity: Assign a complexity or rank value to LLVM Values...
+/// 0 -> undef, 1 -> Const, 2 -> Other, 3 -> Arg, 3 -> Unary, 4 -> OtherInst
+static inline unsigned getComplexity(Value *V) {
+ if (isa<Instruction>(V)) {
+ if (BinaryOperator::isNeg(V) ||
+ BinaryOperator::isFNeg(V) ||
+ BinaryOperator::isNot(V))
+ return 3;
+ return 4;
+ }
+ if (isa<Argument>(V)) return 3;
+ return isa<Constant>(V) ? (isa<UndefValue>(V) ? 0 : 1) : 2;
+}
/// InstCombineIRInserter - This is an IRBuilder insertion helper that works
@@ -179,6 +193,8 @@ public:
Instruction *visitInstruction(Instruction &I) { return 0; }
private:
+ Value *dyn_castNegVal(Value *V) const;
+
Instruction *visitCallSite(CallSite CS);
bool transformConstExprCastCall(CallSite CS);
Instruction *transformCallThroughTrampoline(CallSite CS);
@@ -186,7 +202,7 @@ private:
bool DoXform = true);
bool WillNotOverflowSignedAdd(Value *LHS, Value *RHS);
DbgDeclareInst *hasOneUsePlusDeclare(Value *V);
-
+ Value *EmitGEPOffset(User *GEP);
public:
// InsertNewInstBefore - insert an instruction New before instruction Old