Replaced uses of deprecated `MachineFunction::get(BasicBlock *BB)'.
[oota-llvm.git] / lib / Target / SparcV9 / LiveVar / BBLiveVar.cpp
index 0b2979bf392ce055d0abdc492fdc1cf8c220f453..4b07ebc6323bb4fb346e317b91270fba1ba3243e 100644 (file)
@@ -7,10 +7,9 @@
 #include "BBLiveVar.h"
 #include "llvm/Analysis/LiveVar/FunctionLiveVarInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/CodeGen/MachineCodeForBasicBlock.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
 #include "llvm/Support/CFG.h"
 #include "Support/SetOperations.h"
-#include <iostream>
 
 /// BROKEN: Should not include sparc stuff directly into here
 #include "../../Target/Sparc/SparcInternals.h"  //  Only for PHI defn
@@ -19,8 +18,9 @@ using std::cerr;
 
 static AnnotationID AID(AnnotationManager::getID("Analysis::BBLiveVar"));
 
-BBLiveVar *BBLiveVar::CreateOnBB(const BasicBlock &BB, unsigned POID) {
-  BBLiveVar *Result = new BBLiveVar(BB, POID);
+BBLiveVar *BBLiveVar::CreateOnBB(const BasicBlock &BB, MachineBasicBlock &MBB,
+                                 unsigned POID) {
+  BBLiveVar *Result = new BBLiveVar(BB, MBB, POID);
   BB.addAnnotation(Result);
   return Result;
 }
@@ -35,8 +35,8 @@ void BBLiveVar::RemoveFromBB(const BasicBlock &BB) {
 }
 
 
-BBLiveVar::BBLiveVar(const BasicBlock &bb, unsigned id)
-  : Annotation(AID), BB(bb), POID(id) {
+BBLiveVar::BBLiveVar(const BasicBlock &bb, MachineBasicBlock &mbb, unsigned id)
+  : Annotation(AID), BB(bb), MBB(mbb), POID(id) {
   InSetChanged = OutSetChanged = false;
 
   calcDefUseSets();
@@ -50,15 +50,12 @@ BBLiveVar::BBLiveVar(const BasicBlock &bb, unsigned id)
 //-----------------------------------------------------------------------------
 
 void BBLiveVar::calcDefUseSets() {
-  // get the iterator for machine instructions
-  const MachineCodeForBasicBlock &MIVec = MachineCodeForBasicBlock::get(&BB);
-
   // iterate over all the machine instructions in BB
-  for (MachineCodeForBasicBlock::const_reverse_iterator MII = MIVec.rbegin(),
-         MIE = MIVec.rend(); MII != MIE; ++MII) {
+  for (MachineBasicBlock::const_reverse_iterator MII = MBB.rbegin(),
+         MIE = MBB.rend(); MII != MIE; ++MII) {
     const MachineInstr *MI = *MII;
     
-    if (DEBUG_LV >= LV_DEBUG_Verbose) {                            // debug msg
+    if (DEBUG_LV >= LV_DEBUG_Verbose) {
       cerr << " *Iterating over machine instr ";
       MI->dump();
       cerr << "\n";