llvm-project/clang/lib/Basic
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
..
Targets Try to make builtin address space declarations not useless 2018-08-02 12:14:28 +00:00
Attributes.cpp Add #pragma clang attribute 2017-04-18 14:33:39 +00:00
Builtins.cpp [Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it 2018-07-09 19:00:16 +00:00
CMakeLists.txt Move VersionTuple from clang/Basic to llvm/Support 2018-06-11 10:28:04 +00:00
CharInfo.cpp
Cuda.cpp [CUDA] Enable CUDA compilation with CUDA-9.2 2018-04-24 18:23:19 +00:00
Diagnostic.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
DiagnosticIDs.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
DiagnosticOptions.cpp [Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-02-16 23:40:07 +00:00
FileManager.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
FileSystemStatCache.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
IdentifierTable.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
LangOptions.cpp [OpenCL] Factor out language version printing 2018-05-08 13:47:43 +00:00
MemoryBufferCache.cpp Reapply "Modules: Cache PCMs in memory and avoid a use-after-free" 2017-03-20 17:58:26 +00:00
Module.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
ObjCRuntime.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
OpenMPKinds.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
OperatorPrecedence.cpp Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
SanitizerBlacklist.cpp Allow specifying sanitizers in blacklists 2017-09-25 22:11:12 +00:00
SanitizerSpecialCaseList.cpp Update SanitizerSpecialCaseList to use renamed functions in base class. 2017-11-07 21:16:37 +00:00
Sanitizers.cpp [Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2018-03-28 22:09:09 +00:00
SourceLocation.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
SourceManager.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
TargetInfo.cpp [Android] Increase default new alignment for Android 2018-08-01 17:55:34 +00:00
Targets.cpp [Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals 2018-06-20 17:19:40 +00:00
Targets.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
TokenKinds.cpp
Version.cpp
VirtualFileSystem.cpp Revert r338057 "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name" 2018-07-26 23:21:51 +00:00
Warnings.cpp Remove trailing space 2018-07-30 19:24:48 +00:00
XRayInstr.cpp [XRay] Add clang builtin for xray typed events. 2018-04-17 21:32:43 +00:00
XRayLists.cpp [XRay][llvm+clang] Consolidate attribute list files 2018-04-09 04:02:09 +00:00