[LLVMdev] extract a specific element from a vector in LLVM IR

Amara Emerson amara.emerson at gmail.com
Mon Jul 21 08:55:41 PDT 2014


Use the casting operators documented here to convert your Instruction
to ExtractElementInst:
http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates

Amara

On 21 July 2014 15:56, Vasileios Koutsoumpos
<bill_koutsoumpos at hotmail.com> wrote:
> Hello everybody,
>
> I am creating a vector in llvm IR and I am able to insert and extract
> elements.
> However, I want to take a specific index from the vector but I am not able
> to do that. I found in the doxygen the getIndexOperand(), but I have an
> error during the compilation.
> The code I use is the following:
>
> Instruction *extract = ExtractElementInst::Create(emptyVec, ch, "extract");
> b->getInstList().insertAfter(Insert3, extract);
>
> Value *index_val = extract->getIndexOperand();
>
> The error I get is:
> error: ‘class llvm::Instruction’ has no member named ‘getIndexOperand’
> Value *index_val = extract->getIndexOperand();
>
> I see that I cannot use the getIndexOperand() in an Instruction Type, but
> only through an ExtractElementInst Type.
>
> Do you have any suggestions to get the elements?
>
> Best Regards,
> Vasilis
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list