1 //===--- XCore.cpp - Implement XCore 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 XCore TargetInfo objects.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "XCore.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 Builtin::Info BuiltinInfo[] = {
22 #define BUILTIN(ID, TYPE, ATTRS) \
23 {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES},
24 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \
25 {#ID, TYPE, ATTRS, nullptr, HeaderDesc::HEADER, ALL_LANGUAGES},
26 #include "clang/Basic/BuiltinsXCore.def"
27 };
28
getTargetDefines(const LangOptions & Opts,MacroBuilder & Builder) const29 void XCoreTargetInfo::getTargetDefines(const LangOptions &Opts,
30 MacroBuilder &Builder) const {
31 Builder.defineMacro("__xcore__");
32 Builder.defineMacro("__XS1B__");
33 }
34
getTargetBuiltins() const35 ArrayRef<Builtin::Info> XCoreTargetInfo::getTargetBuiltins() const {
36 return llvm::ArrayRef(BuiltinInfo,
37 clang::XCore::LastTSBuiltin - Builtin::FirstTSBuiltin);
38 }
39