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 
39  llvm::AArch64::ArchKind ArchKind;
40 
41  static const Builtin::Info BuiltinInfo[];
42 
43  std::string ABI;
44 
45 public:
46  AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
47 
48  StringRef getABI() const override;
49  bool setABI(const std::string &Name) override;
50 
51  bool isValidCPUName(StringRef Name) const override;
52  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
53  bool setCPU(const std::string &Name) override;
54 
55  bool useFP16ConversionIntrinsics() const override {
56  return false;
57  }
58 
59  void getTargetDefinesARMV81A(const LangOptions &Opts,
60  MacroBuilder &Builder) const;
61  void getTargetDefinesARMV82A(const LangOptions &Opts,
62  MacroBuilder &Builder) const;
63  void getTargetDefinesARMV83A(const LangOptions &Opts,
64  MacroBuilder &Builder) const;
65  void getTargetDefinesARMV84A(const LangOptions &Opts,
66  MacroBuilder &Builder) const;
67  void getTargetDefinesARMV85A(const LangOptions &Opts,
68  MacroBuilder &Builder) const;
69  void getTargetDefines(const LangOptions &Opts,
70  MacroBuilder &Builder) const override;
71 
72  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
73 
74  bool hasFeature(StringRef Feature) const override;
75  bool handleTargetFeatures(std::vector<std::string> &Features,
76  DiagnosticsEngine &Diags) override;
77 
78  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
79 
80  bool isCLZForZeroUndef() const override;
81 
82  BuiltinVaListKind getBuiltinVaListKind() const override;
83 
84  ArrayRef<const char *> getGCCRegNames() const override;
85  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
86  bool validateAsmConstraint(const char *&Name,
87  TargetInfo::ConstraintInfo &Info) const override;
88  bool
89  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
90  std::string &SuggestedModifier) const override;
91  const char *getClobbers() const override;
92 
93  StringRef getConstraintRegister(StringRef Constraint,
94  StringRef Expression) const override {
95  return Expression;
96  }
97 
98  int getEHDataRegisterNumber(unsigned RegNo) const override;
99 };
100 
101 class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {
102 public:
103  AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
104 
105  void getTargetDefines(const LangOptions &Opts,
106  MacroBuilder &Builder) const override;
107 private:
108  void setDataLayout() override;
109 };
110 
111 class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo
112  : public WindowsTargetInfo<AArch64leTargetInfo> {
113  const llvm::Triple Triple;
114 
115 public:
116  WindowsARM64TargetInfo(const llvm::Triple &Triple,
117  const TargetOptions &Opts);
118 
119  void setDataLayout() override;
120 
121  BuiltinVaListKind getBuiltinVaListKind() const override;
122 
123  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
124 };
125 
126 // Windows ARM, MS (C++) ABI
127 class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo
128  : public WindowsARM64TargetInfo {
129 public:
130  MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
131  const TargetOptions &Opts);
132 
133  void getTargetDefines(const LangOptions &Opts,
134  MacroBuilder &Builder) const override;
136  getCallingConvKind(bool ClangABICompat4) const override;
137 
138  unsigned getMinGlobalAlign(uint64_t TypeSize) const override;
139 };
140 
141 // ARM64 MinGW target
142 class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
143  : public WindowsARM64TargetInfo {
144 public:
145  MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
146 };
147 
148 class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
149 public:
150  AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
151  void getTargetDefines(const LangOptions &Opts,
152  MacroBuilder &Builder) const override;
153 
154 private:
155  void setDataLayout() override;
156 };
157 
158 class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
159  : public DarwinTargetInfo<AArch64leTargetInfo> {
160 public:
161  DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
162 
163  BuiltinVaListKind getBuiltinVaListKind() const override;
164 
165  protected:
166  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
167  MacroBuilder &Builder) const override;
168 };
169 
170 // 64-bit RenderScript is aarch64
171 class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
172  : public AArch64leTargetInfo {
173 public:
174  RenderScript64TargetInfo(const llvm::Triple &Triple,
175  const TargetOptions &Opts);
176 
177  void getTargetDefines(const LangOptions &Opts,
178  MacroBuilder &Builder) const override;
179 };
180 
181 } // namespace targets
182 } // namespace clang
183 
184 #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:55
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:264
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:93
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:223