Anastasia added a comment.

In https://reviews.llvm.org/D35082#890162, @rjmccall wrote:

> Okay.  I think I see your point about why it would be better to have a 
> canonical __private address space that is different from the implicit address 
> space 0.  I assume this means that there should basically never be pointers, 
> references, or l-values in address space 0 in OpenCL.


If you mean 0 is `private` address space then no. There can be private AS 
pointers. But if you mean 0 is no address space then this doesn't exist in 
OpenCL. I think the right design in the first place  would have been to keep 
address spaces in AST just as they are in the source code and add explicit 
address spaces to all types in IR instead. In this case absence of any address 
spaces in AST would signal implicit AS to be used. This would make some Sema 
checks a bit more complicated though, but the design would become a lot 
cleaner. Unfortunately I think it would not be worth doing this big change now.

> You will lose a significant amount of representational efficiency by doing 
> this, but it's probably not overwhelming.
> 
> I know you aren't implementing OpenCL C++ yet, so most of the cases where 
> temporaries are introduced aren't meaningful to you, but you will at least 
> need to consider compound literals.  I suspect the right rule is that 
> file-scope literals should be inferred as being in __global or __constant 
> memory, depending on whether they're const, and local-scope literals should 
> be inferred as __private.
> 
> I'll try to review your patch tomorrow.


https://reviews.llvm.org/D35082



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to