clang 8.0.0

XCore.h
Go to the documentation of this file.
1 //===--- XCore.h - Declare XCore target feature support ---------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares XCore TargetInfo objects.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
16
17 #include "clang/Basic/TargetInfo.h"
18 #include "clang/Basic/TargetOptions.h"
19 #include "llvm/ADT/Triple.h"
20 #include "llvm/Support/Compiler.h"
21
22 namespace clang {
23 namespace targets {
24
25 class LLVM_LIBRARY_VISIBILITY XCoreTargetInfo : public TargetInfo {
26 static const Builtin::Info BuiltinInfo[];
27
28 public:
29 XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
30 : TargetInfo(Triple) {
31 NoAsmVariants = true;
32 LongLongAlign = 32;
33 SuitableAlign = 32;
34 DoubleAlign = LongDoubleAlign = 32;
35 SizeType = UnsignedInt;
36 PtrDiffType = SignedInt;
37 IntPtrType = SignedInt;
38 WCharType = UnsignedChar;
39 WIntType = UnsignedInt;
40 UseZeroLengthBitfieldAlignment = true;
41 resetDataLayout("e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32"
42 "-f64:32-a:0:32-n32");
43 }
44
45 void getTargetDefines(const LangOptions &Opts,
46 MacroBuilder &Builder) const override;
47
48 ArrayRef<Builtin::Info> getTargetBuiltins() const override;
49
50 BuiltinVaListKind getBuiltinVaListKind() const override {
51 return TargetInfo::VoidPtrBuiltinVaList;
52 }
53
54 const char *getClobbers() const override { return ""; }
55
56 ArrayRef<const char *> getGCCRegNames() const override {
57 static const char *const GCCRegNames[] = {
58 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
59 "r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
60 };
61 return llvm::makeArrayRef(GCCRegNames);
62 }
63
64 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override {
65 return None;
66 }
67
68 bool validateAsmConstraint(const char *&Name,
69 TargetInfo::ConstraintInfo &Info) const override {
70 return false;
71 }
72
73 int getEHDataRegisterNumber(unsigned RegNo) const override {
74 // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
75 return (RegNo < 2) ? RegNo : -1;
76 }
77
78 bool allowsLargerPreferedTypeAlignment() const override { return false; }
79 };
80 } // namespace targets
81 } // namespace clang
82 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
BuiltinInfo
static const Builtin::Info BuiltinInfo[]
Definition: Builtins.cpp:21
clang::targets::XCoreTargetInfo::getGCCRegAliases
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: XCore.h:64
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:27
clang::Builtin::Info
Definition: Builtins.h:56
clang::targets::XCoreTargetInfo
Definition: XCore.h:25
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:50
clang::targets::XCoreTargetInfo::allowsLargerPreferedTypeAlignment
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition: XCore.h:78
llvm::ArrayRef
Definition: LLVM.h:32
clang::targets::GCCRegNames
static const char *const GCCRegNames[]
Definition: X86.cpp:44
clang::TargetInfo::VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition: TargetInfo.h:187
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:54
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:795
clang::targets::XCoreTargetInfo::XCoreTargetInfo
XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: XCore.h:29
TargetOptions.h
Defines the clang::TargetOptions class.
clang::targets::XCoreTargetInfo::validateAsmConstraint
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: XCore.h:68
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::targets::XCoreTargetInfo::getEHDataRegisterNumber
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument...
Definition: XCore.h:73
clang::targets::XCoreTargetInfo::getGCCRegNames
ArrayRef< const char * > getGCCRegNames() const override
Definition: XCore.h:56
clang::targets::XCoreTargetInfo::getClobbers
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: XCore.h:54
clang::MacroBuilder
Definition: MacroBuilder.h:24
clang::TargetInfo::BuiltinVaListKind
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:182
TargetInfo.h
Defines the clang::TargetInfo interface.
clang::targets::XCoreTargetInfo::getBuiltinVaListKind
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: XCore.h:50