Currently Clang uses default address space (0) to represent private address space for OpenCL
in AST. There are two issues with this:
- Multiple address spaces including private address space cannot be diagnosed.
- There is no mangling for default address space. For example, if private int* is emitted as
i32 addrspace(5)* in IR. It is supposed to be mangled as PUAS5i but it is mangled as
Pi instead.
This patch attempts to represent OpenCL private address space explicitly in AST. It adds
a new enum LangAS::opencl_private and adds it to the variable types which are implicitly
private:
automatic variables without address space qualifier function parameter pointee type without address space qualifier (OpenCL 1.2 and below)
For printing and semantic check of implicit addr space, there is another patch https://reviews.llvm.org/D38857
I think you need a real comment about the design of OpenCL address spaces here. Specifically, it is important to note that OpenCL no longer uses LangAS::Default for anything except r-values.