1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[RDF] Print the function name for calls in dumps

llvm-svn: 282191
This commit is contained in:
Krzysztof Parzyszek 2016-09-22 20:58:19 +00:00
parent 38eef5294c
commit 4e87f8e468

View File

@ -210,9 +210,24 @@ raw_ostream &operator<< (raw_ostream &OS, const Print<NodeAddr<PhiNode*>> &P) {
template<>
raw_ostream &operator<< (raw_ostream &OS,
const Print<NodeAddr<StmtNode*>> &P) {
unsigned Opc = P.Obj.Addr->getCode()->getOpcode();
OS << Print<NodeId>(P.Obj.Id, P.G) << ": " << P.G.getTII().getName(Opc)
<< " [" << PrintListV<RefNode*>(P.Obj.Addr->members(P.G), P.G) << ']';
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 =
find_if(MI.operands(),
[] (const MachineOperand &Op) -> bool {
return Op.isGlobal() || Op.isSymbol();
});
if (Fn != MI.operands_end()) {
if (Fn->isGlobal())
OS << ' ' << Fn->getGlobal()->getName();
else if (Fn->isSymbol())
OS << ' ' << Fn->getSymbolName();
}
}
OS << " [" << PrintListV<RefNode*>(P.Obj.Addr->members(P.G), P.G) << ']';
return OS;
}