]> granicus.if.org Git - clang/commit
[OpenCL] Makes kernels use the SPIR_KERNEL CC by default.
authorPekka Jaaskelainen <pekka.jaaskelainen@tut.fi>
Thu, 1 Jun 2017 07:18:49 +0000 (07:18 +0000)
committerPekka Jaaskelainen <pekka.jaaskelainen@tut.fi>
Thu, 1 Jun 2017 07:18:49 +0000 (07:18 +0000)
commit140f5e804cc89afe5716bc8e3b3467e583e39015
tree432d3215a26551463a231fac9e34b3554799d0c9
parent6bd81300ff7f0548dd593bba01b1641691e3056c
[OpenCL] Makes kernels use the SPIR_KERNEL CC by default.

Rationale: OpenCL kernels are called via an explicit runtime API
with arguments set with clSetKernelArg(), not as normal sub-functions.
Return SPIR_KERNEL by default as the kernel calling convention to ensure
the fingerprint is fixed such way that each OpenCL argument gets one
matching argument in the produced kernel function argument list to enable
feasible implementation of clSetKernelArg() with aggregates etc. In case
we would use the default C calling conv here, clSetKernelArg() might
break depending on the target-specific conventions; different targets
might split structs passed as values to multiple function arguments etc.

https://reviews.llvm.org/D33639

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304389 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Basic/Targets.cpp
lib/CodeGen/ABIInfo.h
lib/CodeGen/CGCall.cpp
lib/CodeGen/TargetInfo.cpp
lib/Sema/SemaType.cpp
test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl [new file with mode: 0644]