Method.h no longer includes BasicBlock.h
Method::inst_* is now in llvm/Support/InstIterator.h
GraphTraits specializations for BasicBlock and Methods are now in llvm/Support/CFG.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1746 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp
index 1d49831..ef9f9e4 100644
--- a/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp
+++ b/lib/Target/SparcV9/InstrSched/SchedPriorities.cpp
@@ -20,6 +20,7 @@
 
 #include "SchedPriorities.h"
 #include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
+#include "llvm/Support/CFG.h"
 #include "Support/PostOrderIterator.h"
 #include <iostream>
 using std::cerr;
diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
index 29090e0..b11d71e 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp
@@ -189,15 +189,18 @@
 
 InstrForest::InstrForest(Method *M)
 {
-  for (Method::inst_iterator I = M->inst_begin(); I != M->inst_end(); ++I)
-    this->buildTreeForInstruction(*I);
+  for (Method::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) {
+    BasicBlock *BB = *MI;
+    for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
+      buildTreeForInstruction(*I);
+  }
 }
 
 InstrForest::~InstrForest()
 {
   for (std::hash_map<const Instruction*,InstructionNode*>::iterator I = begin();
        I != end(); ++I)
-      delete (*I).second;
+      delete I->second;
 }
 
 void
diff --git a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
index a1a2dba..b83359f 100644
--- a/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
+++ b/lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.cpp
@@ -9,6 +9,7 @@
 #include "BBLiveVar.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/BasicBlock.h"
+#include "llvm/Support/CFG.h"
 #include "Support/PostOrderIterator.h"
 #include "Support/SetOperations.h"
 #include <iostream>
diff --git a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
index 7302baa..3295176 100644
--- a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
+++ b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
@@ -3,6 +3,7 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
 #include "Support/SetOperations.h"
 #include <iostream>
 using std::cerr;
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
index 18d019e..c78b971 100644
--- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineFrameInfo.h"
+#include "llvm/BasicBlock.h"
 #include "llvm/Method.h"
 #include "llvm/Type.h"
 #include <iostream>
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index 14be992..b026ccd 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/RegisterAllocation.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Method.h"
+#include "llvm/BasicBlock.h"
 #include "llvm/PassManager.h"
 #include <iostream>
 using std::cerr;
@@ -229,7 +230,11 @@
   }
 
   bool runOnMethod(Method *M) {
-    for_each(M->inst_begin(), M->inst_end(), freeMachineCode);
+    for (Method::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI)
+      for (BasicBlock::iterator I = (*MI)->begin(), E = (*MI)->end();
+           I != E; ++I)
+        freeMachineCode(*I);
+
     // Don't destruct MachineCodeForMethod - The global printer needs it
     //MachineCodeForMethod::destruct(M);
     return false;