diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-17 23:21:44 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-17 23:21:44 +0000 |
commit | 714b5290b04e08570dae4304c1c92d30c06d3c99 (patch) | |
tree | 7c383ca36ec24098ed0492d7fc4edb978b1c35f6 /include/llvm/Analysis/ScalarEvolution.h | |
parent | e7c682b54390b87cc2264963e957e9b754b59162 (diff) | |
download | external_llvm-714b5290b04e08570dae4304c1c92d30c06d3c99.zip external_llvm-714b5290b04e08570dae4304c1c92d30c06d3c99.tar.gz external_llvm-714b5290b04e08570dae4304c1c92d30c06d3c99.tar.bz2 |
Merge the implementations of isLoopInvariant and hasComputableLoopEvolution, and
memoize the results. This improves compile time in code which highly complex
expressions which get queried many times.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/ScalarEvolution.h')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 750a090..26eceba 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -142,6 +142,16 @@ namespace llvm { /// they must ask this class for services. /// class ScalarEvolution : public FunctionPass { + public: + /// LoopDisposition - An enum describing the relationship between a + /// SCEV and a loop. + enum LoopDisposition { + LoopVariant, ///< The SCEV is loop-variant (unknown). + LoopInvariant, ///< The SCEV is loop-invariant. + LoopComputable ///< The SCEV varies predictably with the loop. + }; + + private: /// SCEVCallbackVH - A CallbackVH to arrange for ScalarEvolution to be /// notified whenever a Value is deleted. class SCEVCallbackVH : public CallbackVH { @@ -229,6 +239,13 @@ namespace llvm { std::map<const SCEV *, std::map<const Loop *, const SCEV *> > ValuesAtScopes; + /// LoopDispositions - Memoized computeLoopDisposition results. + std::map<const SCEV *, + std::map<const Loop *, LoopDisposition> > LoopDispositions; + + /// computeLoopDisposition - Compute a LoopDisposition value. + LoopDisposition computeLoopDisposition(const SCEV *S, const Loop *L); + /// UnsignedRanges - Memoized results from getUnsignedRange DenseMap<const SCEV *, ConstantRange> UnsignedRanges; @@ -663,6 +680,10 @@ namespace llvm { const SCEV *&LHS, const SCEV *&RHS); + /// getLoopDisposition - Return the "disposition" of the given SCEV with + /// respect to the given loop. + LoopDisposition getLoopDisposition(const SCEV *S, const Loop *L); + /// isLoopInvariant - Return true if the value of the given SCEV is /// unchanging in the specified loop. bool isLoopInvariant(const SCEV *S, const Loop *L); |