[llvm] 0f5385b - Recommit [RDF] Remove explicit template arguments from Print

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 07:29:10 PDT 2022


Author: Krzysztof Parzyszek
Date: 2022-08-08T07:28:45-07:00
New Revision: 0f5385b70eddfbcb26fed973a4d6e4cc01260930

URL: https://github.com/llvm/llvm-project/commit/0f5385b70eddfbcb26fed973a4d6e4cc01260930
DIFF: https://github.com/llvm/llvm-project/commit/0f5385b70eddfbcb26fed973a4d6e4cc01260930.diff

LOG: Recommit [RDF] Remove explicit template arguments from Print

The build breakages should be addressed by d4abdd2e3d:
  [CMake] Check CMAKE_CXX_STANDARD and error if it's to old

Thanks to Tobias and Roy for addressing these issues.

Added: 
    

Modified: 
    llvm/lib/CodeGen/RDFGraph.cpp
    llvm/lib/CodeGen/RDFLiveness.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index 1b14aee6b2f4..4f7457d9efa6 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -105,8 +105,8 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeId> &P) {
 
 static void printRefHeader(raw_ostream &OS, const NodeAddr<RefNode*> RA,
                 const DataFlowGraph &G) {
-  OS << Print<NodeId>(RA.Id, G) << '<'
-     << Print<RegisterRef>(RA.Addr->getRegRef(G), G) << '>';
+  OS << Print(RA.Id, G) << '<'
+     << Print(RA.Addr->getRegRef(G), G) << '>';
   if (RA.Addr->getFlags() & NodeAttrs::Fixed)
     OS << '!';
 }
@@ -115,16 +115,16 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeAddr<DefNode*>> &P) {
   printRefHeader(OS, P.Obj, P.G);
   OS << '(';
   if (NodeId N = P.Obj.Addr->getReachingDef())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   OS << ',';
   if (NodeId N = P.Obj.Addr->getReachedDef())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   OS << ',';
   if (NodeId N = P.Obj.Addr->getReachedUse())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   OS << "):";
   if (NodeId N = P.Obj.Addr->getSibling())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   return OS;
 }
 
@@ -132,10 +132,10 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeAddr<UseNode*>> &P) {
   printRefHeader(OS, P.Obj, P.G);
   OS << '(';
   if (NodeId N = P.Obj.Addr->getReachingDef())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   OS << "):";
   if (NodeId N = P.Obj.Addr->getSibling())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   return OS;
 }
 
@@ -144,13 +144,13 @@ raw_ostream &operator<< (raw_ostream &OS,
   printRefHeader(OS, P.Obj, P.G);
   OS << '(';
   if (NodeId N = P.Obj.Addr->getReachingDef())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   OS << ',';
   if (NodeId N = P.Obj.Addr->getPredecessor())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   OS << "):";
   if (NodeId N = P.Obj.Addr->getSibling())
-    OS << Print<NodeId>(N, P.G);
+    OS << Print(N, P.G);
   return OS;
 }
 
@@ -172,7 +172,7 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeAddr<RefNode*>> &P) {
 raw_ostream &operator<< (raw_ostream &OS, const Print<NodeList> &P) {
   unsigned N = P.Obj.size();
   for (auto I : P.Obj) {
-    OS << Print<NodeId>(I.Id, P.G);
+    OS << Print(I.Id, P.G);
     if (--N)
       OS << ' ';
   }
@@ -182,7 +182,7 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeList> &P) {
 raw_ostream &operator<< (raw_ostream &OS, const Print<NodeSet> &P) {
   unsigned N = P.Obj.size();
   for (auto I : P.Obj) {
-    OS << Print<NodeId>(I, P.G);
+    OS << Print(I, P.G);
     if (--N)
       OS << ' ';
   }
@@ -214,7 +214,7 @@ namespace {
 } // end anonymous namespace
 
 raw_ostream &operator<< (raw_ostream &OS, const Print<NodeAddr<PhiNode*>> &P) {
-  OS << Print<NodeId>(P.Obj.Id, P.G) << ": phi ["
+  OS << Print(P.Obj.Id, P.G) << ": phi ["
      << PrintListV<RefNode*>(P.Obj.Addr->members(P.G), P.G) << ']';
   return OS;
 }
@@ -222,7 +222,7 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeAddr<PhiNode*>> &P) {
 raw_ostream &operator<<(raw_ostream &OS, const Print<NodeAddr<StmtNode *>> &P) {
   const MachineInstr &MI = *P.Obj.Addr->getCode();
   unsigned Opc = MI.getOpcode();
-  OS << Print<NodeId>(P.Obj.Id, P.G) << ": " << P.G.getTII().getName(Opc);
+  OS << Print(P.Obj.Id, P.G) << ": " << P.G.getTII().getName(Opc);
   // Print the target for calls and branches (for readability).
   if (MI.isCall() || MI.isBranch()) {
     MachineInstr::const_mop_iterator T =
@@ -254,7 +254,7 @@ raw_ostream &operator<< (raw_ostream &OS,
       OS << PrintNode<StmtNode*>(P.Obj, P.G);
       break;
     default:
-      OS << "instr? " << Print<NodeId>(P.Obj.Id, P.G);
+      OS << "instr? " << Print(P.Obj.Id, P.G);
       break;
   }
   return OS;
@@ -274,7 +274,7 @@ raw_ostream &operator<< (raw_ostream &OS,
     }
   };
 
-  OS << Print<NodeId>(P.Obj.Id, P.G) << ": --- " << printMBBReference(*BB)
+  OS << Print(P.Obj.Id, P.G) << ": --- " << printMBBReference(*BB)
      << " --- preds(" << NP << "): ";
   for (MachineBasicBlock *B : BB->predecessors())
     Ns.push_back(B->getNumber());
@@ -294,7 +294,7 @@ raw_ostream &operator<< (raw_ostream &OS,
 }
 
 raw_ostream &operator<<(raw_ostream &OS, const Print<NodeAddr<FuncNode *>> &P) {
-  OS << "DFG dump:[\n" << Print<NodeId>(P.Obj.Id, P.G) << ": Function: "
+  OS << "DFG dump:[\n" << Print(P.Obj.Id, P.G) << ": Function: "
      << P.Obj.Addr->getCode()->getName() << '\n';
   for (auto I : P.Obj.Addr->members(P.G))
     OS << PrintNode<BlockNode*>(I, P.G) << '\n';
@@ -305,7 +305,7 @@ raw_ostream &operator<<(raw_ostream &OS, const Print<NodeAddr<FuncNode *>> &P) {
 raw_ostream &operator<< (raw_ostream &OS, const Print<RegisterSet> &P) {
   OS << '{';
   for (auto I : P.Obj)
-    OS << ' ' << Print<RegisterRef>(I, P.G);
+    OS << ' ' << Print(I, P.G);
   OS << " }";
   return OS;
 }
@@ -318,8 +318,8 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<RegisterAggr> &P) {
 raw_ostream &operator<< (raw_ostream &OS,
       const Print<DataFlowGraph::DefStack> &P) {
   for (auto I = P.Obj.top(), E = P.Obj.bottom(); I != E; ) {
-    OS << Print<NodeId>(I->Id, P.G)
-       << '<' << Print<RegisterRef>(I->Addr->getRegRef(P.G), P.G) << '>';
+    OS << Print(I->Id, P.G)
+       << '<' << Print(I->Addr->getRegRef(P.G), P.G) << '>';
     I.down();
     if (I != E)
       OS << ' ';
@@ -1095,7 +1095,7 @@ void DataFlowGraph::pushDefs(NodeAddr<InstrNode*> IA, DefStackMap &DefM) {
     if (!Defined.insert(RR.Reg).second) {
       MachineInstr *MI = NodeAddr<StmtNode*>(IA).Addr->getCode();
       dbgs() << "Multiple definitions of register: "
-             << Print<RegisterRef>(RR, *this) << " in\n  " << *MI << "in "
+             << Print(RR, *this) << " in\n  " << *MI << "in "
              << printMBBReference(*MI->getParent()) << '\n';
       llvm_unreachable(nullptr);
     }

diff  --git a/llvm/lib/CodeGen/RDFLiveness.cpp b/llvm/lib/CodeGen/RDFLiveness.cpp
index d8eac20d16b6..692d70c3fd80 100644
--- a/llvm/lib/CodeGen/RDFLiveness.cpp
+++ b/llvm/lib/CodeGen/RDFLiveness.cpp
@@ -64,7 +64,7 @@ namespace rdf {
     for (const auto &I : P.Obj) {
       OS << ' ' << printReg(I.first, &P.G.getTRI()) << '{';
       for (auto J = I.second.begin(), E = I.second.end(); J != E; ) {
-        OS << Print<NodeId>(J->first, P.G) << PrintLaneMaskOpt(J->second);
+        OS << Print(J->first, P.G) << PrintLaneMaskOpt(J->second);
         if (++J != E)
           OS << ',';
       }
@@ -619,10 +619,9 @@ void Liveness::computePhiInfo() {
   if (Trace) {
     dbgs() << "Phi-up-to-phi map with intervening defs:\n";
     for (auto I : PhiUp) {
-      dbgs() << "phi " << Print<NodeId>(I.first, DFG) << " -> {";
+      dbgs() << "phi " << Print(I.first, DFG) << " -> {";
       for (auto R : I.second)
-        dbgs() << ' ' << Print<NodeId>(R.first, DFG)
-               << Print<RegisterAggr>(R.second, DFG);
+        dbgs() << ' ' << Print(R.first, DFG) << Print(R.second, DFG);
       dbgs() << " }\n";
     }
   }
@@ -720,16 +719,16 @@ void Liveness::computePhiInfo() {
   if (Trace) {
     dbgs() << "Real use map:\n";
     for (auto I : RealUseMap) {
-      dbgs() << "phi " << Print<NodeId>(I.first, DFG);
+      dbgs() << "phi " << Print(I.first, DFG);
       NodeAddr<PhiNode*> PA = DFG.addr<PhiNode*>(I.first);
       NodeList Ds = PA.Addr->members_if(DFG.IsRef<NodeAttrs::Def>, DFG);
       if (!Ds.empty()) {
         RegisterRef RR = NodeAddr<DefNode*>(Ds[0]).Addr->getRegRef(DFG);
-        dbgs() << '<' << Print<RegisterRef>(RR, DFG) << '>';
+        dbgs() << '<' << Print(RR, DFG) << '>';
       } else {
         dbgs() << "<noreg>";
       }
-      dbgs() << " -> " << Print<RefMap>(I.second, DFG) << '\n';
+      dbgs() << " -> " << Print(I.second, DFG) << '\n';
     }
   }
 }
@@ -788,7 +787,7 @@ void Liveness::computeLiveIns() {
     dbgs() << "Phi live-on-entry map:\n";
     for (auto &I : PhiLON)
       dbgs() << "block #" << I.first->getNumber() << " -> "
-             << Print<RefMap>(I.second, DFG) << '\n';
+             << Print(I.second, DFG) << '\n';
   }
 
   // Build the phi live-on-exit map. Each phi node has some set of reached
@@ -851,7 +850,7 @@ void Liveness::computeLiveIns() {
     dbgs() << "Phi live-on-exit map:\n";
     for (auto &I : PhiLOX)
       dbgs() << "block #" << I.first->getNumber() << " -> "
-             << Print<RefMap>(I.second, DFG) << '\n';
+             << Print(I.second, DFG) << '\n';
   }
 
   RefMap LiveIn;
@@ -869,9 +868,9 @@ void Liveness::computeLiveIns() {
       llvm::sort(LV);
       dbgs() << printMBBReference(B) << "\t rec = {";
       for (auto I : LV)
-        dbgs() << ' ' << Print<RegisterRef>(I, DFG);
+        dbgs() << ' ' << Print(I, DFG);
       dbgs() << " }\n";
-      //dbgs() << "\tcomp = " << Print<RegisterAggr>(LiveMap[&B], DFG) << '\n';
+      //dbgs() << "\tcomp = " << Print(LiveMap[&B], DFG) << '\n';
 
       LV.clear();
       const RegisterAggr &LG = LiveMap[&B];
@@ -880,7 +879,7 @@ void Liveness::computeLiveIns() {
       llvm::sort(LV);
       dbgs() << "\tcomp = {";
       for (auto I : LV)
-        dbgs() << ' ' << Print<RegisterRef>(I, DFG);
+        dbgs() << ' ' << Print(I, DFG);
       dbgs() << " }\n";
 
     }
@@ -1018,8 +1017,8 @@ void Liveness::traverse(MachineBasicBlock *B, RefMap &LiveIn) {
     for (auto *I : *N)
       dbgs() << ' ' << I->getBlock()->getNumber();
     dbgs() << " }\n";
-    dbgs() << "  LiveIn: " << Print<RefMap>(LiveIn, DFG) << '\n';
-    dbgs() << "  Local:  " << Print<RegisterAggr>(LiveMap[B], DFG) << '\n';
+    dbgs() << "  LiveIn: " << Print(LiveIn, DFG) << '\n';
+    dbgs() << "  Local:  " << Print(LiveMap[B], DFG) << '\n';
   }
 
   // Add reaching defs of phi uses that are live on exit from this block.
@@ -1029,8 +1028,8 @@ void Liveness::traverse(MachineBasicBlock *B, RefMap &LiveIn) {
 
   if (Trace) {
     dbgs() << "after LOX\n";
-    dbgs() << "  LiveIn: " << Print<RefMap>(LiveIn, DFG) << '\n';
-    dbgs() << "  Local:  " << Print<RegisterAggr>(LiveMap[B], DFG) << '\n';
+    dbgs() << "  LiveIn: " << Print(LiveIn, DFG) << '\n';
+    dbgs() << "  Local:  " << Print(LiveMap[B], DFG) << '\n';
   }
 
   // The LiveIn map at this point has all defs that are live-on-exit from B,
@@ -1113,8 +1112,8 @@ void Liveness::traverse(MachineBasicBlock *B, RefMap &LiveIn) {
 
   if (Trace) {
     dbgs() << "after defs in block\n";
-    dbgs() << "  LiveIn: " << Print<RefMap>(LiveIn, DFG) << '\n';
-    dbgs() << "  Local:  " << Print<RegisterAggr>(LiveMap[B], DFG) << '\n';
+    dbgs() << "  LiveIn: " << Print(LiveIn, DFG) << '\n';
+    dbgs() << "  Local:  " << Print(LiveMap[B], DFG) << '\n';
   }
 
   // Scan the block for upward-exposed uses and add them to the tracking set.
@@ -1134,8 +1133,8 @@ void Liveness::traverse(MachineBasicBlock *B, RefMap &LiveIn) {
 
   if (Trace) {
     dbgs() << "after uses in block\n";
-    dbgs() << "  LiveIn: " << Print<RefMap>(LiveIn, DFG) << '\n';
-    dbgs() << "  Local:  " << Print<RegisterAggr>(LiveMap[B], DFG) << '\n';
+    dbgs() << "  LiveIn: " << Print(LiveIn, DFG) << '\n';
+    dbgs() << "  Local:  " << Print(LiveMap[B], DFG) << '\n';
   }
 
   // Phi uses should not be propagated up the dominator tree, since they
@@ -1151,8 +1150,8 @@ void Liveness::traverse(MachineBasicBlock *B, RefMap &LiveIn) {
 
   if (Trace) {
     dbgs() << "after phi uses in block\n";
-    dbgs() << "  LiveIn: " << Print<RefMap>(LiveIn, DFG) << '\n';
-    dbgs() << "  Local:  " << Print<RegisterAggr>(Local, DFG) << '\n';
+    dbgs() << "  LiveIn: " << Print(LiveIn, DFG) << '\n';
+    dbgs() << "  Local:  " << Print(Local, DFG) << '\n';
   }
 
   for (auto *C : IIDF[B]) {


        


More information about the llvm-commits mailing list