diff options
author | ed <ed@FreeBSD.org> | 2009-07-04 13:58:26 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-07-04 13:58:26 +0000 |
commit | 72621d11de5b873f1695f391eb95f0b336c3d2d4 (patch) | |
tree | 84360c8989c912127a383af37c4b1aa5767bd16e /include/llvm/Analysis/ScalarEvolution.h | |
parent | cf5cd875b51255602afaed29deb636b66b295671 (diff) | |
download | FreeBSD-src-72621d11de5b873f1695f391eb95f0b336c3d2d4.zip FreeBSD-src-72621d11de5b873f1695f391eb95f0b336c3d2d4.tar.gz |
Import LLVM 74788.
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolution.h')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index d699775..9da5c59 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -25,6 +25,8 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/ValueHandle.h" +#include "llvm/Support/Allocator.h" +#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/DenseMap.h" #include <iosfwd> @@ -34,20 +36,12 @@ namespace llvm { class Type; class ScalarEvolution; class TargetData; - class SCEVConstant; - class SCEVTruncateExpr; - class SCEVZeroExtendExpr; - class SCEVCommutativeExpr; - class SCEVUDivExpr; - class SCEVSignExtendExpr; - class SCEVAddRecExpr; - class SCEVUnknown; /// SCEV - This class represents an analyzed expression in the program. These /// are opaque objects that the client is not allowed to do much with /// directly. /// - class SCEV { + class SCEV : public FoldingSetNode { const unsigned SCEVType; // The SCEV baseclass this node corresponds to SCEV(const SCEV &); // DO NOT IMPLEMENT @@ -58,6 +52,8 @@ namespace llvm { explicit SCEV(unsigned SCEVTy) : SCEVType(SCEVTy) {} + virtual void Profile(FoldingSetNodeID &ID) const = 0; + unsigned getSCEVType() const { return SCEVType; } /// isLoopInvariant - Return true if the value of this SCEV is unchanging in @@ -132,6 +128,7 @@ namespace llvm { SCEVCouldNotCompute(); // None of these methods are valid for this object. + virtual void Profile(FoldingSetNodeID &ID) const; virtual bool isLoopInvariant(const Loop *L) const; virtual const Type *getType() const; virtual bool hasComputableLoopEvolution(const Loop *L) const; @@ -182,7 +179,7 @@ namespace llvm { /// CouldNotCompute - This SCEV is used to represent unknown trip /// counts and things. - const SCEV* CouldNotCompute; + SCEVCouldNotCompute CouldNotCompute; /// Scalars - This is a cache of the scalars we have analyzed so far. /// @@ -566,23 +563,10 @@ namespace llvm { void print(std::ostream *OS, const Module* M = 0) const { if (OS) print(*OS, M); } - + private: - // Uniquing tables. - std::map<ConstantInt*, SCEVConstant*> SCEVConstants; - std::map<std::pair<const SCEV*, const Type*>, - SCEVTruncateExpr*> SCEVTruncates; - std::map<std::pair<const SCEV*, const Type*>, - SCEVZeroExtendExpr*> SCEVZeroExtends; - std::map<std::pair<unsigned, std::vector<const SCEV*> >, - SCEVCommutativeExpr*> SCEVCommExprs; - std::map<std::pair<const SCEV*, const SCEV*>, - SCEVUDivExpr*> SCEVUDivs; - std::map<std::pair<const SCEV*, const Type*>, - SCEVSignExtendExpr*> SCEVSignExtends; - std::map<std::pair<const Loop *, std::vector<const SCEV*> >, - SCEVAddRecExpr*> SCEVAddRecExprs; - std::map<Value*, SCEVUnknown*> SCEVUnknowns; + FoldingSet<SCEV> UniqueSCEVs; + BumpPtrAllocator SCEVAllocator; }; } |