Creating a GEP instruction.

Hi,

I’m trying to create a GEP (inbounds) instruction . I was looking at the createinboundsGEP method . I didnt get the inputiterator part. My question how do i create a GEP instruction and what do i pass for the input iterator arguments.

Thanks,
Rohith.

Generic answer to "how do I create an X instruction": use llc
-march=cpp on an IR file containing the instruction, and read the
result.

For this particular question, the simplest way to get appropriate
iterators is to put the indices into an std::vector and pass in the
.begin() and .end() of it.

-Eli

Thanks. The problem i’m facing is i want to get the address of the first element of an array and i have also tried using the createInBoundsGEP which takes the base pointer and the index value and a name. When i try passing ‘0’ as the index im running into problems.

Thanks,
Rohith.

Are you sure you're passing the right indices? See
http://llvm.org/docs/GetElementPtr.html

-Eli