[LLVMdev] Integer ID for LLVM::Instruction*?

David Blaikie dblaikie at gmail.com
Wed May 6 16:48:53 PDT 2015


On Wed, May 6, 2015 at 4:39 PM, Zhoulai <zell08v at gmail.com> wrote:

> Thanks. I did not know this simple mechanism,  shame...
>
> Is it safe? Can I then pass the intptr_t to int or long int?
>

Depends how big a pointer is on your system. But you should be able to
roundtrip it through other integers as safely as you could any other
integer (ie: so long as the other integer type is the same size (and
signedness) or bigger, etc)


> In my case, the ID has to be passed to a call back function accepting only
> primitive typed parameters.
>
> Zhoulai
>
> On Wed, May 6, 2015 at 4:12 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> intptr_t id = static_cast<intptr_t>(inst);
>>
>> ?
>>
>> On Wed, May 6, 2015 at 3:33 PM, Zhoulai <zell08v at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I wonder whether we can easily retrieve an LLVM instruction ID that
>>> uniquely identifies the instruction. In my case, I need to avoid using
>>> llvm::Instruction* directly. Given an 'inst' of type llvm::instruction*, is
>>> there some readily usable method as simple as  “int id = inst->id( )”?
>>> Thanks.
>>>
>>> Zhoulai
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150506/61d08b40/attachment.html>


More information about the llvm-dev mailing list