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?<br><br>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.<br>
<br>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.<br><br>A less confusing example (for me) might be this: <br><pre>%idx2 = getelementptr i32* %MyVar, i64 1<br>
<br><font><font size="4">The pointer type size is 32 bits (let's say int pointer), why is the index of size 64?</font></font><br></pre><br><div class="gmail_quote">On Mon, Dec 12, 2011 at 3:58 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, Dec 12, 2011 at 3:54 PM, Ryan Taylor <<a href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>> wrote:<br>

> For the gep:<br>
><br>
> %idx1 = getelementptr i32* %MyVar, i32 0<br>
><br>
> i32* is the type that MyVar is pointing to and i32 is the type of the offset<br>
> value, or what? If it's the type of offset value, then<br>
> the size of the pointer shouldn't be less than i32, correct?<br>
><br>
><br>
> The index is 0, so in this example, the address computation is idx1 =<br>
> &MyVar+0.<br>
><br>
> What I want to know is the size in bits of the values above, it looks like 0<br>
> is 32 bits in size, which would make the pointer size also 32?<br>
<br>
</div>LLVM will sign-extend or truncate the index to the size of the<br>
pointer; the pointer type could have any width.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span></blockquote></div><br>