[llvm] r283126 - [RDF] Further improve readability of the graph
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 3 10:54:34 PDT 2016
Author: kparzysz
Date: Mon Oct 3 12:54:33 2016
New Revision: 283126
URL: http://llvm.org/viewvc/llvm-project?rev=283126&view=rev
Log:
[RDF] Further improve readability of the graph
Print target basic block for a branch.
Modified:
llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp
Modified: llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp?rev=283126&r1=283125&r2=283126&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/RDFGraph.cpp Mon Oct 3 12:54:33 2016
@@ -213,18 +213,21 @@ raw_ostream &operator<< (raw_ostream &OS
const MachineInstr &MI = *P.Obj.Addr->getCode();
unsigned Opc = MI.getOpcode();
OS << Print<NodeId>(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<RefNode*>(P.Obj.Addr->members(P.G), P.G) << ']';
@@ -263,8 +266,8 @@ raw_ostream &operator<< (raw_ostream &OS
}
};
- OS << Print<NodeId>(P.Obj.Id, P.G) << ": === BB#" << BB->getNumber()
- << " === preds(" << NP << "): ";
+ OS << Print<NodeId>(P.Obj.Id, P.G) << ": --- BB#" << BB->getNumber()
+ << " --- preds(" << NP << "): ";
for (auto I : BB->predecessors())
Ns.push_back(I->getNumber());
PrintBBs(Ns);
More information about the llvm-commits
mailing list