[llvm] ede96de - [RDF] Remove explicit template arguments from Print

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 7 05:28:08 PDT 2022


On Sat, Aug 6, 2022 at 2:29 PM Krzysztof Parzyszek via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Krzysztof Parzyszek
> Date: 2022-08-06T13:29:15-05:00
> New Revision: ede96de751224487aea122af8bfb4e82bc54840b
>
> URL: https://github.com/llvm/llvm-project/commit/ede96de751224487aea122af8bfb4e82bc54840b
> DIFF: https://github.com/llvm/llvm-project/commit/ede96de751224487aea122af8bfb4e82bc54840b.diff
>
> LOG: [RDF] Remove explicit template arguments from Print
>
> CTAD takes care of it.

Sorry, but I had to revert this in
32fd0b7fd5ab26a70be1a16846232055e92cb597 because this commit broke
building with Visual Studio.

~Aaron

>
> 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 51de99b81057e..df5ec9c3ea3bb 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 << ' ';
> @@ -1087,7 +1087,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 d8eac20d16b68..692d70c3fd805 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]) {
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list