From: Krzysztof Parzyszek Date: Thu, 22 Sep 2016 20:58:19 +0000 (+0000) Subject: [RDF] Print the function name for calls in dumps X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b505adc10e27ee67c76123206d1deef3e2565225;p=llvm [RDF] Print the function name for calls in dumps git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282191 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/RDFGraph.cpp b/lib/Target/Hexagon/RDFGraph.cpp index 72d443309e3..bea9a837127 100644 --- a/lib/Target/Hexagon/RDFGraph.cpp +++ b/lib/Target/Hexagon/RDFGraph.cpp @@ -210,9 +210,24 @@ raw_ostream &operator<< (raw_ostream &OS, const Print> &P) { template<> raw_ostream &operator<< (raw_ostream &OS, const Print> &P) { - unsigned Opc = P.Obj.Addr->getCode()->getOpcode(); - OS << Print(P.Obj.Id, P.G) << ": " << P.G.getTII().getName(Opc) - << " [" << PrintListV(P.Obj.Addr->members(P.G), P.G) << ']'; + 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 = + 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(P.Obj.Addr->members(P.G), P.G) << ']'; return OS; }