diff options
author | Chris Lattner <sabre@nondot.org> | 2002-01-31 00:41:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-01-31 00:41:01 +0000 |
commit | 9261f0e02b867be5825924a09569f19705cfe2eb (patch) | |
tree | 87e5864cedc00b2366347a84d4ab27bd42ea88fe | |
parent | a4e4b23b6d778e546aa0dcd0ee95088ce7a96022 (diff) | |
download | external_llvm-9261f0e02b867be5825924a09569f19705cfe2eb.zip external_llvm-9261f0e02b867be5825924a09569f19705cfe2eb.tar.gz external_llvm-9261f0e02b867be5825924a09569f19705cfe2eb.tar.bz2 |
Implement LoopDepth calculation in terms of dominators instead of intervals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1600 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/LoopDepth.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/include/llvm/Analysis/LoopDepth.h b/include/llvm/Analysis/LoopDepth.h index 89068d6..861a384 100644 --- a/include/llvm/Analysis/LoopDepth.h +++ b/include/llvm/Analysis/LoopDepth.h @@ -8,22 +8,34 @@ #ifndef LLVM_ANALYSIS_LOOP_DEPTH_H #define LLVM_ANALYSIS_LOOP_DEPTH_H -#include <map> -class BasicBlock; -class Method; -namespace cfg {class Interval; } +#include "llvm/Pass.h" +namespace cfg { + class LoopInfo; -class LoopDepthCalculator { +class LoopDepthCalculator : public MethodPass { std::map<const BasicBlock*, unsigned> LoopDepth; - inline void AddBB(const BasicBlock *BB); // Increment count for this block - inline void ProcessInterval(cfg::Interval *I); + void calculate(Method *M, LoopInfo &Loops); public: + static AnalysisID ID; // cfg::LoopDepth Analysis ID + + LoopDepthCalculator(AnalysisID id) { assert(id == ID); } LoopDepthCalculator(Method *M); + // This is a pass... + bool runOnMethod(Method *M); + inline unsigned getLoopDepth(const BasicBlock *BB) const { std::map<const BasicBlock*,unsigned>::const_iterator I = LoopDepth.find(BB); return I != LoopDepth.end() ? I->second : 0; } + + // getAnalysisUsageInfo - Provide loop depth, require loop info + // + virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires, + Pass::AnalysisSet &Destroyed, + Pass::AnalysisSet &Provided); }; +} // end namespace cfg + #endif |