add some helpers
[oota-llvm.git] / lib / CodeGen / MachineBasicBlock.cpp
index d67159d61e766f786c6d5ff0c8acbd8a6a428749..e38047b277e453fe38d22751a557cb5842377f69 100644 (file)
@@ -118,7 +118,7 @@ void MachineBasicBlock::print(std::ostream &OS) const {
   const MRegisterInfo *MRI = MF->getTarget().getRegisterInfo();  
   if (livein_begin() != livein_end()) {
     OS << "Live Ins:";
-    for (livein_iterator I = livein_begin(), E = livein_end(); I != E; ++I)
+    for (const_livein_iterator I = livein_begin(),E = livein_end(); I != E; ++I)
       OutputReg(OS, *I, MRI);
     OS << "\n";
   }
@@ -126,7 +126,7 @@ void MachineBasicBlock::print(std::ostream &OS) const {
   if (!pred_empty()) {
     OS << "    Predecessors according to CFG:";
     for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI)
-      OS << " " << *PI;
+      OS << " " << *PI << " (#" << (*PI)->getNumber() << ")";
     OS << "\n";
   }
   
@@ -139,11 +139,17 @@ void MachineBasicBlock::print(std::ostream &OS) const {
   if (!succ_empty()) {
     OS << "    Successors according to CFG:";
     for (const_succ_iterator SI = succ_begin(), E = succ_end(); SI != E; ++SI)
-      OS << " " << *SI;
+      OS << " " << *SI << " (#" << (*SI)->getNumber() << ")";
     OS << "\n";
   }
 }
 
+void MachineBasicBlock::removeLiveIn(unsigned Reg) {
+  livein_iterator I = std::find(livein_begin(), livein_end(), Reg);
+  assert(I != livein_end() && "Not a live in!");
+  LiveIns.erase(I);
+}
+
 void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) {
   MachineFunction::BasicBlockListType &BBList =getParent()->getBasicBlockList();
   getParent()->getBasicBlockList().splice(NewAfter, BBList, this);