[all-commits] [llvm/llvm-project] b5a034: [SYCL] Implement __builtin_unique_stable_name.

Erich Keane via All-commits all-commits at lists.llvm.org
Wed Mar 25 07:02:08 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b5a034e771d0e4d7d8e71fc545b230d98e5a1f42
      https://github.com/llvm/llvm-project/commit/b5a034e771d0e4d7d8e71fc545b230d98e5a1f42
  Author: Erich Keane <erich.keane at intel.com>
  Date:   2020-03-25 (Wed, 25 Mar 2020)

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

  Log Message:
  -----------
  [SYCL] Implement __builtin_unique_stable_name.

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

Differential Revision: https://reviews.llvm.org/D76620




More information about the All-commits mailing list