[LLVMdev] how to use "new instruction()"

zhi chen zchenhn at gmail.com
Thu Apr 16 23:38:05 PDT 2015


But IRBuilder.CreateXYZ only returns a "VALUE" type. Can I get the
instruction created by it? For example,

IRBuilder<> builder(&*pinst);
Value *val = builder.CreateFAdd(LV, RV, "");

How can I get the fadd instruction created by builder?

On Thu, Apr 16, 2015 at 8:52 PM, zhi chen <zchenhn at gmail.com> wrote:

> Yes. That's what I was the solution in my mind. But I just wanted to know
> if there was a generic way to save some code...
>
> On Thu, Apr 16, 2015 at 8:32 PM, Tim Northover <t.p.northover at gmail.com>
> wrote:
>
>> > I understand that I can detect the operation first, and use "create" to
>> > create for each of them. But I don't if there is a generic way to do
>> this
>> > because if might be add/sub/mul... operations.
>>
>> I don't think there is. Realistically, just blindly replacing
>> instructions with vector equivalents is only going to work in a few
>> cases anyway. You're probably best to intentionally detect those cases
>> and call the correct CreateXYZ function.
>>
>> Cheers.
>>
>> Tim.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150416/d6b404f2/attachment.html>


More information about the llvm-dev mailing list