[PATCH] D35082: [OpenCL] Add LangAS::opencl_private to represent private address space in AST

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 5 23:49:29 PDT 2017


rjmccall added a comment.

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.  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





More information about the cfe-commits mailing list