1 | //===--- VE.cpp - Implement VE target feature support ---------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // This file implements VE TargetInfo objects. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #include "VE.h" |
14 | #include "clang/Basic/Builtins.h" |
15 | #include "clang/Basic/MacroBuilder.h" |
16 | #include "clang/Basic/TargetBuiltins.h" |
17 | |
18 | using namespace clang; |
19 | using namespace clang::targets; |
20 | |
21 | static constexpr int NumBuiltins = |
22 | clang::VE::LastTSBuiltin - Builtin::FirstTSBuiltin; |
23 | |
24 | static constexpr llvm::StringTable BuiltinStrings = |
25 | CLANG_BUILTIN_STR_TABLE_START |
26 | #define BUILTIN CLANG_BUILTIN_STR_TABLE |
27 | #include "clang/Basic/BuiltinsVE.def" |
28 | ; |
29 | |
30 | static constexpr auto BuiltinInfos = Builtin::MakeInfos<NumBuiltins>(Infos: { |
31 | #define BUILTIN CLANG_BUILTIN_ENTRY |
32 | #include "clang/Basic/BuiltinsVE.def" |
33 | }); |
34 | |
35 | void VETargetInfo::getTargetDefines(const LangOptions &Opts, |
36 | MacroBuilder &Builder) const { |
37 | Builder.defineMacro(Name: "__ve" , Value: "1" ); |
38 | Builder.defineMacro(Name: "__ve__" , Value: "1" ); |
39 | Builder.defineMacro(Name: "__NEC__" , Value: "1" ); |
40 | // FIXME: define __FAST_MATH__ 1 if -ffast-math is enabled |
41 | // FIXME: define __OPTIMIZE__ n if -On is enabled |
42 | // FIXME: define __VECTOR__ n 1 if automatic vectorization is enabled |
43 | |
44 | Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1" ); |
45 | Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2" ); |
46 | Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4" ); |
47 | Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8" ); |
48 | } |
49 | |
50 | llvm::SmallVector<Builtin::InfosShard> VETargetInfo::getTargetBuiltins() const { |
51 | return {{&BuiltinStrings, BuiltinInfos}}; |
52 | } |
53 | |