clang  6.0.0svn
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"
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 
52  }
53 
54  const char *getClobbers() const override { return ""; }
55 
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 
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
static const Builtin::Info BuiltinInfo[]
Definition: Builtins.cpp:21
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: XCore.h:64
Options for controlling the target.
Definition: TargetOptions.h:26
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition: XCore.h:78
static const char *const GCCRegNames[]
Definition: X86.cpp:42
typedef void* __builtin_va_list;
Definition: TargetInfo.h:157
Exposes information about the current target.
Definition: TargetInfo.h:54
XCoreTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: XCore.h:29
Defines the clang::TargetOptions class.
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: XCore.h:68
Dataflow Directional Tag Classes.
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
ArrayRef< const char * > getGCCRegNames() const override
Definition: XCore.h:56
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: XCore.h:54
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:152
Defines the clang::TargetInfo interface.
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: XCore.h:50