diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-04 07:37:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-04 07:37:31 +0000 |
commit | 2188e40e4c43056348f3163c1a471cd0e651ca5a (patch) | |
tree | 75dc1e679ed7dddc09cd8dbe7ae95d4788232c68 /llvm/lib/Transforms/InstCombine/InstCombine.h | |
parent | 6ea40f1542a21561b3ea3993d94e53c6598cd415 (diff) | |
download | bcm5719-llvm-2188e40e4c43056348f3163c1a471cd0e651ca5a.tar.gz bcm5719-llvm-2188e40e4c43056348f3163c1a471cd0e651ca5a.zip |
split instcombine of compares (visit[FI]Cmp) out to
a new InstCombineCompares.cpp file.
llvm-svn: 92467
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombine.h')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombine.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombine.h b/llvm/lib/Transforms/InstCombine/InstCombine.h index d4d26f8e348..a1e9f2ffe31 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombine.h +++ b/llvm/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 |