<div dir="ltr">You're right about the mapping between IR instruction number and PC.  I do realize adding the intrinsic in the IR wouldn't lead to the exact return address -- the store/restore procedure for each call site is call site/architecture-specific for sure.  I was hoping to at least get an approximate value and then go from there, but it looks like I'll have to take another path entirely.<br><div><div><div><div><br>Unfortunately, dumping the return value at runtime isn't realistic for me.  I'm building a tool that needs the mapping of return values between architectures at compile-time.  I'm guessing my options are to A. modify the backend to record the return address of each CodeGen'd call (after all optimizations have been applied) or B. Build a stand-alone tool that goes through the generated machine code outside of LLVM.<br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 18, 2015 at 6:27 AM, Bruce Hoult <span dir="ltr"><<a href="mailto:bruce@hoult.org" target="_blank">bruce@hoult.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Wouldn't you get precisely the same numbers (and in the same order) by dumping the return address of each function just before returning from it?</div><div><br></div>The mapping between PC and a given IR instruction (let alone source line of code) is a pretty fuzzy thing in the presence of even simple optimizations. The return address of a function is much more well-defined than the address of some arbitrary IR instruction.<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 17, 2015 at 7:55 PM, Rob Lyerly via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>That's kind of a shame because it did exactly what I needed -- I'll have to find another route!<br><br></div>I wanted to use "llvm.pcmarker" to find the address of a given IR instruction when generated using different back-ends.  In particular, I wanted to be able to map the return address of a specific function call on x86-64 with the return address for the *same* function call on Aarch64.  My plan was to develop a pass that dumped the pcmarker intrinsic after every function call site, so that I could correlate the return addresses between function call sites on both architectures.<br><br></div>I'm still a newbie in terms of LLVM internals, so I'm wondering what would be the easiest approach to accomplish this.  I've seen elsewhere people recommending adding custom intrinsics that get converted into pseudo-instructions in the back-end.  Those pseudo instructions would then generate a label when CodeGen'd...does this seem sane?  Or is there an easier approach to solving this?<br></div></div><div class="gmail_extra"><span><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 6:49 PM, Philip Reames <span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There seems to be semantic overlap with stackmap, patchpoint, and statepoint as well.<br>
<br>
I suspect we should remove pcmarker and forward serialize it in bitcode as a nop.<br>
<br>
Philip<div><div><br>
<br>
On 12/16/2015 02:14 PM, Justin Bogner via llvm-dev wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
Rob Lyerly via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> writes:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I've seen previous messages about "llvm.pcmarker" not being supported on<br>
x86 (e.g. <a href="http://lists.llvm.org/pipermail/llvm-dev/2010-February/029239.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2010-February/029239.html</a><br>
and <a href="http://lists.llvm.org/pipermail/llvm-dev/2012-June/051104.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermail/llvm-dev/2012-June/051104.html</a>).<br>
However, these messages are several years old -- is the intrinsic still not<br>
implemented?<br>
</blockquote>
As far as I can tell llvm.pcmarker was only ever implemented for Alpha,<br>
and that backend was removed in 2011. All of the code and documentation<br>
relating to pcmarker has been dead for years, and should probably just<br>
be removed.<br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote>
<br>
</blockquote></div><br><br clear="all"><br></span><span>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><span>Rob Lyerly</span><br></div><div>Graduate Research Assistant, Systems Software Research Group<br><br></div><div><img src="http://www.branding.unirel.vt.edu/images/S_logo-tagline-old.jpg" height="40" width="140">   <img src="http://www.oocities.org/rainforestwind/divider_black_vertical.jpg" height="36" width="8"><img src="http://www.ece.vt.edu/images/inside-top-ecelogo.png" height="47" width="232"></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</span></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><span>Rob Lyerly</span><br></div><div>Graduate Research Assistant, Systems Software Research Group<br><br></div><div><img src="http://www.branding.unirel.vt.edu/images/S_logo-tagline-old.jpg" height="40" width="140">   <img src="http://www.oocities.org/rainforestwind/divider_black_vertical.jpg" height="36" width="8"><img src="http://www.ece.vt.edu/images/inside-top-ecelogo.png" height="47" width="232"></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div>