On 5/1/15 11:11 AM, Zhoulai wrote:> Hi, all
>
> I am writing an LLVM pass in which I need to convert an
> llvm::ICmpInst, denoted by ‘inst’ below, to llvm::FCmpInst.
>
> My current approach is somewhat clumsy: I first retrieve the operands
> of ‘inst’, then convert those operands of int type to double typed
> values, and then create a new llvm::FCmpInst with the double typed
> values. This is clumsy because I also need to determine the different
> types of the integer operands, such as int32, int64, etc.
>
> So, is there a simpler way to convert an llvm::ICmpInst to
> llvm::FCmpInst? Thanks.
There is not a way of which I am aware. Because you cannot convert an
instruction from one type of instruction to another type of instruction,
the only way to do what you're suggesting is to create a new FCmpInst
and to replace the uses of the ICmpInst with the FCmpInst.
Regards,
John Criswell
>
> Sincerely,
> Zhoulai
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150502/a19f010d/attachment.html>