[OpenCL] change default address space of pointers in CL2.0 mode

Anastasia Stulova anastasia.stulova at arm.com
Thu Nov 20 10:44:02 PST 2014

Ok. If there are multiple use cases for this, perhaps, it's worth trying to
add 'private' to the list of OpenCL address spaces in Clang.


-----Original Message-----
From: Matt Arsenault [mailto:Matthew.Arsenault at amd.com] 
Sent: 17 November 2014 22:48
To: Anastasia Stulova; 'Pekka Jääskeläinen'; cfe-commits at cs.uiuc.edu
Subject: Re: [OpenCL] change default address space of pointers in CL2.0 mode

On 11/17/2014 10:41 AM, Anastasia Stulova wrote:
> One of the difficulty is that Clang currently treats private address 
> space just the same as if no address space qualifier was specified. 
> That makes it difficult to find a right place to handle the default 
> address space behaviour, because information becomes unavailable early on.

Would it be possible to change this? QualType can distinguish between
hasAddressSpace() and getAddressSpace() == 0, but this isn't consistently
used. A while ago I looked into fixing a problem with builtins where string
literals don't work in OpenCL. Most notably, __builtin_nan doesn't work
since the implicit conversion from the constant string to the no address
space pointer of the builtin is rejected. I was thinking the correct thing
to do would be to interpret the lack of an address space on the builtin as
accepting any address space, and that would require consistently handling
address space 0 and/or making the private address space an explicit one like
the others.


More information about the cfe-commits mailing list