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