* Pull BasicBlock::pred_* and BasicBlock::succ_* out of BasicBlock.h and into
  llvm/Support/CFG.h
* Make pred & succ iterators for intervals global functions
* Add #includes that are now neccesary because BasicBlock.h doesn't include
  InstrTypes.h anymore


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1750 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index e02429a..e67fe32 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -11,6 +11,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
 #include "llvm/Method.h"
+#include "llvm/Instruction.h"
 #include "llvm/Support/InstIterator.h"
 
 AnalysisID FindUsedTypes::ID(AnalysisID::create<FindUsedTypes>());
diff --git a/lib/Analysis/Interval.cpp b/lib/Analysis/Interval.cpp
index 5c68be9..de5d57f 100644
--- a/lib/Analysis/Interval.cpp
+++ b/lib/Analysis/Interval.cpp
@@ -7,6 +7,7 @@
 
 #include "llvm/Analysis/Interval.h"
 #include "llvm/BasicBlock.h"
+#include "llvm/Support/CFG.h"
 
 //===----------------------------------------------------------------------===//
 // Interval Implementation
@@ -17,8 +18,8 @@
 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 = HeaderNode->pred_begin(), 
-                                 E = HeaderNode->pred_end(); I != E; ++I) {
+  for (::pred_iterator I = ::pred_begin(HeaderNode), E = ::pred_end(HeaderNode);
+       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 84adecd..1468301 100644
--- a/lib/Analysis/LiveVar/BBLiveVar.cpp
+++ b/lib/Analysis/LiveVar/BBLiveVar.cpp
@@ -8,6 +8,7 @@
 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/BasicBlock.h"
+#include "llvm/Support/CFG.h"
 #include "Support/SetOperations.h"
 
 /// BROKEN: Should not include sparc stuff directly into here
@@ -197,8 +198,8 @@
   //
   bool needAnotherIt = false;  
 
-  for (BasicBlock::pred_const_iterator PI = BB->pred_begin(),
-         PE = BB->pred_begin(); PI != PE ; ++PI) {
+  for (pred_const_iterator PI = pred_begin(BB), PE = pred_begin(BB);
+       PI != PE ; ++PI) {
     BBLiveVar *PredLVBB = BBLiveVar::GetFromBB(*PI);
 
     // do set union
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 876161d..344e3a4 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -61,8 +61,7 @@
 
   // Scan the predecessors of BB, checking to see if BB dominates any of
   // them.
-  for (BasicBlock::pred_const_iterator I = BB->pred_begin(),
-	 E = BB->pred_end(); I != E; ++I)
+  for (pred_const_iterator I = pred_begin(BB), E = pred_end(BB); I != E; ++I)
     if (DS.dominates(BB, *I))   // If BB dominates it's predecessor...
       TodoStack.push_back(*I);
 
@@ -80,7 +79,7 @@
       L->Blocks.push_back(X);
 
       // Add all of the predecessors of X to the end of the work stack...
-      TodoStack.insert(TodoStack.end(), X->pred_begin(), X->pred_end());
+      TodoStack.insert(TodoStack.end(), pred_begin(X), pred_end(X));
     }
   }
 
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index 33e14e9..48cc86f 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -37,7 +37,7 @@
 //
 void cfg::DominatorSet::calcForwardDominatorSet(Method *M) {
   Root = M->getEntryNode();
-  assert(Root->pred_begin() == Root->pred_end() &&
+  assert(pred_begin(Root) == pred_end(Root) &&
 	 "Root node has predecessors in method!");
 
   bool Changed;
@@ -48,8 +48,7 @@
     df_iterator<Method*> It = df_begin(M), End = df_end(M);
     for ( ; It != End; ++It) {
       const BasicBlock *BB = *It;
-      BasicBlock::pred_const_iterator PI = BB->pred_begin(),
-                                      PEnd = BB->pred_end();
+      pred_const_iterator PI = pred_begin(BB), PEnd = pred_end(BB);
       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
@@ -102,8 +101,7 @@
     idf_iterator<BasicBlock*> It = idf_begin(Root), End = idf_end(Root);
     for ( ; It != End; ++It) {
       const BasicBlock *BB = *It;
-      BasicBlock::succ_const_iterator PI = BB->succ_begin(),
-                                      PEnd = BB->succ_end();
+      succ_const_iterator PI = succ_begin(BB), PEnd = succ_end(BB);
       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
@@ -337,8 +335,8 @@
   const BasicBlock *BB = Node->getNode();
   DomSetType &S = Frontiers[BB];       // The new set to fill in...
 
-  for (BasicBlock::succ_const_iterator SI = BB->succ_begin(),
-                                       SE = BB->succ_end(); SI != SE; ++SI) {
+  for (succ_const_iterator SI = succ_begin(BB), SE = succ_end(BB);
+       SI != SE; ++SI) {
     // Does Node immediately dominate this successor?
     if (DT[*SI]->getIDom() != Node)
       S.insert(*SI);
@@ -371,8 +369,8 @@
   DomSetType &S = Frontiers[BB];       // The new set to fill in...
   if (!Root) return S;
 
-  for (BasicBlock::pred_const_iterator SI = BB->pred_begin(),
-                                       SE = BB->pred_end(); SI != SE; ++SI) {
+  for (pred_const_iterator SI = pred_begin(BB), SE = pred_end(BB);
+       SI != SE; ++SI) {
     // Does Node immediately dominate this predeccessor?
     if (DT[*SI]->getIDom() != Node)
       S.insert(*SI);