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