[llvm-dev] Status of "llvm.pcmarker" intrinsic?

Rob Lyerly via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 20 09:25:55 PST 2015


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.

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.

On Fri, Dec 18, 2015 at 6:27 AM, Bruce Hoult <bruce at hoult.org> wrote:

> 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?
>
> 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.
>
>
> On Thu, Dec 17, 2015 at 7:55 PM, Rob Lyerly via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> That's kind of a shame because it did exactly what I needed -- I'll have
>> to find another route!
>>
>> 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.
>>
>> 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?
>>
>> On Wed, Dec 16, 2015 at 6:49 PM, Philip Reames <listmail at philipreames.com
>> > wrote:
>>
>>> There seems to be semantic overlap with stackmap, patchpoint, and
>>> statepoint as well.
>>>
>>> I suspect we should remove pcmarker and forward serialize it in bitcode
>>> as a nop.
>>>
>>> Philip
>>>
>>>
>>> On 12/16/2015 02:14 PM, Justin Bogner via llvm-dev wrote:
>>>
>>>> Rob Lyerly via llvm-dev <llvm-dev at lists.llvm.org> writes:
>>>>
>>>>> I've seen previous messages about "llvm.pcmarker" not being supported
>>>>> on
>>>>> x86 (e.g.
>>>>> http://lists.llvm.org/pipermail/llvm-dev/2010-February/029239.html
>>>>> and http://lists.llvm.org/pipermail/llvm-dev/2012-June/051104.html).
>>>>> However, these messages are several years old -- is the intrinsic
>>>>> still not
>>>>> implemented?
>>>>>
>>>> As far as I can tell llvm.pcmarker was only ever implemented for Alpha,
>>>> and that backend was removed in 2011. All of the code and documentation
>>>> relating to pcmarker has been dead for years, and should probably just
>>>> be removed.
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> llvm-dev at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>>
>>>
>>>
>>
>>
>> --
>> Rob Lyerly
>> Graduate Research Assistant, Systems Software Research Group
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
>


-- 
Rob Lyerly
Graduate Research Assistant, Systems Software Research Group
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151220/bbc78092/attachment.html>


More information about the llvm-dev mailing list