[PATCH] D49887: [DebugInfo] Add support for DWARF5 call site-related attributes

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 23 13:18:35 PDT 2021


aheejin added inline comments.


================
Comment at: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:536
+      // If this is a direct call, find the callee's subprogram.
+      const MachineOperand &CalleeOp = MI.getOperand(0);
+      if (!CalleeOp.isGlobal())
----------------
djtodoro wrote:
> aheejin wrote:
> > djtodoro wrote:
> > > aheejin wrote:
> > > > Sorry for the late question, but is the first operand always the callee in a call instruction? That's not true for WebAssembly, but I'm wondering if WebAssembly is an exception and this holds for all other targets.
> > > >Sorry for the late question, but is the first operand always the callee in a call instruction?
> > > AFAIK, it is true for Intel, Arm, MIPS...
> > > 
> > > >That's not true for WebAssembly, but I'm wondering if WebAssembly is an exception and this holds for all other targets.
> > > 
> > > If that is the case, we can make a `TargetInstr` method, e.g. `getCallee()`, that returns the first operand in general, and override it in the WebAssembly case, right?
> > > 
> > Thanks for the reply! We have multiple call instructions and the location of the callee operand differs even among them, so we have [[ https://github.com/llvm/llvm-project/blob/ad558a4ff7cd61081cfeaabff1dbc8c0a9afa92b/llvm/lib/Target/WebAssembly/Utils/WebAssemblyUtilities.cpp#L83-L98 | getCalleeOp ]] utility method. Adding a general `getCallee` can be good, but if WebAssembly is the only target that does not satisfy the condition that the callee is the 0th operand, maybe we can add a small hacky if-else here..?
> I see... I think we should keep this code target independent (as far as possible), so I still vote for a TargetInstr method here.
> 
> (side note: In addition, there might be some downstream targets that could also have the callee operand at non-0th position, so this will indicate that they need to update that code in order to have proper debug info about call-sites.)
Thanks for the suggestion! I tried that in D102978.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D49887/new/

https://reviews.llvm.org/D49887



More information about the llvm-commits mailing list