<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 12/12/11 7:00 PM, Ryan Taylor wrote:
<blockquote
cite="mid:CABgVvXvkW-goJ7SvsPrJhE35mL6Krs+gEZ-d5LsW6UG3cBSFYA@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
So in this example:<br>
<br>
<pre>%idx = getelementptr { float*, i32 }* %MyStruct, i64 0, i32 1
<font><font size="4">Why is it picking i64 for the index but i32 for the offset? </font></font>
</pre>
</blockquote>
<br>
I believe pointers and arrays are indexed using i64 (or some integer
size matching the pointer size) and structure elements are indexed
using i32.<br>
<br>
-- John T.<br>
<br>
<blockquote
cite="mid:CABgVvXvkW-goJ7SvsPrJhE35mL6Krs+gEZ-d5LsW6UG3cBSFYA@mail.gmail.com"
type="cite"><br>
<br>
<div class="gmail_quote">
On Mon, Dec 12, 2011 at 4:58 PM, Ryan Taylor <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:ryta1203@gmail.com">ryta1203@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<div class="gmail_quote">
<div class="im">---------- Forwarded message ----------<br>
From: <b class="gmail_sendername">Ryan Taylor</b> <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:ryta1203@gmail.com" target="_blank">ryta1203@gmail.com</a>></span><br>
</div>
<div class="im">Date: Mon, Dec 12, 2011 at 4:58 PM<br>
Subject: Re: [LLVMdev] GetElementPtr<br>
</div>
<div>
<div class="h5">To: Eli Friedman <<a
moz-do-not-send="true"
href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>><br>
<br>
<br>
Sorry,<br>
<br>
So what I'm trying to ask is are the widths given (32,
64) for the index and the offset the widths of the index
and offset values or the width of the type they are
offsetting and indexing or both?<br>
<br>
I apologize if you already answered this and I didn't
get it.
<div>
<div><br>
<br>
<div class="gmail_quote">On Mon, Dec 12, 2011 at
4:50 PM, Eli Friedman <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:eli.friedman@gmail.com"
target="_blank">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>On Mon, Dec 12, 2011 at 4:46 PM, Ryan
Taylor <<a moz-do-not-send="true"
href="mailto:ryta1203@gmail.com"
target="_blank">ryta1203@gmail.com</a>>
wrote:<br>
> So in the second example I gave, why is
the pointer type 32 but the index<br>
> type is 64?<br>
<br>
</div>
Because that's what the frontend chose the
generate? I'm not sure<br>
what you're trying to ask.<br>
<span><font color="#888888"><br>
-Eli<br>
</font></span>
<div>
<div><br>
> On Mon, Dec 12, 2011 at 4:43 PM, Eli
Friedman <<a moz-do-not-send="true"
href="mailto:eli.friedman@gmail.com"
target="_blank">eli.friedman@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Mon, Dec 12, 2011 at 4:38 PM,
Ryan Taylor <<a moz-do-not-send="true"
href="mailto:ryta1203@gmail.com"
target="_blank">ryta1203@gmail.com</a>>
wrote:<br>
>> > By LLVM do you mean the
backend? I'm not using the backend, so is
that<br>
>> > i32<br>
>> > on the 0 index the type of the
index value or the type of the value to<br>
>> > which<br>
>> > exists at that index?<br>
>> ><br>
>> > it seems the pointer itself
has no width, it's arbitrary and is handled<br>
>> > in<br>
>> > 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.<br>
>> > The<br>
>> > size of the pointer (dedicated
by bus width) and the size of the index.<br>
>><br>
>> The size of the index is simply its
type. You would normally<br>
>> sign-extend or truncate to the
width of a pointer to do arithmetic,<br>
>> though.<br>
>><br>
>> You can grab the pointer size from
TargetData::getPointerSizeInBits().<br>
>><br>
>> -Eli<br>
><br>
><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</body>
</html>