clang  14.0.0git
VE.h
Go to the documentation of this file.
1 //===--- VE.h - Declare VE 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 VE TargetInfo objects.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_VE_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_VE_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 VETargetInfo : public TargetInfo {
25  static const Builtin::Info BuiltinInfo[];
26 
27 public:
28  VETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
29  : TargetInfo(Triple) {
30  NoAsmVariants = true;
31  LongDoubleWidth = 128;
32  LongDoubleAlign = 128;
33  LongDoubleFormat = &llvm::APFloat::IEEEquad();
34  DoubleAlign = LongLongAlign = 64;
35  SuitableAlign = 64;
36  LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
37  SizeType = UnsignedLong;
38  PtrDiffType = SignedLong;
39  IntPtrType = SignedLong;
40  IntMaxType = SignedLong;
41  Int64Type = SignedLong;
42  RegParmMax = 8;
43  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
44 
45  WCharType = UnsignedInt;
46  WIntType = UnsignedInt;
47  UseZeroLengthBitfieldAlignment = true;
48  resetDataLayout(
49  "e-m:e-i64:64-n32:64-S128-v64:64:64-v128:64:64-v256:64:64-v512:64:64-"
50  "v1024:64:64-v2048:64:64-v4096:64:64-v8192:64:64-v16384:64:64");
51  }
52 
53  void getTargetDefines(const LangOptions &Opts,
54  MacroBuilder &Builder) const override;
55 
56  bool hasSjLjLowering() const override { return true; }
57 
58  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
59 
62  }
63 
65  switch (CC) {
66  default:
67  return CCCR_Warning;
68  case CC_C:
69  return CCCR_OK;
70  }
71  }
72 
73  const char *getClobbers() const override { return ""; }
74 
76  static const char *const GCCRegNames[] = {
77  // Regular registers
78  "sx0", "sx1", "sx2", "sx3", "sx4", "sx5", "sx6", "sx7",
79  "sx8", "sx9", "sx10", "sx11", "sx12", "sx13", "sx14", "sx15",
80  "sx16", "sx17", "sx18", "sx19", "sx20", "sx21", "sx22", "sx23",
81  "sx24", "sx25", "sx26", "sx27", "sx28", "sx29", "sx30", "sx31",
82  "sx32", "sx33", "sx34", "sx35", "sx36", "sx37", "sx38", "sx39",
83  "sx40", "sx41", "sx42", "sx43", "sx44", "sx45", "sx46", "sx47",
84  "sx48", "sx49", "sx50", "sx51", "sx52", "sx53", "sx54", "sx55",
85  "sx56", "sx57", "sx58", "sx59", "sx60", "sx61", "sx62", "sx63",
86  };
87  return llvm::makeArrayRef(GCCRegNames);
88  }
89 
91  static const TargetInfo::GCCRegAlias GCCRegAliases[] = {
92  {{"s0"}, "sx0"},
93  {{"s1"}, "sx1"},
94  {{"s2"}, "sx2"},
95  {{"s3"}, "sx3"},
96  {{"s4"}, "sx4"},
97  {{"s5"}, "sx5"},
98  {{"s6"}, "sx6"},
99  {{"s7"}, "sx7"},
100  {{"s8", "sl"}, "sx8"},
101  {{"s9", "fp"}, "sx9"},
102  {{"s10", "lr"}, "sx10"},
103  {{"s11", "sp"}, "sx11"},
104  {{"s12", "outer"}, "sx12"},
105  {{"s13"}, "sx13"},
106  {{"s14", "tp"}, "sx14"},
107  {{"s15", "got"}, "sx15"},
108  {{"s16", "plt"}, "sx16"},
109  {{"s17", "info"}, "sx17"},
110  {{"s18"}, "sx18"},
111  {{"s19"}, "sx19"},
112  {{"s20"}, "sx20"},
113  {{"s21"}, "sx21"},
114  {{"s22"}, "sx22"},
115  {{"s23"}, "sx23"},
116  {{"s24"}, "sx24"},
117  {{"s25"}, "sx25"},
118  {{"s26"}, "sx26"},
119  {{"s27"}, "sx27"},
120  {{"s28"}, "sx28"},
121  {{"s29"}, "sx29"},
122  {{"s30"}, "sx30"},
123  {{"s31"}, "sx31"},
124  {{"s32"}, "sx32"},
125  {{"s33"}, "sx33"},
126  {{"s34"}, "sx34"},
127  {{"s35"}, "sx35"},
128  {{"s36"}, "sx36"},
129  {{"s37"}, "sx37"},
130  {{"s38"}, "sx38"},
131  {{"s39"}, "sx39"},
132  {{"s40"}, "sx40"},
133  {{"s41"}, "sx41"},
134  {{"s42"}, "sx42"},
135  {{"s43"}, "sx43"},
136  {{"s44"}, "sx44"},
137  {{"s45"}, "sx45"},
138  {{"s46"}, "sx46"},
139  {{"s47"}, "sx47"},
140  {{"s48"}, "sx48"},
141  {{"s49"}, "sx49"},
142  {{"s50"}, "sx50"},
143  {{"s51"}, "sx51"},
144  {{"s52"}, "sx52"},
145  {{"s53"}, "sx53"},
146  {{"s54"}, "sx54"},
147  {{"s55"}, "sx55"},
148  {{"s56"}, "sx56"},
149  {{"s57"}, "sx57"},
150  {{"s58"}, "sx58"},
151  {{"s59"}, "sx59"},
152  {{"s60"}, "sx60"},
153  {{"s61"}, "sx61"},
154  {{"s62"}, "sx62"},
155  {{"s63"}, "sx63"},
156  };
157  return llvm::makeArrayRef(GCCRegAliases);
158  }
159 
160  bool validateAsmConstraint(const char *&Name,
161  TargetInfo::ConstraintInfo &Info) const override {
162  switch (*Name) {
163  default:
164  return false;
165  case 'v':
166  Info.setAllowsRegister();
167  return true;
168  }
169  return false;
170  }
171 
172  bool allowsLargerPreferedTypeAlignment() const override { return false; }
173 };
174 } // namespace targets
175 } // namespace clang
176 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_VE_H
clang::targets::VETargetInfo::hasSjLjLowering
bool hasSjLjLowering() const override
Controls if __builtin_longjmp / __builtin_setjmp can be lowered to llvm.eh.sjlj.longjmp / llvm....
Definition: VE.h:56
TargetInfo.h
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:189
clang::targets::VETargetInfo
Definition: VE.h:24
clang::TargetInfo::VoidPtrBuiltinVaList
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition: TargetInfo.h:270
clang::TargetInfo::BuiltinVaListKind
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:265
clang::TargetInfo::ConstraintInfo::setAllowsRegister
void setAllowsRegister()
Definition: TargetInfo.h:1025
BuiltinInfo
static const Builtin::Info BuiltinInfo[]
Definition: Builtins.cpp:20
clang::targets::VETargetInfo::validateAsmConstraint
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Definition: VE.h:160
clang::targets::VETargetInfo::getGCCRegAliases
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: VE.h:90
clang::targets::GCCRegNames
static const char *const GCCRegNames[]
Definition: X86.cpp:43
clang::CallingConv
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:263
clang::targets::VETargetInfo::checkCallingConvention
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
Definition: VE.h:64
clang::TargetInfo::GCCRegAlias
Definition: TargetInfo.h:1142
clang::targets::VETargetInfo::getBuiltinVaListKind
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: VE.h:60
clang::targets::VETargetInfo::allowsLargerPreferedTypeAlignment
bool allowsLargerPreferedTypeAlignment() const override
Whether target allows to overalign ABI-specified preferred alignment.
Definition: VE.h:172
clang::CC_C
@ CC_C
Definition: Specifiers.h:264
clang::targets::VETargetInfo::getClobbers
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: VE.h:73
TargetOptions.h
llvm::ArrayRef
Definition: LLVM.h:34
clang::targets::VETargetInfo::VETargetInfo
VETargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: VE.h:28
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
Definition: CalledOnceCheck.h:17
clang::Builtin::Info
Definition: Builtins.h:55
clang::TargetOptions
Options for controlling the target.
Definition: TargetOptions.h:26
clang::targets::VETargetInfo::getGCCRegNames
ArrayRef< const char * > getGCCRegNames() const override
Definition: VE.h:75
clang::TargetInfo::CallingConvCheckResult
CallingConvCheckResult
Definition: TargetInfo.h:1459
clang::MacroBuilder
Definition: MacroBuilder.h:23