From: Krzysztof Parzyszek Date: Mon, 3 Oct 2016 17:54:33 +0000 (+0000) Subject: [RDF] Further improve readability of the graph X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fbe7c8ae1a255e1403227a7b02c893fd3780574;p=llvm [RDF] Further improve readability of the graph Print target basic block for a branch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283126 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/RDFGraph.cpp b/lib/Target/Hexagon/RDFGraph.cpp index 7eb5cf86ba5..d4ced066b57 100644 --- a/lib/Target/Hexagon/RDFGraph.cpp +++ b/lib/Target/Hexagon/RDFGraph.cpp @@ -213,18 +213,21 @@ raw_ostream &operator<< (raw_ostream &OS, const MachineInstr &MI = *P.Obj.Addr->getCode(); unsigned Opc = MI.getOpcode(); OS << Print(P.Obj.Id, P.G) << ": " << P.G.getTII().getName(Opc); - // Print the target for calls (for readability). - if (MI.getDesc().isCall()) { - MachineInstr::const_mop_iterator Fn = + // Print the target for calls and branches (for readability). + if (MI.isCall() || MI.isBranch()) { + MachineInstr::const_mop_iterator T = find_if(MI.operands(), [] (const MachineOperand &Op) -> bool { - return Op.isGlobal() || Op.isSymbol(); + return Op.isMBB() || Op.isGlobal() || Op.isSymbol(); }); - if (Fn != MI.operands_end()) { - if (Fn->isGlobal()) - OS << ' ' << Fn->getGlobal()->getName(); - else if (Fn->isSymbol()) - OS << ' ' << Fn->getSymbolName(); + if (T != MI.operands_end()) { + OS << ' '; + if (T->isMBB()) + OS << "BB#" << T->getMBB()->getNumber(); + else if (T->isGlobal()) + OS << T->getGlobal()->getName(); + else if (T->isSymbol()) + OS << T->getSymbolName(); } } OS << " [" << PrintListV(P.Obj.Addr->members(P.G), P.G) << ']'; @@ -263,8 +266,8 @@ raw_ostream &operator<< (raw_ostream &OS, } }; - OS << Print(P.Obj.Id, P.G) << ": === BB#" << BB->getNumber() - << " === preds(" << NP << "): "; + OS << Print(P.Obj.Id, P.G) << ": --- BB#" << BB->getNumber() + << " --- preds(" << NP << "): "; for (auto I : BB->predecessors()) Ns.push_back(I->getNumber()); PrintBBs(Ns);