clang 20.0.0git
XCore.h
Go to the documentation of this file.
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
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("e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32"
40 "-f64:32-a:0:32-n32");
41 }
42
43 void getTargetDefines(const LangOptions &Opts,
44 MacroBuilder &Builder) const override;
45
46 ArrayRef<Builtin::Info> getTargetBuiltins() const override;
47
49 return TargetInfo::VoidPtrBuiltinVaList;
50 }
51
52 std::string_view getClobbers() const override { return ""; }
53
55 static const char *const GCCRegNames[] = {
56 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
57 "r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
58 };
59 return llvm::ArrayRef(GCCRegNames);
60 }
61
63 return std::nullopt;
64 }
65
66 bool validateAsmConstraint(const char *&Name,
67 TargetInfo::ConstraintInfo &Info) const override {
68 return false;
69 }
70
71 int getEHDataRegisterNumber(unsigned RegNo) const override {
72 // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
73 return (RegNo < 2) ? RegNo : -1;
74 }
75
76 bool allowsLargerPreferedTypeAlignment() const override { return false; }
77
78 bool hasBitIntType() const override { return true; }
79};
80} // namespace targets
81} // namespace clang
82#endif // LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
Defines the clang::TargetOptions class.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:476
Exposes information about the current target.
Definition: TargetInfo.h:218
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:319
Options for controlling the target.
Definition: TargetOptions.h:26
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: XCore.h:52
ArrayRef< const char * > getGCCRegNames() const override
Definition: XCore.h:54
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: XCore.h:66
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: XCore.h:62
XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: XCore.h:27
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument.
Definition: XCore.h:71
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition: XCore.h:76
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
Definition: XCore.h:78
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: XCore.h:48
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.