aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/ScalarEvolutionExpressions.h
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2007-11-25 22:41:31 +0000
committerNick Lewycky <nicholas@mxc.ca>2007-11-25 22:41:31 +0000
commit711640abd4e105e87eff7ad07a567cdfbc7d6472 (patch)
tree89d177bb9a1e54eae89f8c6a73192dcc9971159d /include/llvm/Analysis/ScalarEvolutionExpressions.h
parent53f85a7a10124eb5c0569e416b4d73192e846a47 (diff)
downloadexternal_llvm-711640abd4e105e87eff7ad07a567cdfbc7d6472.zip
external_llvm-711640abd4e105e87eff7ad07a567cdfbc7d6472.tar.gz
external_llvm-711640abd4e105e87eff7ad07a567cdfbc7d6472.tar.bz2
Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolutionExpressions.h')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h29
1 files changed, 27 insertions, 2 deletions
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: