aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/ScalarEvolutionExpressions.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-13 04:34:51 +0000
committerChris Lattner <sabre@nondot.org>2005-02-13 04:34:51 +0000
commitafc0dc7184cf73ff7ac64e516284fbe0c7023ba4 (patch)
tree3a8b63557c51b5c82ed11ab40e7f8fb516915ccd /include/llvm/Analysis/ScalarEvolutionExpressions.h
parent39bcf5b8d0cdd67a199da15dbdf97970099b7214 (diff)
downloadexternal_llvm-afc0dc7184cf73ff7ac64e516284fbe0c7023ba4.tar.gz
external_llvm-afc0dc7184cf73ff7ac64e516284fbe0c7023ba4.tar.bz2
external_llvm-afc0dc7184cf73ff7ac64e516284fbe0c7023ba4.zip
Add a new replaceSymbolicValuesWithConcrete method to the SCEV class,
adjust const'ness a bit to be more correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolutionExpressions.h')
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 607ec776d6..8f113a4004 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -56,6 +56,11 @@ namespace llvm {
virtual const Type *getType() const;
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const {
+ return this;
+ }
+
virtual void print(std::ostream &OS) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -90,6 +95,14 @@ namespace llvm {
return Op->hasComputableLoopEvolution(L);
}
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const {
+ SCEVHandle H = Op->replaceSymbolicValuesWithConcrete(Sym, Conc);
+ if (H == Op)
+ return this;
+ return get(H, Ty);
+ }
+
/// getValueRange - Return the tightest constant bounds that this value is
/// known to have. This method is only valid on integer SCEV objects.
virtual ConstantRange getValueRange() const;
@@ -132,6 +145,14 @@ namespace llvm {
/// known to have. This method is only valid on integer SCEV objects.
virtual ConstantRange getValueRange() const;
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const {
+ SCEVHandle H = Op->replaceSymbolicValuesWithConcrete(Sym, Conc);
+ if (H == Op)
+ return this;
+ return get(H, Ty);
+ }
+
virtual void print(std::ostream &OS) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -182,6 +203,9 @@ namespace llvm {
return false;
}
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const;
+
virtual const char *getOperationStr() const = 0;
virtual const Type *getType() const { return getOperand(0)->getType(); }
@@ -286,6 +310,17 @@ namespace llvm {
RHS->hasComputableLoopEvolution(L);
}
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const {
+ SCEVHandle L = LHS->replaceSymbolicValuesWithConcrete(Sym, Conc);
+ SCEVHandle R = RHS->replaceSymbolicValuesWithConcrete(Sym, Conc);
+ if (L == LHS && R == RHS)
+ return this;
+ else
+ return get(L, R);
+ }
+
+
virtual const Type *getType() const;
void print(std::ostream &OS) const;
@@ -383,6 +418,8 @@ namespace llvm {
/// returned.
SCEVHandle getNumIterationsInRange(ConstantRange Range) const;
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const;
virtual void print(std::ostream &OS) const;
@@ -420,6 +457,12 @@ namespace llvm {
return false; // not computable
}
+ SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
+ const SCEVHandle &Conc) const {
+ if (&*Sym == this) return Conc;
+ return this;
+ }
+
virtual const Type *getType() const;
virtual void print(std::ostream &OS) const;