mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 06:32:09 +00:00
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
This commit is contained in:
parent
a4e4b23b6d
commit
9261f0e02b
@ -8,22 +8,34 @@
|
|||||||
#ifndef LLVM_ANALYSIS_LOOP_DEPTH_H
|
#ifndef LLVM_ANALYSIS_LOOP_DEPTH_H
|
||||||
#define LLVM_ANALYSIS_LOOP_DEPTH_H
|
#define LLVM_ANALYSIS_LOOP_DEPTH_H
|
||||||
|
|
||||||
#include <map>
|
#include "llvm/Pass.h"
|
||||||
class BasicBlock;
|
namespace cfg {
|
||||||
class Method;
|
class LoopInfo;
|
||||||
namespace cfg {class Interval; }
|
|
||||||
|
|
||||||
class LoopDepthCalculator {
|
class LoopDepthCalculator : public MethodPass {
|
||||||
std::map<const BasicBlock*, unsigned> LoopDepth;
|
std::map<const BasicBlock*, unsigned> LoopDepth;
|
||||||
inline void AddBB(const BasicBlock *BB); // Increment count for this block
|
void calculate(Method *M, LoopInfo &Loops);
|
||||||
inline void ProcessInterval(cfg::Interval *I);
|
|
||||||
public:
|
public:
|
||||||
|
static AnalysisID ID; // cfg::LoopDepth Analysis ID
|
||||||
|
|
||||||
|
LoopDepthCalculator(AnalysisID id) { assert(id == ID); }
|
||||||
LoopDepthCalculator(Method *M);
|
LoopDepthCalculator(Method *M);
|
||||||
|
|
||||||
|
// This is a pass...
|
||||||
|
bool runOnMethod(Method *M);
|
||||||
|
|
||||||
inline unsigned getLoopDepth(const BasicBlock *BB) const {
|
inline unsigned getLoopDepth(const BasicBlock *BB) const {
|
||||||
std::map<const BasicBlock*,unsigned>::const_iterator I = LoopDepth.find(BB);
|
std::map<const BasicBlock*,unsigned>::const_iterator I = LoopDepth.find(BB);
|
||||||
return I != LoopDepth.end() ? I->second : 0;
|
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
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user