[cfe-dev] [LLVMdev] Language-specific vs target-specific address spaces (was Re: [PATCH] OpenCL support - update on keywords)

Chris Lattner clattner at apple.com
Wed Mar 2 22:19:25 PST 2011


On Mar 2, 2011, at 3:14 PM, David Neto wrote:

> I read OpenCL's use of address spaces as a subsetting of the
> Embedded C concept of address spaces, i.e. a specific set of them, with
> specific names, and language-level restrictions.
> 
> I disagree with Speziale.   OpenCL address spaces are not "scopes"
> or scope-like things.  OpenCL address spaces describe disjoint storage
> locations with incompatible pointer types, and with independent address
> numbering (i.e. if you happened to cast a pointer to an integer).
> 
> For example, Clang makes sure that you can't assign a pointer to one
> address space into a pointer to another address space.
> "illegal implicit conversion between two pointers with different
> address spaces".
> OpenCL has that restriction as well: Section 6.8 paragraph a.
> 
> So I argue you really do want to use Clang address spaces to represent
> OpenCL address spaces.

FWIW, while clang address spaces are a (partial) implementation of the embedded C spec, they were added to clang specifically because of OpenCL.  I agree that they are the right way to represent the various OpenCL memory spaces.

Incidentally, please avoid cc'ing both llvmdev and cfe-dev on emails.

-Chris



More information about the cfe-dev mailing list