1//===--- XCore.h - Declare XCore target feature support ---------*- C++ -*-===//
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 declares XCore TargetInfo objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
15
16#include "clang/Basic/TargetInfo.h"
17#include "clang/Basic/TargetOptions.h"
18#include "llvm/Support/Compiler.h"
19#include "llvm/TargetParser/Triple.h"
20
21namespace clang {
22namespace targets {
23
24class LLVM_LIBRARY_VISIBILITY XCoreTargetInfo : public TargetInfo {
25
26public:
27 XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
28 : TargetInfo(Triple) {
29 NoAsmVariants = true;
30 LongLongAlign = 32;
31 SuitableAlign = 32;
32 DoubleAlign = LongDoubleAlign = 32;
33 SizeType = UnsignedInt;
34 PtrDiffType = SignedInt;
35 IntPtrType = SignedInt;
36 WCharType = UnsignedChar;
37 WIntType = UnsignedInt;
38 UseZeroLengthBitfieldAlignment = true;
39 resetDataLayout();
40 }
41
42 void getTargetDefines(const LangOptions &Opts,
43 MacroBuilder &Builder) const override;
44
45 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
46
47 BuiltinVaListKind getBuiltinVaListKind() const override {
48 return TargetInfo::VoidPtrBuiltinVaList;
49 }
50
51 std::string_view getClobbers() const override { return ""; }
52
53 ArrayRef<const char *> getGCCRegNames() const override {
54 static const char *const GCCRegNames[] = {
55 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
56 "r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
57 };
58 return llvm::ArrayRef(GCCRegNames);
59 }
60
61 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
62 return {};
63 }
64
65 bool validateAsmConstraint(const char *&Name,
66 TargetInfo::ConstraintInfo &Info) const override {
67 return false;
68 }
69
70 int getEHDataRegisterNumber(unsigned RegNo) const override {
71 // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
72 return (RegNo < 2) ? RegNo : -1;
73 }
74
75 bool allowsLargerPreferedTypeAlignment() const override { return false; }
76
77 bool hasBitIntType() const override { return true; }
78};
79} // namespace targets
80} // namespace clang
81#endif // LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
82