[LLVMdev] GetElementPtrConstantExpr question

Óscar Fuentes ofv at wanadoo.es
Sat Dec 29 10:39:11 PST 2012


Eduardo <erocha.ssa at gmail.com> writes:

> I just come across an IR instruction like this:
>
>   %0 = getelementptr i32* getelementptr inbounds ([42 x i32]* @aaa,
> i32 0, i32 0), i32 %2
>
> What does the part "i32* getelementptr inbounds ([42 x i32]* @aaa, i32
> 0, i32 0)" mean? As far as I could understand this is a
> GetElementPtrConstantExpr, isn't it?
>
> My question is: how can I instantiate a class that represents that
> instruction part so that I can perform some changes in it? I tried the
> class GetElementPtrConstantExpr but it seems to be a private class to
> Constants.cpp (I saw a comment in lib/VMCore/ConstantsContext.h about
> that).

See llvm::ConstantExpr:

http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantExpr.html

More precisely, the static methods getGetElementPtr and
getInBoundsGetElementPtr.




More information about the llvm-dev mailing list