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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 12:42:54 PDT 2017


yaxunl created this revision.

Currently Clang uses default address space (0) to represent private address space for OpenCL
in AST. There are two issues with this:

1. The error message is confusing since it will output a private pointer as a pointer without

address space.

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

This is a work in progress for preview.


https://reviews.llvm.org/D35082

Files:
  include/clang/Basic/AddressSpaces.h
  lib/AST/ASTContext.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/TypePrinter.cpp
  lib/Basic/Targets.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaType.cpp
  test/CodeGenOpenCL/address-spaces-mangling.cl
  test/SemaOpenCL/address-spaces-conversions-cl2.0.cl
  test/SemaOpenCL/address-spaces.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35082.105507.patch
Type: text/x-patch
Size: 18882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170706/0b95ed0b/attachment-0001.bin>


More information about the cfe-commits mailing list