llvm-project/clang/lib/Basic/Targets
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
..
AArch64.cpp [ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs 2018-07-26 22:18:28 +00:00
AArch64.h [ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs 2018-07-26 22:18:28 +00:00
AMDGPU.cpp AMDGPU: Add Vega12 and Vega20 2018-04-30 19:08:27 +00:00
AMDGPU.h Try to make builtin address space declarations not useless 2018-08-02 12:14:28 +00:00
ARM.cpp [AArch64][ARM] Add Armv8.4-A tests 2018-08-01 12:41:10 +00:00
ARM.h [Targets] Implement getConstraintRegister for ARM and AArch64 2018-04-30 09:11:08 +00:00
AVR.cpp Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
AVR.h [AVR] Set the program address space in the data layout 2018-02-19 10:46:16 +00:00
BPF.cpp Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
BPF.h bpf: recognize target specific option -mattr=dwarfris in clang 2018-06-15 15:53:31 +00:00
Hexagon.cpp [Hexagon] Diagnose intrinsics not supported by selected CPU/HVX 2018-07-12 18:54:04 +00:00
Hexagon.h Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
Lanai.cpp Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
Lanai.h Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
Le64.cpp
Le64.h
MSP430.cpp
MSP430.h
Mips.cpp Use Triple::isMIPS() instead of enumerating all Triples. NFC 2018-06-25 16:49:52 +00:00
Mips.h Use Triple::isMIPS() instead of enumerating all Triples. NFC 2018-06-25 16:49:52 +00:00
NVPTX.cpp [CUDA] Added -f[no-]cuda-short-ptr option 2018-05-09 23:10:09 +00:00
NVPTX.h [NVPTX] Removed 'satom' feature which is no longer used. 2018-04-11 17:51:33 +00:00
Nios2.cpp
Nios2.h Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
OSTargets.cpp Toolchain: Normalize dwarf, sjlj and seh eh 2017-11-29 07:25:12 +00:00
OSTargets.h [MS] Update _MSVC_LANG values for C++17 and C++2a 2018-07-23 17:44:00 +00:00
PNaCl.cpp
PNaCl.h
PPC.cpp [PowerPC] The __float128 type should only be available on Power9 2018-06-13 16:05:05 +00:00
PPC.h By popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64 2018-07-17 12:33:19 +00:00
RISCV.cpp [PATCH] [RISCV] Extend getTargetDefines for RISCVTargetInfo 2018-04-05 12:54:00 +00:00
RISCV.h [PATCH] [RISCV] Extend getTargetDefines for RISCVTargetInfo 2018-04-05 12:54:00 +00:00
SPIR.cpp
SPIR.h [SPIR] Prevent SPIR targets from using half conversion intrinsics 2018-06-20 09:49:40 +00:00
Sparc.cpp [Sparc] Add floating-point register names 2018-05-30 06:02:18 +00:00
Sparc.h NFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have it 2018-07-24 00:07:49 +00:00
SystemZ.cpp Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
SystemZ.h Add Rest of Targets Support to ValidCPUList (enabling march notes) 2018-02-08 23:16:55 +00:00
TCE.cpp
TCE.h [OpenCL] Add LangAS::opencl_private to represent private address space in AST 2017-10-13 03:37:48 +00:00
WebAssembly.cpp [WebAssembly] Add exception handling option 2018-03-02 00:39:16 +00:00
WebAssembly.h [WebAssembly] Change size_t to `unsigned long`. 2018-07-24 00:29:58 +00:00
X86.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
X86.h Remove trailing space 2018-07-30 19:24:48 +00:00
XCore.cpp
XCore.h