clang  8.0.0svn
AArch64.h
Go to the documentation of this file.
1 //===--- AArch64.h - Declare AArch64 target feature support -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares AArch64 TargetInfo objects.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
15 #define LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
16 
17 #include "OSTargets.h"
19 #include "llvm/Support/TargetParser.h"
20 
21 namespace clang {
22 namespace targets {
23 
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[];
28 
29  enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) };
30 
31  unsigned FPU;
32  unsigned CRC;
33  unsigned Crypto;
34  unsigned Unaligned;
35  unsigned HasFullFP16;
36  unsigned HasDotProd;
37  unsigned HasFP16FML;
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 
134 // ARM64 MinGW target
135 class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
136  : public WindowsARM64TargetInfo {
137 public:
138  MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
139 };
140 
141 class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
142 public:
143  AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
144  void getTargetDefines(const LangOptions &Opts,
145  MacroBuilder &Builder) const override;
146 
147 private:
148  void setDataLayout() override;
149 };
150 
151 class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
152  : public DarwinTargetInfo<AArch64leTargetInfo> {
153 public:
154  DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
155 
156  BuiltinVaListKind getBuiltinVaListKind() const override;
157 
158  protected:
159  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
160  MacroBuilder &Builder) const override;
161 };
162 
163 // 64-bit RenderScript is aarch64
164 class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
165  : public AArch64leTargetInfo {
166 public:
167  RenderScript64TargetInfo(const llvm::Triple &Triple,
168  const TargetOptions &Opts);
169 
170  void getTargetDefines(const LangOptions &Opts,
171  MacroBuilder &Builder) const override;
172 };
173 
174 } // namespace targets
175 } // namespace clang
176 
177 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H
static const Builtin::Info BuiltinInfo[]
Definition: Builtins.cpp:21
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:107
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:50
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:54
static const char *const GCCRegNames[]
Definition: X86.cpp:44
Exposes information about the current target.
Definition: TargetInfo.h:54
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:236
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:102
Dataflow Directional Tag Classes.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:181