aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis/LoopInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Analysis/LoopInfo.h')
-rw-r--r--include/llvm/Analysis/LoopInfo.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 6c9468c..edbd55d 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -23,7 +23,7 @@ namespace cfg {
//
class Loop {
Loop *ParentLoop;
- std::vector<const BasicBlock *> Blocks; // First entry is the header node
+ std::vector<BasicBlock *> Blocks; // First entry is the header node
std::vector<Loop*> SubLoops; // Loops contained entirely within this one
unsigned LoopDepth; // Nesting depth of this loop
@@ -32,20 +32,18 @@ class Loop {
public:
inline unsigned getLoopDepth() const { return LoopDepth; }
- inline const BasicBlock *getHeader() const { return Blocks.front(); }
+ inline BasicBlock *getHeader() const { return Blocks.front(); }
// contains - Return true of the specified basic block is in this loop
- bool contains(const BasicBlock *BB) const;
+ bool contains(BasicBlock *BB) const;
// getSubLoops - Return the loops contained entirely within this loop
inline const std::vector<Loop*> &getSubLoops() const { return SubLoops; }
- inline const std::vector<const BasicBlock*> &getBlocks() const {
- return Blocks;
- }
+ inline const std::vector<BasicBlock*> &getBlocks() const { return Blocks; }
private:
friend class LoopInfo;
- inline Loop(const BasicBlock *BB) { Blocks.push_back(BB); LoopDepth = 0; }
+ inline Loop(BasicBlock *BB) { Blocks.push_back(BB); LoopDepth = 0; }
~Loop() {
for (unsigned i = 0, e = SubLoops.size(); i != e; ++i)
delete SubLoops[i];
@@ -66,7 +64,7 @@ private:
//
class LoopInfo : public FunctionPass {
// BBMap - Mapping of basic blocks to the inner most loop they occur in
- std::map<const BasicBlock *, Loop*> BBMap;
+ std::map<BasicBlock*, Loop*> BBMap;
std::vector<Loop*> TopLevelLoops;
public:
static AnalysisID ID; // cfg::LoopInfo Analysis ID
@@ -80,29 +78,29 @@ public:
// getLoopFor - Return the inner most loop that BB lives in. If a basic block
// is in no loop (for example the entry node), null is returned.
//
- const Loop *getLoopFor(const BasicBlock *BB) const {
- std::map<const BasicBlock *, Loop*>::const_iterator I = BBMap.find(BB);
+ const Loop *getLoopFor(BasicBlock *BB) const {
+ std::map<BasicBlock *, Loop*>::const_iterator I = BBMap.find(BB);
return I != BBMap.end() ? I->second : 0;
}
- inline const Loop *operator[](const BasicBlock *BB) const {
+ inline const Loop *operator[](BasicBlock *BB) const {
return getLoopFor(BB);
}
// getLoopDepth - Return the loop nesting level of the specified block...
- unsigned getLoopDepth(const BasicBlock *BB) const {
+ unsigned getLoopDepth(BasicBlock *BB) const {
const Loop *L = getLoopFor(BB);
return L ? L->getLoopDepth() : 0;
}
#if 0
// isLoopHeader - True if the block is a loop header node
- bool isLoopHeader(const BasicBlock *BB) const {
+ bool isLoopHeader(BasicBlock *BB) const {
return getLoopFor(BB)->getHeader() == BB;
}
// isLoopEnd - True if block jumps to loop entry
- bool isLoopEnd(const BasicBlock *BB) const;
+ bool isLoopEnd(BasicBlock *BB) const;
// isLoopExit - True if block is the loop exit
- bool isLoopExit(const BasicBlock *BB) const;
+ bool isLoopExit(BasicBlock *BB) const;
#endif
// runOnFunction - Pass framework implementation
@@ -116,7 +114,7 @@ public:
private:
void Calculate(const DominatorSet &DS);
- Loop *ConsiderForLoop(const BasicBlock *BB, const DominatorSet &DS);
+ Loop *ConsiderForLoop(BasicBlock *BB, const DominatorSet &DS);
};
} // End namespace cfg