teak-llvm/clang/lib/Sema
Simon Tatham 08074cc965 [clang,ARM] Initial ACLE intrinsics for MVE.
This commit sets up the infrastructure for auto-generating <arm_mve.h>
and doing clang-side code generation for the builtins it relies on,
and demonstrates that it works by implementing a representative sample
of the ACLE intrinsics, more or less matching the ones introduced in
LLVM IR by D67158,D68699,D68700.

Like NEON, that header file will provide a set of vector types like
uint16x8_t and C functions with names like vaddq_u32(). Unlike NEON,
the ACLE spec for <arm_mve.h> includes a polymorphism system, so that
you can write plain vaddq() and disambiguate by the vector types you
pass to it.

Unlike the corresponding NEON code, I've arranged to make every user-
facing ACLE intrinsic into a clang builtin, and implement all the code
generation inside clang. So <arm_mve.h> itself contains nothing but
typedefs and function declarations, with the latter all using the new
`__attribute__((__clang_builtin))` system to arrange that the user-
facing function names correspond to the right internal BuiltinIDs.

So the new MveEmitter tablegen system specifies the full sequence of
IRBuilder operations that each user-facing ACLE intrinsic should
translate into. Where possible, the ACLE intrinsics map to standard IR
operations such as vector-typed `add` and `fadd`; where no standard
representation exists, I call down to the sample IR intrinsics
introduced in an earlier commit.

Doing it like this means that you get the polymorphism for free just
by using __attribute__((overloadable)): the clang overload resolution
decides which function declaration is the relevant one, and _then_ its
BuiltinID is looked up, so by the time we're doing code generation,
that's all been resolved by the standard system. It also means that
you get really nice error messages if the user passes the wrong
combination of types: clang will show the declarations from the header
file and explain why each one doesn't match.

(The obvious alternative approach would be to have wrapper functions
in <arm_mve.h> which pass their arguments to the underlying builtins.
But that doesn't work in the case where one of the arguments has to be
a constant integer: the wrapper function can't pass the constantness
through. So you'd have to do that case using a macro instead, and then
use C11 `_Generic` to handle the polymorphism. Then you have to add
horrible workarounds because `_Generic` requires even the untaken
branches to type-check successfully, and //then// if the user gets the
types wrong, the error message is totally unreadable!)

Reviewers: dmgreen, miyuki, ostannard

Subscribers: mgorny, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67161
2019-10-24 16:33:13 +01:00
..
AnalysisBasedWarnings.cpp New tautological warning for bitwise-or with non-zero constant always true. 2019-10-19 00:57:23 +00:00
CMakeLists.txt [Concepts] Concept Specialization Expressions 2019-10-15 15:24:26 +00:00
CodeCompleteConsumer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CoroutineStmtBuilder.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DeclSpec.cpp [c++20] P1143R2: Add support for the C++20 'constinit' keyword. 2019-09-04 20:30:37 +00:00
DelayedDiagnostic.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IdentifierResolver.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
JumpDiagnostics.cpp Re-check in clang support gun asm goto after fixing tests. 2019-06-03 15:57:25 +00:00
MultiplexExternalSemaSource.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
OpenCLBuiltins.td [OpenCL] Add image query builtin functions 2019-09-25 09:12:59 +00:00
ParsedAttr.cpp Move some definitions from Sema to Basic to fix shared libs build 2019-09-16 13:58:59 +00:00
Scope.cpp Un-revert "[coroutines][PR40978] Emit error for co_yield within catch block" 2019-03-25 00:53:10 +00:00
ScopeInfo.cpp PR42104: Support instantiations of lambdas that implicitly capture 2019-06-04 17:17:20 +00:00
Sema.cpp [Sema] Emit diagnostics for uncorrected delayed typos at the end of TU 2019-10-09 10:00:05 +00:00
SemaAccess.cpp Sema - silence static analyzer getAs<> null dereference warnings. NFCI. 2019-10-07 14:25:46 +00:00
SemaAttr.cpp Added support for "#pragma clang section relro=<name>" 2019-10-15 18:31:10 +00:00
SemaCast.cpp Sema: Create a no-op implicit cast for lvalue function conversions. 2019-10-19 00:34:54 +00:00
SemaChecking.cpp [clang,ARM] Initial ACLE intrinsics for MVE. 2019-10-24 16:33:13 +01:00
SemaCodeComplete.cpp [CodeComplete] Ensure object is the same in compareOverloads() 2019-10-04 08:10:27 +00:00
SemaConcept.cpp [Concept] Associated Constraints Infrastructure 2019-10-15 18:44:06 +00:00
SemaConsumer.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SemaCoroutine.cpp Sema - silence static analyzer getAs<> null dereference warnings. NFCI. 2019-10-07 14:25:46 +00:00
SemaCUDA.cpp [HIP] Add option -fgpu-allow-device-init 2019-10-22 16:06:20 -04:00
SemaCXXScopeSpec.cpp [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00
SemaDecl.cpp [c++2a] Allow comparison functions to be explicitly defaulted. 2019-10-22 18:16:17 -07:00
SemaDeclAttr.cpp [clang,ARM] Initial ACLE intrinsics for MVE. 2019-10-24 16:33:13 +01:00
SemaDeclCXX.cpp [c++2a] Allow comparison functions to be explicitly defaulted. 2019-10-22 18:16:17 -07:00
SemaDeclObjC.cpp SemaDeclObjC - silence static analyzer getAs<> null dereference warnings. NFCI. 2019-10-17 10:35:29 +00:00
SemaExceptionSpec.cpp SemaExceptionSpec - silence static analyzer getAs<> null dereference warnings. NFCI. 2019-10-21 18:28:31 +00:00
SemaExpr.cpp Add -Wbitwise-conditional-parentheses to warn on mixing '|' and '&' with "?:" 2019-10-19 01:47:49 +00:00
SemaExprCXX.cpp Sema: Create a no-op implicit cast for lvalue function conversions. 2019-10-19 00:34:54 +00:00
SemaExprMember.cpp Silence static analyzer getAs<RecordType> null dereference warnings. NFCI. 2019-10-03 11:22:48 +00:00
SemaExprObjC.cpp Properly handle instantiation-dependent array bounds. 2019-10-04 01:25:59 +00:00
SemaFixItUtils.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SemaInit.cpp Sema: Create a no-op implicit cast for lvalue function conversions. 2019-10-19 00:34:54 +00:00
SemaLambda.cpp Minor coding style fix. NFC. 2019-10-22 04:32:30 +00:00
SemaLookup.cpp PR43080: Do not build context-sensitive expressions during name classification. 2019-10-14 21:53:03 +00:00
SemaModule.cpp Support for DWARF-5 C++ language tags. 2019-09-24 00:38:49 +00:00
SemaObjCProperty.cpp [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr. 2019-09-13 17:39:31 +00:00
SemaOpenMP.cpp [OPENMP50]Add support for master taskloop simd. 2019-10-18 16:47:35 +00:00
SemaOverload.cpp Sema: Create a no-op implicit cast for lvalue function conversions. 2019-10-19 00:34:54 +00:00
SemaPseudoObject.cpp Split ActOnCallExpr into an ActOnCallExpr to be called by the parser, 2019-05-08 01:36:36 +00:00
SemaStmt.cpp [OPENMP50]Treat range-based for as canonical loop. 2019-10-07 18:54:57 +00:00
SemaStmtAsm.cpp Delay diagnosing asm constraints that require immediates until after inlining 2019-08-06 22:41:22 +00:00
SemaStmtAttr.cpp [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr. 2019-09-13 17:39:31 +00:00
SemaTemplate.cpp [c++20] Add rewriting from comparison operators to <=> / ==. 2019-10-19 00:04:43 +00:00
SemaTemplateDeduction.cpp SemaTemplateDeduction - silence static analyzer getAs<> null dereference warnings. NFCI. 2019-10-21 19:08:31 +00:00
SemaTemplateInstantiate.cpp [c++20] Add rewriting from comparison operators to <=> / ==. 2019-10-19 00:04:43 +00:00
SemaTemplateInstantiateDecl.cpp [c++2a] Allow comparison functions to be explicitly defaulted. 2019-10-22 18:16:17 -07:00
SemaTemplateVariadic.cpp PR42587: diagnose unexpanded uses of a pack parameter of a generic 2019-08-26 22:51:28 +00:00
SemaType.cpp [clang,ARM] Initial ACLE intrinsics for MVE. 2019-10-24 16:33:13 +01:00
TreeTransform.h [hip][cuda] Fix the extended lambda name mangling issue. 2019-10-19 00:15:19 +00:00
TypeLocBuilder.cpp [NFC] avoid AlignedCharArray in clang 2019-07-29 23:12:48 +00:00
TypeLocBuilder.h [NFC] avoid AlignedCharArray in clang 2019-07-29 23:12:48 +00:00