[PATCH] D76620: [SYCL] Implement __builtin_unique_stable_name.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 09:15:05 PDT 2020


erichkeane created this revision.
erichkeane added a reviewer: bader.
Herald added subscribers: Anastasia, ebevhan, kristina.
erichkeane added a reviewer: rolandschulz.

In order to support non-user-named kernels, SYCL needs some way in the
integration headers to name the kernel object themselves. Initially, the
design considered just RTTI naming of the lambdas, this results in a
quite unstable situation in light of some device/host macros.
Additionally, this ends up needing to use RTTI, which is a burden on the
implementation and typically unsupported.

Instead, we've introduced a builtin, __builtin_unique_stable_name, which
takes a type or expression, and results in a constexpr constant
character array that uniquely represents the type (or type of the
expression) being passed to it.

The implementation accomplishes that simply by using a slightly modified
version of the Itanium Mangling. The one exception is when mangling
lambdas, instead of appending the index of the lambda in the function,
it appends the macro-expansion back-trace of the lambda itself in the
form LINE->COL[~LINE->COL...].


Repository:
  rC Clang

https://reviews.llvm.org/D76620

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/AST/Expr.h
  clang/include/clang/AST/Mangle.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/CodeGenSYCL/unique-stable-name.cpp
  clang/test/ParserSYCL/unique-stable-name.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76620.252065.patch
Type: text/x-patch
Size: 31468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200323/5275b5e4/attachment-0001.bin>


More information about the cfe-commits mailing list