<div class="gmail_quote">Dear all,<div><br></div><div>I'd like to find the memory location of certain instructions in a compiled/linked binary. During the IR phase, I tag instructions I'm interested in with LLVM'-2.7's new metadata (MDNodes with an identifiable ID). I'd now like to propagate that data to the assembly via a custom DWARF tag I attach to each X86 instruction created from a tagged IR instruction. This will then find its way at assembly time into the binary from where I retrieve it (by locating my custom tags with a DWARF consumer and dumping the addresses of the instruction they're attached to).</div>

<div><br></div><div>Does this sound reasonable?</div><div><br></div><div>I've completed the first part, attaching the MDNodes to IR instructions but I'm a bit overwhelmed by all the backend stuff.</div><div>How can I identify which IR instruction an X86 instruction came from (with a view to attaching an identifying DW_TAG to it)?</div>

<div><br></div><div>I've found the tag definitions in include/llvm/Support/Dwarf.h and added my own.</div><div>lib/CodeGen/AsmPrinter/DwarfDebug.cpp seems to be the only place that emits dwarf data into the assembly stream. It also seems to create a DebugInfoFinder which accesses the IR instructions.</div>

<div><br></div><div>Thanks for any pointers that might slow my spinning head down,</div><div><br></div><font color="#888888"><div>rw</div></font></div>