[LLVMdev] Fwd: GetElementPtr
Ryan Taylor
ryta1203 at gmail.com
Mon Dec 12 16:46:50 PST 2011
---------- Forwarded message ----------
From: Ryan Taylor <ryta1203 at gmail.com>
Date: Mon, Dec 12, 2011 at 4:46 PM
Subject: Re: [LLVMdev] GetElementPtr
To: Eli Friedman <eli.friedman at gmail.com>
So in the second example I gave, why is the pointer type 32 but the index
type is 64?
On Mon, Dec 12, 2011 at 4:43 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
> On Mon, Dec 12, 2011 at 4:38 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
> > By LLVM do you mean the backend? I'm not using the backend, so is that
> i32
> > on the 0 index the type of the index value or the type of the value to
> which
> > exists at that index?
> >
> > it seems the pointer itself has no width, it's arbitrary and is handled
> in
> > the lowering and is target dependent on the bus width.
> >
> > Basically, when I am computing offset I need to know the sizes for add.
> The
> > size of the pointer (dedicated by bus width) and the size of the index.
>
> The size of the index is simply its type. You would normally
> sign-extend or truncate to the width of a pointer to do arithmetic,
> though.
>
> You can grab the pointer size from TargetData::getPointerSizeInBits().
>
> -Eli
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111212/cf6edecb/attachment.html>
More information about the llvm-dev
mailing list