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