Hi all, 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). Thanks in advance, Eduardo
On Sat, Dec 29, 2012 at 5:20 AM, Eduardo <erocha.ssa at gmail.com> wrote:> Hi all, > > 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).One way to answer questions like this is to use the LLVM Demo (http://llvm.org/demo) & the "LLVM C++ API code" target.> > Thanks in advance, > Eduardo > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
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.