[llvm-dev] Force casting a Value*

Dipanjan Das via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 11 09:49:07 PDT 2017


On 11 June 2017 at 07:53, David Blaikie <dblaikie at gmail.com> wrote:

> Sounds like you're looking for reinterpret_cast: http://en.
> cppreference.com/w/cpp/language/reinterpret_cast
>

I tried cast<ConstInt>(vo), but that failed at run-time.


>
> On Sun, Jun 11, 2017 at 3:06 AM Dipanjan Das via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>>
>> I am trying to cast a Value* irrespective of  its underlying subclass to
>> uint64 and pass it on to a method as an argument.
>>
>> if (StoreInst *store_inst = dyn_cast<StoreInst>(&I)) {
>>                     Value* vo = store_inst->getValueOperand();
>>                      uint64 value = /* cast vo to unsigned int 64 bit */
>>                      func(value);
>>                 }
>>
>> How can I force cast 'vo' to unsigned int?
>>
>> --
>>
>> Thanks & Regards,
>> Dipanjan
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>


-- 

Thanks & Regards,
Dipanjan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170611/a78e8c7c/attachment.html>


More information about the llvm-dev mailing list