[LLVMdev] Integer ID for LLVM::Instruction*?
Jonathan Roelofs
jonathan at codesourcery.com
Wed May 6 17:08:41 PDT 2015
On 5/6/15 5:39 PM, Zhoulai 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? In my case,
Only when sizeof(intptr_t) is the same or smaller than the type you're
shoving it into... and that's a platform dependent question, so by doing
that you're introducing a potential portability problem in your code.
What callback are you having trouble with?
Jon
> 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
> <mailto: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
> <mailto: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 <mailto:LLVMdev at cs.uiuc.edu>
> http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the llvm-dev
mailing list