Coverage Report

Created: 2022-07-16 07:03

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