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
18using namespace clang;
19using namespace clang::targets;
20
21static constexpr Builtin::Info BuiltinInfo[] = {
22#define BUILTIN(ID, TYPE, ATTRS) \
23 {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES},
24#include "clang/Basic/BuiltinsVE.def"
25};
26
27void VETargetInfo::getTargetDefines(const LangOptions &Opts,
28 MacroBuilder &Builder) const {
29 Builder.defineMacro(Name: "__ve", Value: "1");
30 Builder.defineMacro(Name: "__ve__", Value: "1");
31 Builder.defineMacro(Name: "__NEC__", Value: "1");
32 // FIXME: define __FAST_MATH__ 1 if -ffast-math is enabled
33 // FIXME: define __OPTIMIZE__ n if -On is enabled
34 // FIXME: define __VECTOR__ n 1 if automatic vectorization is enabled
35
36 Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
37 Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
38 Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
39 Builder.defineMacro(Name: "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
40}
41
42ArrayRef<Builtin::Info> VETargetInfo::getTargetBuiltins() const {
43 return llvm::ArrayRef(BuiltinInfo,
44 clang::VE::LastTSBuiltin - Builtin::FirstTSBuiltin);
45}
46