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