[PATCH] D19932: [OpenCL] Add to_{global|local|private} builtin functions.

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Wed May 4 13:07:09 PDT 2016


yaxunl created this revision.
yaxunl added reviewers: Anastasia, pxli168.
yaxunl added subscribers: cfe-commits, tstellarAMD.

OpenCL builtin functions to_{global|local|private} accepts argument of pointer type to arbitrary pointee type, and return a pointer to the same pointee type in different addr space, i.e.

  global gentype *to_global(gentype *p);

It is not desirable to declare it as

  global void *to_global(void *);

in opencl header file since it misses diagnostics and generates extra bitcasts.

This patch implements these builtin functions as Clang builtin functions. In the builtin def file they are defined to have signature void*(void*). When handling call expressions, their declarations are re-written to have correct parameter type and return type corresponding to the call argument.

http://reviews.llvm.org/D19932

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Decl.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaExpr.cpp
  test/CodeGenOpenCL/to_addr_builtin.cl
  test/SemaOpenCL/to_addr_builtin.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19932.56192.patch
Type: text/x-patch
Size: 12521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160504/1efdb0d1/attachment.bin>


More information about the cfe-commits mailing list