[LLVMdev] GetElementPtr

Ryan Taylor ryta1203 at gmail.com
Mon Dec 12 15:54:33 PST 2011

For the gep:

%idx1 = getelementptr i32* %MyVar, i32 0

i32* is the type that MyVar is pointing to and i32 is the type of the
offset value, or what? If it's the type of offset value, then
the size of the pointer shouldn't be less than i32, correct?

The index is 0, so in this example, the address computation is idx1 = &MyVar+0.

What I want to know is the size in bits of the values above, it looks
like 0 is 32 bits in size, which would make the pointer size also 32?

On Thu, Dec 8, 2011 at 6:45 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Thu, Dec 8, 2011 at 6:07 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> > Eli,
> >
> >    Ok, thanks, this is a big help. So how can I use the TargetData (or
> get
> > the TargetData) without having a DAG?
> If you're writing a transformation pass, just write
> "getAnalysisIfAvailable<TargetData>()" to get a TargetData*.
> -Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111212/851dc75b/attachment.html>

More information about the llvm-dev mailing list