summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-01 13:19:53 +0000
committerChris Lattner <sabre@nondot.org>2001-10-01 13:19:53 +0000
commitf0604b84c7273fc2503454ecaa198eaee5b615bd (patch)
treedc7298c5da5bb2b509412369dcdd01ac67b91c8d /lib/Analysis
parent711774e169526247db1838b96e379a4f4e9f2cad (diff)
downloadllvm-f0604b84c7273fc2503454ecaa198eaee5b615bd.tar.gz
llvm-f0604b84c7273fc2503454ecaa198eaee5b615bd.tar.bz2
llvm-f0604b84c7273fc2503454ecaa198eaee5b615bd.tar.xz
Pull predecessor and successor iterators out of the CFG*.h files, and plop them into
the BasicBlock class where they should be. pred_begin/pred_end become methods on BasicBlock, and the cfg namespace isn't used anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/Interval.cpp8
-rw-r--r--lib/Analysis/LiveVar/BBLiveVar.cpp4
-rw-r--r--lib/Analysis/LiveVar/BBLiveVar.h3
-rw-r--r--lib/Analysis/PostDominators.cpp14
4 files changed, 14 insertions, 15 deletions
diff --git a/lib/Analysis/Interval.cpp b/lib/Analysis/Interval.cpp
index 97fa34ea7a..5c68be9c2e 100644
--- a/lib/Analysis/Interval.cpp
+++ b/lib/Analysis/Interval.cpp
@@ -8,19 +8,17 @@
#include "llvm/Analysis/Interval.h"
#include "llvm/BasicBlock.h"
-using namespace cfg;
-
//===----------------------------------------------------------------------===//
// Interval Implementation
//===----------------------------------------------------------------------===//
// isLoop - Find out if there is a back edge in this interval...
//
-bool Interval::isLoop() const {
+bool cfg::Interval::isLoop() const {
// There is a loop in this interval iff one of the predecessors of the header
// node lives in the interval.
- for (BasicBlock::pred_iterator I = pred_begin(HeaderNode),
- E = pred_end(HeaderNode); I != E; ++I) {
+ for (BasicBlock::pred_iterator I = HeaderNode->pred_begin(),
+ E = HeaderNode->pred_end(); I != E; ++I) {
if (contains(*I)) return true;
}
return false;
diff --git a/lib/Analysis/LiveVar/BBLiveVar.cpp b/lib/Analysis/LiveVar/BBLiveVar.cpp
index 210a24bd09..80fde4e157 100644
--- a/lib/Analysis/LiveVar/BBLiveVar.cpp
+++ b/lib/Analysis/LiveVar/BBLiveVar.cpp
@@ -162,9 +162,9 @@ bool BBLiveVar::applyFlowFunc(BBToBBLiveVarMapType LVMap)
// whose POId is lower
- cfg::pred_const_iterator PredBBI = cfg::pred_begin(BaseBB);
+ BasicBlock::pred_const_iterator PredBBI = BaseBB->pred_begin();
- for( ; PredBBI != cfg::pred_end(BaseBB) ; PredBBI++) {
+ for( ; PredBBI != BaseBB->pred_end() ; PredBBI++) {
assert( *PredBBI ); // assert that the predecessor is valid
BBLiveVar *PredLVBB = LVMap[*PredBBI];
diff --git a/lib/Analysis/LiveVar/BBLiveVar.h b/lib/Analysis/LiveVar/BBLiveVar.h
index e4d5804489..55a6c3abd5 100644
--- a/lib/Analysis/LiveVar/BBLiveVar.h
+++ b/lib/Analysis/LiveVar/BBLiveVar.h
@@ -1,4 +1,4 @@
-/* Title: BBLiveVar.h
+/* Title: BBLiveVar.h -*- C++ -*-
Author: Ruchira Sasanka
Date: Jun 30, 01
Purpose: This is a wrapper class for BasicBlock which is used by live
@@ -13,7 +13,6 @@
#include "llvm/BasicBlock.h"
#include "llvm/Instruction.h"
-#include "llvm/CFG.h"
#include "llvm/Type.h"
#include "llvm/iOther.h"
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 0372141505..c241646b63 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -63,7 +63,8 @@ void cfg::DominatorSet::calcForwardDominatorSet(const Method *M) {
df_iterator<const Method*> It = df_begin(M), End = df_end(M);
for ( ; It != End; ++It) {
const BasicBlock *BB = *It;
- pred_const_iterator PI = pred_begin(BB), PEnd = pred_end(BB);
+ BasicBlock::pred_const_iterator PI = BB->pred_begin(),
+ PEnd = BB->pred_end();
if (PI != PEnd) { // Is there SOME predecessor?
// Loop until we get to a predecessor that has had it's dom set filled
// in at least once. We are guaranteed to have this because we are
@@ -114,7 +115,8 @@ cfg::DominatorSet::DominatorSet(Method *M, bool PostDomSet)
idf_iterator<const BasicBlock*> It = idf_begin(Root), End = idf_end(Root);
for ( ; It != End; ++It) {
const BasicBlock *BB = *It;
- succ_const_iterator PI = succ_begin(BB), PEnd = succ_end(BB);
+ BasicBlock::succ_const_iterator PI = BB->succ_begin(),
+ PEnd = BB->succ_end();
if (PI != PEnd) { // Is there SOME predecessor?
// Loop until we get to a successor that has had it's dom set filled
// in at least once. We are guaranteed to have this because we are
@@ -320,8 +322,8 @@ cfg::DominanceFrontier::calcDomFrontier(const DominatorTree &DT,
const BasicBlock *BB = Node->getNode();
DomSetType &S = Frontiers[BB]; // The new set to fill in...
- for (succ_const_iterator SI = succ_begin(BB), SE = succ_end(BB);
- SI != SE; ++SI) {
+ for (BasicBlock::succ_const_iterator SI = BB->succ_begin(),
+ SE = BB->succ_end(); SI != SE; ++SI) {
// Does Node immediately dominate this successor?
if (DT[*SI]->getIDom() != Node)
S.insert(*SI);
@@ -354,8 +356,8 @@ cfg::DominanceFrontier::calcPostDomFrontier(const DominatorTree &DT,
DomSetType &S = Frontiers[BB]; // The new set to fill in...
if (!Root) return S;
- for (pred_const_iterator SI = pred_begin(BB), SE = pred_end(BB);
- SI != SE; ++SI) {
+ for (BasicBlock::pred_const_iterator SI = BB->pred_begin(),
+ SE = BB->pred_end(); SI != SE; ++SI) {
// Does Node immediately dominate this predeccessor?
if (DT[*SI]->getIDom() != Node)
S.insert(*SI);