clang  10.0.0svn
AArch64.h
Go to the documentation of this file.
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.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
15 
16 #include "OSTargets.h"
18 #include "llvm/Support/TargetParser.h"
19 
20 namespace clang {
21 namespace targets {
22 
23 class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
24  virtual void setDataLayout() = 0;
25  static const TargetInfo::GCCRegAlias GCCRegAliases[];
26  static const char *const GCCRegNames[];
27 
28  enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) };
29 
30  unsigned FPU;
31  bool HasCRC;
32  bool HasCrypto;
33  bool HasUnaligned;
34  bool HasFullFP16;
35  bool HasDotProd;
36  bool HasFP16FML;
37  bool HasMTE;
38  bool HasTME;
39 
40  llvm::AArch64::ArchKind ArchKind;
41 
42  static const Builtin::Info BuiltinInfo[];
43 
44  std::string ABI;
45 
46 public:
47  AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
48 
49  StringRef getABI() const override;
50  bool setABI(const std::string &Name) override;
51 
52  bool isValidCPUName(StringRef Name) const override;
53  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
54  bool setCPU(const std::string &Name) override;
55 
56  bool useFP16ConversionIntrinsics() const override {
57  return false;
58  }
59 
60  void getTargetDefinesARMV81A(const LangOptions &Opts,
61  MacroBuilder &Builder) const;
62  void getTargetDefinesARMV82A(const LangOptions &Opts,
63  MacroBuilder &Builder) const;
64  void getTargetDefinesARMV83A(const LangOptions &Opts,
65  MacroBuilder &Builder) const;
66  void getTargetDefinesARMV84A(const LangOptions &Opts,
67  MacroBuilder &Builder) const;
68  void getTargetDefinesARMV85A(const LangOptions &Opts,
69  MacroBuilder &Builder) const;
70  void getTargetDefines(const LangOptions &Opts,
71  MacroBuilder &Builder) const override;
72 
73  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
74 
75  bool hasFeature(StringRef Feature) const override;
76  bool handleTargetFeatures(std::vector<std::string> &Features,
77  DiagnosticsEngine &Diags) override;
78 
79  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
80 
81  bool isCLZForZeroUndef() const override;
82 
83  BuiltinVaListKind getBuiltinVaListKind() const override;
84 
85  ArrayRef<const char *> getGCCRegNames() const override;
86  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
87  bool validateAsmConstraint(const char *&Name,
88  TargetInfo::ConstraintInfo &Info) const override;
89  bool
90  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
91  std::string &SuggestedModifier) const override;
92  const char *getClobbers() const override;
93 
94  StringRef getConstraintRegister(StringRef Constraint,
95  StringRef Expression) const override {
96  return Expression;
97  }
98 
99  int getEHDataRegisterNumber(unsigned RegNo) const override;
100 };
101 
102 class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {
103 public:
104  AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
105 
106  void getTargetDefines(const LangOptions &Opts,
107  MacroBuilder &Builder) const override;
108 private:
109  void setDataLayout() override;
110 };
111 
112 class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo
113  : public WindowsTargetInfo<AArch64leTargetInfo> {
114  const llvm::Triple Triple;
115 
116 public:
117  WindowsARM64TargetInfo(const llvm::Triple &Triple,
118  const TargetOptions &Opts);
119 
120  void setDataLayout() override;
121 
122  BuiltinVaListKind getBuiltinVaListKind() const override;
123 
124  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
125 };
126 
127 // Windows ARM, MS (C++) ABI
128 class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo
129  : public WindowsARM64TargetInfo {
130 public:
131  MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
132  const TargetOptions &Opts);
133 
134  void getTargetDefines(const LangOptions &Opts,
135  MacroBuilder &Builder) const override;
137  getCallingConvKind(bool ClangABICompat4) const override;
138 
139  unsigned getMinGlobalAlign(uint64_t TypeSize) const override;
140 };
141 
142 // ARM64 MinGW target
143 class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
144  : public WindowsARM64TargetInfo {
145 public:
146  MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
147 };
148 
149 class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
150 public:
151  AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
152  void getTargetDefines(const LangOptions &Opts,
153  MacroBuilder &Builder) const override;
154 
155 private:
156  void setDataLayout() override;
157 };
158 
159 class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
160  : public DarwinTargetInfo<AArch64leTargetInfo> {
161 public:
162  DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
163 
164  BuiltinVaListKind getBuiltinVaListKind() const override;
165 
166  protected:
167  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
168  MacroBuilder &Builder) const override;
169 };
170 
171 // 64-bit RenderScript is aarch64
172 class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
173  : public AArch64leTargetInfo {
174 public:
175  RenderScript64TargetInfo(const llvm::Triple &Triple,
176  const TargetOptions &Opts);
177 
178  void getTargetDefines(const LangOptions &Opts,
179  MacroBuilder &Builder) const override;
180 };
181 
182 } // namespace targets
183 } // namespace clang
184 
185 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
static const Builtin::Info BuiltinInfo[]
Definition: Builtins.cpp:20
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature...
Definition: Module.cpp:106
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:49
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:149
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Definition: AArch64.h:56
static const char *const GCCRegNames[]
Definition: X86.cpp:43
Exposes information about the current target.
Definition: TargetInfo.h:161
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:265
StringRef getConstraintRegister(StringRef Constraint, StringRef Expression) const override
Extracts a register from the passed constraint (if it is a single-register constraint) and the asm la...
Definition: AArch64.h:94
Enumerates target-specific builtins in their own namespaces within namespace clang.
OpenMPLinearClauseKind Modifier
Modifier of &#39;linear&#39; clause.
Definition: OpenMPClause.h:101
Dataflow Directional Tag Classes.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:225