1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

Implement LoopDepth calculation in terms of dominators instead of intervals

llvm-svn: 1600
This commit is contained in:
Chris Lattner 2002-01-31 00:41:01 +00:00
parent 85b82a690e
commit 5c1e4c976e

View File

@ -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