<div dir="ltr">I think we should keep GEP essentially the same, but disassociate the type being GEPd over from the type of the operands. So, assuming the new ptr type is spelled "ptr", we could use this syntax:<div>%inner.ptr = getelementptr ptr, ptr %x, i32 1</div><div><br></div><div>Or if I was adding 1 to a "struct A*" value in C:</div><div>%next_elt = getelementptr %struct.A, ptr %x, i32 1</div><div><br></div><div>Ditto for all other instructions that care about pointee types, like load and store:</div><div>%v = load i32, ptr %p ; loads already know (and store!) their loaded type internally</div><div>store i32 %v, ptr %p ; no need to duplicate that %p points to, we have the type on %v</div><div><br></div><div>I don't think this can be incremental, I think it all goes at once. I think you might need to add a new GEP bitcode opcode, since that instruction grows a new type operand that doesn't come from an operand type or result type. It also wouldn't be too hard to accept the old .ll syntax, since the upgrade path mostly discards information.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 6, 2015 at 4:12 PM, Sanjoy Das <span dir="ltr"><<a href="mailto:sanjoy@playingwithpointers.com" target="_blank">sanjoy@playingwithpointers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How would GEP's look like in this scheme? Concretely, what would be<br>
the equivalent of<br>
<br>
%inner.ptr = getelementptr i8** %x, i32 1<br>
<br>
assuming we're doing target independent optimizations and do not know<br>
the size of a pointer?<br>
<br>
-- Sanjoy<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>