Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/AArch64.h
Line
Count
Source (jump to first uncovered line)
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"
17
#include "clang/Basic/TargetBuiltins.h"
18
#include "llvm/Support/AArch64TargetParser.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
  bool HasCRC;
33
  bool HasCrypto;
34
  bool HasAES;
35
  bool HasSHA2;
36
  bool HasSHA3;
37
  bool HasSM4;
38
  bool HasUnaligned;
39
  bool HasFullFP16;
40
  bool HasDotProd;
41
  bool HasFP16FML;
42
  bool HasMTE;
43
  bool HasTME;
44
  bool HasPAuth;
45
  bool HasLS64;
46
  bool HasRandGen;
47
  bool HasMatMul;
48
  bool HasSVE2;
49
  bool HasSVE2AES;
50
  bool HasSVE2SHA3;
51
  bool HasSVE2SM4;
52
  bool HasSVE2BitPerm;
53
  bool HasMatmulFP64;
54
  bool HasMatmulFP32;
55
  bool HasLSE;
56
  bool HasFlagM;
57
  bool HasHBC;
58
  bool HasMOPS;
59
60
  llvm::AArch64::ArchKind ArchKind;
61
62
  static const Builtin::Info BuiltinInfo[];
63
64
  std::string ABI;
65
  StringRef getArchProfile() const;
66
67
public:
68
  AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
69
70
  StringRef getABI() const override;
71
  bool setABI(const std::string &Name) override;
72
73
  bool validateBranchProtection(StringRef, BranchProtectionInfo &,
74
                                StringRef &) const override;
75
76
  bool isValidCPUName(StringRef Name) const override;
77
  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
78
  bool setCPU(const std::string &Name) override;
79
80
72.6k
  bool useFP16ConversionIntrinsics() const override {
81
72.6k
    return false;
82
72.6k
  }
83
84
  void getTargetDefinesARMV81A(const LangOptions &Opts,
85
                               MacroBuilder &Builder) const;
86
  void getTargetDefinesARMV82A(const LangOptions &Opts,
87
                               MacroBuilder &Builder) const;
88
  void getTargetDefinesARMV83A(const LangOptions &Opts,
89
                               MacroBuilder &Builder) const;
90
  void getTargetDefinesARMV84A(const LangOptions &Opts,
91
                               MacroBuilder &Builder) const;
92
  void getTargetDefinesARMV85A(const LangOptions &Opts,
93
                               MacroBuilder &Builder) const;
94
  void getTargetDefinesARMV86A(const LangOptions &Opts,
95
                               MacroBuilder &Builder) const;
96
  void getTargetDefinesARMV87A(const LangOptions &Opts,
97
                               MacroBuilder &Builder) const;
98
  void getTargetDefinesARMV88A(const LangOptions &Opts,
99
                               MacroBuilder &Builder) const;
100
  void getTargetDefinesARMV9A(const LangOptions &Opts,
101
                              MacroBuilder &Builder) const;
102
  void getTargetDefinesARMV91A(const LangOptions &Opts,
103
                               MacroBuilder &Builder) const;
104
  void getTargetDefinesARMV92A(const LangOptions &Opts,
105
                               MacroBuilder &Builder) const;
106
  void getTargetDefinesARMV93A(const LangOptions &Opts,
107
                               MacroBuilder &Builder) const;
108
  void getTargetDefines(const LangOptions &Opts,
109
                        MacroBuilder &Builder) const override;
110
111
  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
112
113
  Optional<std::pair<unsigned, unsigned>>
114
  getVScaleRange(const LangOptions &LangOpts) const override;
115
116
  bool hasFeature(StringRef Feature) const override;
117
  bool handleTargetFeatures(std::vector<std::string> &Features,
118
                            DiagnosticsEngine &Diags) override;
119
120
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
121
122
  bool isCLZForZeroUndef() const override;
123
124
  BuiltinVaListKind getBuiltinVaListKind() const override;
125
126
  ArrayRef<const char *> getGCCRegNames() const override;
127
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
128
129
196
  std::string convertConstraint(const char *&Constraint) const override {
130
196
    std::string R;
131
196
    switch (*Constraint) {
132
16
    case 'U': // Three-character constraint; add "@3" hint for later parsing.
133
16
      R = std::string("@3") + std::string(Constraint, 3);
134
16
      Constraint += 2;
135
16
      break;
136
180
    default:
137
180
      R = TargetInfo::convertConstraint(Constraint);
138
180
      break;
139
196
    }
140
196
    return R;
141
196
  }
142
143
  bool validateAsmConstraint(const char *&Name,
144
                             TargetInfo::ConstraintInfo &Info) const override;
145
  bool
146
  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
147
                             std::string &SuggestedModifier) const override;
148
  const char *getClobbers() const override;
149
150
  StringRef getConstraintRegister(StringRef Constraint,
151
231
                                  StringRef Expression) const override {
152
231
    return Expression;
153
231
  }
154
155
  int getEHDataRegisterNumber(unsigned RegNo) const override;
156
157
125
  const char *getBFloat16Mangling() const override { return "u6__bf16"; };
158
  bool hasInt128Type() const override;
159
160
66
  bool hasBitIntType() const override { return true; }
161
};
162
163
class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {
164
public:
165
  AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
166
167
  void getTargetDefines(const LangOptions &Opts,
168
                            MacroBuilder &Builder) const override;
169
private:
170
  void setDataLayout() override;
171
};
172
173
class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo
174
    : public WindowsTargetInfo<AArch64leTargetInfo> {
175
  const llvm::Triple Triple;
176
177
public:
178
  WindowsARM64TargetInfo(const llvm::Triple &Triple,
179
                         const TargetOptions &Opts);
180
181
  void setDataLayout() override;
182
183
  BuiltinVaListKind getBuiltinVaListKind() const override;
184
185
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
186
};
187
188
// Windows ARM, MS (C++) ABI
189
class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo
190
    : public WindowsARM64TargetInfo {
191
public:
192
  MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
193
                           const TargetOptions &Opts);
194
195
  void getTargetDefines(const LangOptions &Opts,
196
                        MacroBuilder &Builder) const override;
197
  TargetInfo::CallingConvKind
198
  getCallingConvKind(bool ClangABICompat4) const override;
199
200
  unsigned getMinGlobalAlign(uint64_t TypeSize) const override;
201
};
202
203
// ARM64 MinGW target
204
class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
205
    : public WindowsARM64TargetInfo {
206
public:
207
  MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
208
};
209
210
class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
211
public:
212
  AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
213
  void getTargetDefines(const LangOptions &Opts,
214
                        MacroBuilder &Builder) const override;
215
216
private:
217
  void setDataLayout() override;
218
};
219
220
class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
221
    : public DarwinTargetInfo<AArch64leTargetInfo> {
222
public:
223
  DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
224
225
  BuiltinVaListKind getBuiltinVaListKind() const override;
226
227
 protected:
228
  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
229
                    MacroBuilder &Builder) const override;
230
};
231
232
// 64-bit RenderScript is aarch64
233
class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
234
    : public AArch64leTargetInfo {
235
public:
236
  RenderScript64TargetInfo(const llvm::Triple &Triple,
237
                           const TargetOptions &Opts);
238
239
  void getTargetDefines(const LangOptions &Opts,
240
                        MacroBuilder &Builder) const override;
241
};
242
243
} // namespace targets
244
} // namespace clang
245
246
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H