clang  14.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 
16 #include "clang/Basic/TargetInfo.h"
18 #include "llvm/ADT/Triple.h"
19 #include "llvm/Support/Compiler.h"
20 
21 namespace clang {
22 namespace targets {
23 
24 class LLVM_LIBRARY_VISIBILITY XCoreTargetInfo : public TargetInfo {
25  static const Builtin::Info BuiltinInfo[];
26 
27 public:
28  XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
29  : TargetInfo(Triple) {
30  NoAsmVariants = true;
31  LongLongAlign = 32;
32  SuitableAlign = 32;
33  DoubleAlign = LongDoubleAlign = 32;
34  SizeType = UnsignedInt;
35  PtrDiffType = SignedInt;
36  IntPtrType = SignedInt;
37  WCharType = UnsignedChar;
38  WIntType = UnsignedInt;
39  UseZeroLengthBitfieldAlignment = true;
40  resetDataLayout("e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:32"
41  "-f64:32-a:0:32-n32");
42  }
43 
44  void getTargetDefines(const LangOptions &Opts,
45  MacroBuilder &Builder) const override;
46 
47  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
48 
51  }
52 
53  const char *getClobbers() const override { return ""; }
54 
56  static const char *const GCCRegNames[] = {
57  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
58  "r8", "r9", "r10", "r11", "cp", "dp", "sp", "lr"
59  };
60  return llvm::makeArrayRef(GCCRegNames);
61  }
62 
64  return None;
65  }
66 
67  bool validateAsmConstraint(const char *&Name,
68  TargetInfo::ConstraintInfo &Info) const override {
69  return false;
70  }
71 
72  int getEHDataRegisterNumber(unsigned RegNo) const override {
73  // R0=ExceptionPointerRegister R1=ExceptionSelectorRegister
74  return (RegNo < 2) ? RegNo : -1;
75  }
76 
77  bool allowsLargerPreferedTypeAlignment() const override { return false; }
78 
79  bool hasExtIntType() const override { return true; }
80 };
81 } // namespace targets
82 } // namespace clang
83 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_XCORE_H
clang::targets::XCoreTargetInfo::getGCCRegAliases
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: XCore.h:63
TargetInfo.h
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:189
clang::TargetInfo::VoidPtrBuiltinVaList
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition: TargetInfo.h:270
clang::targets::XCoreTargetInfo::hasExtIntType
bool hasExtIntType() const override
Determine whether the _ExtInt type is supported on this target.
Definition: XCore.h:79
clang::TargetInfo::BuiltinVaListKind
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:265
BuiltinInfo
static const Builtin::Info BuiltinInfo[]
Definition: Builtins.cpp:20
clang::targets::XCoreTargetInfo::allowsLargerPreferedTypeAlignment
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition: XCore.h:77
clang::targets::GCCRegNames
static const char *const GCCRegNames[]
Definition: X86.cpp:43
clang::targets::XCoreTargetInfo::XCoreTargetInfo
XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: XCore.h:28
TargetOptions.h
llvm::ArrayRef
Definition: LLVM.h:34
clang::TargetInfo::ConstraintInfo
Definition: TargetInfo.h:960
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:58
clang::targets::XCoreTargetInfo::validateAsmConstraint
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: XCore.h:67
clang
Definition: CalledOnceCheck.h:17
clang::targets::XCoreTargetInfo::getGCCRegNames
ArrayRef< const char * > getGCCRegNames() const override
Definition: XCore.h:55
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:72
clang::Builtin::Info
Definition: Builtins.h:55
clang::targets::XCoreTargetInfo::getClobbers
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: XCore.h:53
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
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:49
clang::targets::XCoreTargetInfo
Definition: XCore.h:24
clang::MacroBuilder
Definition: MacroBuilder.h:23