hanchenye-llvm-project/clang/test/CodeGenCUDA
Matt Arsenault c65f966d76 Try to make builtin address space declarations not useless
The way address space declarations for builtins currently work
is nearly useless. The code assumes the address spaces used for
builtins is a confusingly named "target address space" from user
code using __attribute__((address_space(N))) that matches
the builtin declaration. There's no way to use this to declare
a builtin that returns a language specific address space.
The terminology used is highly cofusing since it has nothing
to do with the the address space selected by the target to use
for a language address space.

This feature is essentially unused as-is. AMDGPU and NVPTX
are the only in-tree targets attempting to use this. The AMDGPU
builtins certainly do not behave as intended (i.e. all of the
builtins returning pointers can never compile because the numbered
address space never matches the expected named address space).

The NVPTX builtins are missing tests for some, and the others
seem to rely on an implicit addrspacecast.

Change the used address space for builtins based on a target
hook to allow using a language address space for a builtin.
This allows the same builtin declaration to be used for multiple
languages with similarly purposed address spaces (e.g. the same
AMDGPU builtin can be used in OpenCL and CUDA even though the
constant address spaces are arbitarily different).

This breaks the possibility of using arbitrary numbered
address spaces alongside the named address spaces for builtins.
If this is an issue we probably need to introduce another builtin
declaration character to distinguish language address spaces from
so-called "target address spaces".

llvm-svn: 338707
2018-08-02 12:14:28 +00:00
..
Inputs [HIP] Add hip input kind and codegen for kernel launching 2018-04-25 01:10:37 +00:00
address-spaces.cu [CUDA] Let device-side shared variables be initialized with undef 2018-04-02 17:38:24 +00:00
alias.cu Disable emitting static extern C aliases for amdgcn target for CUDA 2018-03-29 14:50:00 +00:00
amdgpu-kernel-attrs.cu [CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes 2018-06-12 23:58:59 +00:00
builtins-amdgcn.cu Try to make builtin address space declarations not useless 2018-08-02 12:14:28 +00:00
convergent.cu [FileCheck] Add -allow-deprecated-dag-overlap to failing clang tests 2018-07-11 20:26:20 +00:00
cuda-builtin-vars.cu
device-stub.cu [HIP] Register/unregister device fat binary only once 2018-07-20 22:45:24 +00:00
device-var-init.cu [CUDA][HIP] Allow function-scope static const variable 2018-07-28 03:05:25 +00:00
device-vtable.cu [CUDA][HIP] Do not emit type info when compiling for device 2018-06-05 15:11:02 +00:00
filter-decl.cu Really fix test on windows. 2018-02-23 19:38:41 +00:00
flush-denormals.cu [HIP] Support -fcuda-flush-denormals-to-zero for amdgcn 2018-07-21 02:02:22 +00:00
fp-contract.cu
function-overload.cu
kernel-amdgcn.cu [CUDA] Set LLVM calling convention for CUDA kernel 2018-04-20 17:01:03 +00:00
kernel-args-alignment.cu
kernel-args.cu [CUDA][HIP] Set kernel calling convention before arrange function 2018-06-12 00:16:33 +00:00
kernel-call.cu Fix failure in lit test kernel-call.cu due to name mangling 2018-04-25 13:07:58 +00:00
launch-bounds.cu
library-builtin.cu
link-device-bitcode.cu Remove -cc1 option "-backend-option". 2018-04-12 22:21:36 +00:00
llvm-used.cu
nothrow.cu
printf-aggregate.cu
printf.cu
propagate-metadata.cu Fix typos in clang 2018-04-06 15:14:32 +00:00
ptx-kernels.cu