[docs] Fix build-docs.sh
[llvm-project.git] / clang / lib / Basic / Targets / AArch64.h
blobe28a4c5b6390501c7281c4772341bc1f93ea3ed6
1 //===--- AArch64.h - Declare AArch64 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 AArch64 TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
16 #include "OSTargets.h"
17 #include "clang/Basic/TargetBuiltins.h"
18 #include "llvm/Support/AArch64TargetParser.h"
19 #include "llvm/Support/TargetParser.h"
21 namespace clang {
22 namespace targets {
24 class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
25 virtual void setDataLayout() = 0;
26 static const TargetInfo::GCCRegAlias GCCRegAliases[];
27 static const char *const GCCRegNames[];
29 enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) };
31 unsigned FPU;
32 bool HasCRC;
33 bool HasAES;
34 bool HasSHA2;
35 bool HasSHA3;
36 bool HasSM4;
37 bool HasUnaligned;
38 bool HasFullFP16;
39 bool HasDotProd;
40 bool HasFP16FML;
41 bool HasMTE;
42 bool HasTME;
43 bool HasPAuth;
44 bool HasLS64;
45 bool HasRandGen;
46 bool HasMatMul;
47 bool HasSVE2;
48 bool HasSVE2AES;
49 bool HasSVE2SHA3;
50 bool HasSVE2SM4;
51 bool HasSVE2BitPerm;
52 bool HasMatmulFP64;
53 bool HasMatmulFP32;
54 bool HasLSE;
55 bool HasFlagM;
56 bool HasMOPS;
58 llvm::AArch64::ArchKind ArchKind;
60 static const Builtin::Info BuiltinInfo[];
62 std::string ABI;
63 StringRef getArchProfile() const;
65 public:
66 AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
68 StringRef getABI() const override;
69 bool setABI(const std::string &Name) override;
71 bool validateBranchProtection(StringRef Spec, StringRef Arch,
72 BranchProtectionInfo &BPI,
73 StringRef &Err) const override;
75 bool isValidCPUName(StringRef Name) const override;
76 void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
77 bool setCPU(const std::string &Name) override;
79 bool useFP16ConversionIntrinsics() const override {
80 return false;
83 void getTargetDefinesARMV81A(const LangOptions &Opts,
84 MacroBuilder &Builder) const;
85 void getTargetDefinesARMV82A(const LangOptions &Opts,
86 MacroBuilder &Builder) const;
87 void getTargetDefinesARMV83A(const LangOptions &Opts,
88 MacroBuilder &Builder) const;
89 void getTargetDefinesARMV84A(const LangOptions &Opts,
90 MacroBuilder &Builder) const;
91 void getTargetDefinesARMV85A(const LangOptions &Opts,
92 MacroBuilder &Builder) const;
93 void getTargetDefinesARMV86A(const LangOptions &Opts,
94 MacroBuilder &Builder) const;
95 void getTargetDefinesARMV87A(const LangOptions &Opts,
96 MacroBuilder &Builder) const;
97 void getTargetDefinesARMV88A(const LangOptions &Opts,
98 MacroBuilder &Builder) const;
99 void getTargetDefinesARMV9A(const LangOptions &Opts,
100 MacroBuilder &Builder) const;
101 void getTargetDefinesARMV91A(const LangOptions &Opts,
102 MacroBuilder &Builder) const;
103 void getTargetDefinesARMV92A(const LangOptions &Opts,
104 MacroBuilder &Builder) const;
105 void getTargetDefinesARMV93A(const LangOptions &Opts,
106 MacroBuilder &Builder) const;
107 void getTargetDefines(const LangOptions &Opts,
108 MacroBuilder &Builder) const override;
110 ArrayRef<Builtin::Info> getTargetBuiltins() const override;
112 Optional<std::pair<unsigned, unsigned>>
113 getVScaleRange(const LangOptions &LangOpts) const override;
115 bool hasFeature(StringRef Feature) const override;
116 bool handleTargetFeatures(std::vector<std::string> &Features,
117 DiagnosticsEngine &Diags) override;
119 bool hasBFloat16Type() const override;
121 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
123 bool isCLZForZeroUndef() const override;
125 BuiltinVaListKind getBuiltinVaListKind() const override;
127 ArrayRef<const char *> getGCCRegNames() const override;
128 ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
130 std::string convertConstraint(const char *&Constraint) const override {
131 std::string R;
132 switch (*Constraint) {
133 case 'U': // Three-character constraint; add "@3" hint for later parsing.
134 R = std::string("@3") + std::string(Constraint, 3);
135 Constraint += 2;
136 break;
137 default:
138 R = TargetInfo::convertConstraint(Constraint);
139 break;
141 return R;
144 bool validateAsmConstraint(const char *&Name,
145 TargetInfo::ConstraintInfo &Info) const override;
146 bool
147 validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
148 std::string &SuggestedModifier) const override;
149 const char *getClobbers() const override;
151 StringRef getConstraintRegister(StringRef Constraint,
152 StringRef Expression) const override {
153 return Expression;
156 int getEHDataRegisterNumber(unsigned RegNo) const override;
158 const char *getBFloat16Mangling() const override { return "u6__bf16"; };
159 bool hasInt128Type() const override;
161 bool hasBitIntType() const override { return true; }
164 class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {
165 public:
166 AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
168 void getTargetDefines(const LangOptions &Opts,
169 MacroBuilder &Builder) const override;
170 private:
171 void setDataLayout() override;
174 class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo
175 : public WindowsTargetInfo<AArch64leTargetInfo> {
176 const llvm::Triple Triple;
178 public:
179 WindowsARM64TargetInfo(const llvm::Triple &Triple,
180 const TargetOptions &Opts);
182 void setDataLayout() override;
184 BuiltinVaListKind getBuiltinVaListKind() const override;
186 CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
189 // Windows ARM, MS (C++) ABI
190 class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo
191 : public WindowsARM64TargetInfo {
192 public:
193 MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
194 const TargetOptions &Opts);
196 void getTargetDefines(const LangOptions &Opts,
197 MacroBuilder &Builder) const override;
198 TargetInfo::CallingConvKind
199 getCallingConvKind(bool ClangABICompat4) const override;
201 unsigned getMinGlobalAlign(uint64_t TypeSize) const override;
204 // ARM64 MinGW target
205 class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
206 : public WindowsARM64TargetInfo {
207 public:
208 MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
211 class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
212 public:
213 AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
214 void getTargetDefines(const LangOptions &Opts,
215 MacroBuilder &Builder) const override;
217 private:
218 void setDataLayout() override;
221 class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
222 : public DarwinTargetInfo<AArch64leTargetInfo> {
223 public:
224 DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
226 BuiltinVaListKind getBuiltinVaListKind() const override;
228 protected:
229 void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
230 MacroBuilder &Builder) const override;
233 // 64-bit RenderScript is aarch64
234 class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
235 : public AArch64leTargetInfo {
236 public:
237 RenderScript64TargetInfo(const llvm::Triple &Triple,
238 const TargetOptions &Opts);
240 void getTargetDefines(const LangOptions &Opts,
241 MacroBuilder &Builder) const override;
244 } // namespace targets
245 } // namespace clang
247 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H