diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolutionExpander.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolutionExpressions.h | 29 |
3 files changed, 31 insertions, 2 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index a52f273..d0886e8 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -235,6 +235,8 @@ namespace llvm { std::vector<SCEVHandle> NewOp(Operands); return getAddRecExpr(NewOp, L); } + SCEVHandle getSMaxExpr(const SCEVHandle &LHS, const SCEVHandle &RHS); + SCEVHandle getSMaxExpr(std::vector<SCEVHandle> Operands); SCEVHandle getUnknown(Value *V); /// getNegativeSCEV - Return the SCEV object corresponding to -V. diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 8582067..6529902 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -134,6 +134,8 @@ namespace llvm { Value *visitAddRecExpr(SCEVAddRecExpr *S); + Value *visitSMaxExpr(SCEVSMaxExpr *S); + Value *visitUnknown(SCEVUnknown *S) { return S->getValue(); } diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h index fb69a90..f639243 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpressions.h +++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h @@ -25,7 +25,7 @@ namespace llvm { // These should be ordered in terms of increasing complexity to make the // folders simpler. scConstant, scTruncate, scZeroExtend, scSignExtend, scAddExpr, scMulExpr, - scSDivExpr, scAddRecExpr, scUnknown, scCouldNotCompute + scSDivExpr, scAddRecExpr, scSMaxExpr, scUnknown, scCouldNotCompute }; //===--------------------------------------------------------------------===// @@ -274,7 +274,8 @@ namespace llvm { static inline bool classof(const SCEVCommutativeExpr *S) { return true; } static inline bool classof(const SCEV *S) { return S->getSCEVType() == scAddExpr || - S->getSCEVType() == scMulExpr; + S->getSCEVType() == scMulExpr || + S->getSCEVType() == scSMaxExpr; } }; @@ -459,6 +460,28 @@ namespace llvm { } }; + + //===--------------------------------------------------------------------===// + /// SCEVSMaxExpr - This class represents a signed maximum selection. + /// + class SCEVSMaxExpr : public SCEVCommutativeExpr { + friend class ScalarEvolution; + + explicit SCEVSMaxExpr(const std::vector<SCEVHandle> &ops) + : SCEVCommutativeExpr(scSMaxExpr, ops) { + } + + public: + virtual const char *getOperationStr() const { return " smax "; } + + /// Methods for support type inquiry through isa, cast, and dyn_cast: + static inline bool classof(const SCEVSMaxExpr *S) { return true; } + static inline bool classof(const SCEV *S) { + return S->getSCEVType() == scSMaxExpr; + } + }; + + //===--------------------------------------------------------------------===// /// SCEVUnknown - This means that we are dealing with an entirely unknown SCEV /// value, and only represent it as it's LLVM Value. This is the "bottom" @@ -521,6 +544,8 @@ namespace llvm { return ((SC*)this)->visitSDivExpr((SCEVSDivExpr*)S); case scAddRecExpr: return ((SC*)this)->visitAddRecExpr((SCEVAddRecExpr*)S); + case scSMaxExpr: + return ((SC*)this)->visitSMaxExpr((SCEVSMaxExpr*)S); case scUnknown: return ((SC*)this)->visitUnknown((SCEVUnknown*)S); case scCouldNotCompute: |