diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-18 00:34:22 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-18 00:34:22 +0000 |
commit | 9c9fcfc719158a46cb2e41b66d7dc1a63cd48d74 (patch) | |
tree | 0cb0e06e1130bcdd21c88cffb2b516e27bb31a56 /include | |
parent | 18333616cd824bee3abecd607d3aa432b5cf507d (diff) | |
download | external_llvm-9c9fcfc719158a46cb2e41b66d7dc1a63cd48d74.zip external_llvm-9c9fcfc719158a46cb2e41b66d7dc1a63cd48d74.tar.gz external_llvm-9c9fcfc719158a46cb2e41b66d7dc1a63cd48d74.tar.bz2 |
Introduce memoization for ScalarEvolution dominates and properlyDominates
queries, and SCEVExpander getRelevantLoop queries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 23 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolutionExpander.h | 6 |
2 files changed, 27 insertions, 2 deletions
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 4ae0f5a..94da1ec 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -151,6 +151,14 @@ namespace llvm { LoopComputable ///< The SCEV varies predictably with the loop. }; + /// BlockDisposition - An enum describing the relationship between a + /// SCEV and a basic block. + enum BlockDisposition { + DoesNotDominateBlock, ///< The SCEV does not dominate the block. + DominatesBlock, ///< The SCEV dominates the block. + ProperlyDominatesBlock ///< The SCEV properly dominates the block. + }; + private: /// SCEVCallbackVH - A CallbackVH to arrange for ScalarEvolution to be /// notified whenever a Value is deleted. @@ -246,6 +254,13 @@ namespace llvm { /// computeLoopDisposition - Compute a LoopDisposition value. LoopDisposition computeLoopDisposition(const SCEV *S, const Loop *L); + /// BlockDispositions - Memoized computeBlockDisposition results. + std::map<const SCEV *, + std::map<const BasicBlock *, BlockDisposition> > BlockDispositions; + + /// computeBlockDisposition - Compute a BlockDisposition value. + BlockDisposition computeBlockDisposition(const SCEV *S, const BasicBlock *BB); + /// UnsignedRanges - Memoized results from getUnsignedRange DenseMap<const SCEV *, ConstantRange> UnsignedRanges; @@ -697,13 +712,17 @@ namespace llvm { /// to compute the value of the expression at any particular loop iteration. bool hasComputableLoopEvolution(const SCEV *S, const Loop *L); + /// getLoopDisposition - Return the "disposition" of the given SCEV with + /// respect to the given block. + BlockDisposition getBlockDisposition(const SCEV *S, const BasicBlock *BB); + /// dominates - Return true if elements that makes up the given SCEV /// dominate the specified basic block. - bool dominates(const SCEV *S, BasicBlock *BB) const; + bool dominates(const SCEV *S, const BasicBlock *BB); /// properlyDominates - Return true if elements that makes up the given SCEV /// properly dominate the specified basic block. - bool properlyDominates(const SCEV *S, BasicBlock *BB) const; + bool properlyDominates(const SCEV *S, const BasicBlock *BB); /// hasOperand - Test whether the given SCEV has Op as a direct or /// indirect operand. diff --git a/include/llvm/Analysis/ScalarEvolutionExpander.h b/include/llvm/Analysis/ScalarEvolutionExpander.h index 4b02f82..39d378e 100644 --- a/include/llvm/Analysis/ScalarEvolutionExpander.h +++ b/include/llvm/Analysis/ScalarEvolutionExpander.h @@ -35,6 +35,9 @@ namespace llvm { std::set<AssertingVH<Value> > InsertedValues; std::set<AssertingVH<Value> > InsertedPostIncValues; + /// RelevantLoops - A memoization of the "relevant" loop for a given SCEV. + DenseMap<const SCEV *, const Loop *> RelevantLoops; + /// PostIncLoops - Addrecs referring to any of the given loops are expanded /// in post-inc mode. For example, expanding {1,+,1}<L> in post-inc mode /// returns the add instruction that adds one to the phi for {0,+,1}<L>, @@ -168,6 +171,9 @@ namespace llvm { return InsertedValues.count(I) || InsertedPostIncValues.count(I); } + /// getRelevantLoop - Determine the most "relevant" loop for the given SCEV. + const Loop *getRelevantLoop(const SCEV *); + Value *visitConstant(const SCEVConstant *S) { return S->getValue(); } |