Villmow, Micah
2012-Sep-07 17:47 UTC
[LLVMdev] Bitcasts between pointers with different address spaces
Should LLVM make bitcasts between pointers with different address spaces illegal? This will require a small clarification in the documentation and an assertion check added to the verifier, but I think this would be a good approach. The reason being is that in different address spaces, pointers are not always the same size. This could be limited to make it legal only if the size of the pointer in source and destination address spaces are equivalent, but that seems like more of a work-around than a proper solution. Ideas? Micah -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120907/aa47320f/attachment.html>
Mon Ping Wang
2012-Sep-07 22:18 UTC
[LLVMdev] Bitcasts between pointers with different address spaces
Hi, I don't think we should make bit casts between pointers with different address spaces illegal. Address spaces are not required to be disjoint. In the N1169 spec, it says A non-null pointer into an address space A can be cast to a pointer into another address space B, but such a cast is undefined if the source pointer does not point to a location in B. If the address spaces overlap, one should be able to bticast between them. -- Mon Ping On Sep 7, 2012, at 10:47 AM, Villmow, Micah wrote:> Should LLVM make bitcasts between pointers with different address spaces illegal? > > This will require a small clarification in the documentation and an assertion check added to the verifier, but I think this would be a good approach. > > The reason being is that in different address spaces, pointers are not always the same size. > > This could be limited to make it legal only if the size of the pointer in source and destination address spaces are equivalent, but that seems like more of a work-around than a proper solution. > > Ideas? > Micah > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120907/c3f65e98/attachment.html>
Villmow, Micah
2012-Sep-07 22:24 UTC
[LLVMdev] Bitcasts between pointers with different address spaces
What about the part about address spaces with pointers of different sizes? Micah From: Mon Ping Wang [mailto:monping at apple.com] Sent: Friday, September 07, 2012 3:19 PM To: Villmow, Micah Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Bitcasts between pointers with different address spaces Hi, I don't think we should make bit casts between pointers with different address spaces illegal. Address spaces are not required to be disjoint. In the N1169 spec, it says A non-null pointer into an address space A can be cast to a pointer into another address space B, but such a cast is undefined if the source pointer does not point to a location in B. If the address spaces overlap, one should be able to bticast between them. -- Mon Ping On Sep 7, 2012, at 10:47 AM, Villmow, Micah wrote: Should LLVM make bitcasts between pointers with different address spaces illegal? This will require a small clarification in the documentation and an assertion check added to the verifier, but I think this would be a good approach. The reason being is that in different address spaces, pointers are not always the same size. This could be limited to make it legal only if the size of the pointer in source and destination address spaces are equivalent, but that seems like more of a work-around than a proper solution. Ideas? Micah _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu<mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120907/cbed3dc1/attachment.html>
Nick Lewycky
2012-Sep-08 06:10 UTC
[LLVMdev] Bitcasts between pointers with different address spaces
Mon Ping Wang wrote:> Hi, > > I don't think we should make bit casts between pointers with different > address spaces illegal. Address spaces are not required to be disjoint. > In the N1169 spec, it says > A non-null pointer into an address space A can be cast to a pointer into > another address space B, but such a cast is undefined if the source > pointer does not point to a location in B.Use a ptrtoint + inttoptr to implement the cast.> If the address spaces overlap, one should be able to bticast between them.I am not okay with having the verifier accept or reject a bitcast based on the contents of the TargetData. Given that we intend to permit different address spaces to have different sized pointers, we'll need to reject all cross address-space bitcasts and casts will need to go through ptrtoint+inttoptr which makes the potential for truncation and extension of the value explicit. Is that acceptable? In particular, it still permits you to have overlapping address spaces, right? Nick> On Sep 7, 2012, at 10:47 AM, Villmow, Micah wrote: > >> Should LLVM make bitcasts between pointers with different address >> spaces illegal? >> This will require a small clarification in the documentation and an >> assertion check added to the verifier, but I think this would be a >> good approach. >> The reason being is that in different address spaces, pointers are not >> always the same size. >> This could be limited to make it legal only if the size of the pointer >> in source and destination address spaces are equivalent, but that >> seems like more of a work-around than a proper solution. >> Ideas? >> Micah >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Apparently Analagous Threads
- [LLVMdev] Bitcasts between pointers with different address spaces
- [LLVMdev] Bitcasts between pointers with different address spaces
- [LLVMdev] Bitcasts between pointers with different address spaces
- [LLVMdev] Bitcasts between pointers with different address spaces
- [LLVMdev] Bitcasts between pointers with different address spaces