[Hexagon-ish] Add function to print cell map contents in bit tracker
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 3 Aug 2016 18:13:32 +0000 (18:13 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 3 Aug 2016 18:13:32 +0000 (18:13 +0000)
llvm-svn: 277622

llvm/lib/Target/Hexagon/BitTracker.cpp
llvm/lib/Target/Hexagon/BitTracker.h

index 9a2a597..e3ead28 100644 (file)
@@ -169,6 +169,12 @@ namespace llvm {
   }
 }
 
+void BitTracker::print_cells(raw_ostream &OS) const {
+  for (CellMapType::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
+    dbgs() << PrintReg(I->first, &ME.TRI) << " -> " << I->second << "\n";
+}
+
+
 BitTracker::BitTracker(const MachineEvaluator &E, MachineFunction &F)
     : Trace(false), ME(E), MF(F), MRI(F.getRegInfo()), Map(*new CellMapType) {}
 
@@ -1127,10 +1133,7 @@ void BT::run() {
     }
   } // while (!FlowQ->empty())
 
-  if (Trace) {
-    dbgs() << "Cells after propagation:\n";
-    for (CellMapType::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
-      dbgs() << PrintReg(I->first, &ME.TRI) << " -> " << I->second << "\n";
-  }
+  if (Trace)
+    print_cells(dbgs() << "Cells after propagation:\n");
 }
 
index 3c16a73..74cafcd 100644 (file)
@@ -51,6 +51,8 @@ struct BitTracker {
   bool reached(const MachineBasicBlock *B) const;
   void visit(const MachineInstr &MI);
 
+  void print_cells(raw_ostream &OS) const;
+
 private:
   void visitPHI(const MachineInstr &PI);
   void visitNonBranch(const MachineInstr &MI);