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

zhi chen zchenhn at gmail.com
Thu Apr 16 17:53:05 PDT 2015


Thanks Jonathan. I knew this document. But I didn't understand the "unsigned
iType, Use *Ops" fields. Could you please help how I can create a new
instruction to do the example I was giving? Thanks for your time in advance.

Best,
Zhi

On Thu, Apr 16, 2015 at 5:48 PM, Jonathan Roelofs <jonathan at codesourcery.com
> wrote:

> You're probably looking for this method:
> https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Instruction.h#L395
>
> Jon
>
> On 4/16/15 6:38 PM, zhi chen wrote:
>
>> I read the tutorial document, but I didn't understand the it and Ops
>> fields of instruction class well. Can any one give me an example?
>>
>> Instruction *newInstr = new Instruction(Type *ty, unsigned it, Use *Ops,
>> unsigned NumOps, Instruction *InsertBefore);
>>
>> For example, I have an *instruction *pInst *without no the type of
>> operation in advance. If I want to create a new instruction which is
>> similar to the *pInst. *How can I do it?
>>
>> Any help will be appreciated. Thanks.
>>
>> Best,
>> Zhi
>>
>>
>> _______________________________________________
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150416/66855770/attachment.html>


More information about the llvm-dev mailing list