[LLVMdev] Proposal: New IR instruction for casting between address spaces

Chris Lattner clattner at apple.com
Fri Sep 14 09:37:28 PDT 2012

On Sep 14, 2012, at 8:15 AM, "Villmow, Micah" <Micah.Villmow at amd.com> wrote:

>>> This is a problem for auto upgrade as well.  Today, we have bit cast
>> between same size pointers for different address space.  We would need
>> to do something special for auto upgrade here since the proposal is to
>> not allow bit cast between pointers of different address spaces.
>> I haven't followed the details of the proposal, but I think it makes
>> perfect sense to continue using bitcast for ptr/ptr casts within the
>> same pointer size.  If you do that, then there is no auto-upgrade
>> issue: all existing bc files can just be assumed to have the same
>> pointer size.
> [Villmow, Micah] So basically we don't need a new IR instructions, but instead
> 1) bitcasts between pointers of different size is illegal, the proper approach is inttoptr/ptrtoint.
> 2) bitcasts between pointers of the same size stays legal.
> 3) No new IR instruction is needed, as converting between pointers of different sizes requires inttoptr/ptrtoint.
> The only issues are then to update the verifier to assert on bitcasts between pointers of different sizes and add in auto-upgrade of binaries to switch to inttoptr/ptrtoint. By doing this, I then can clear the way for allowing LLVM to support multiple pointer sizes.
> Sound good?

Makes sense to me!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120914/4ec086c5/attachment.html>

More information about the llvm-dev mailing list