Coverage Report

Created: 2021-08-24 07:12

/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/TargetParser.h"
19
20
namespace clang {
21
namespace targets {
22
23
class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
24
  virtual void setDataLayout() = 0;
25
  static const TargetInfo::GCCRegAlias GCCRegAliases[];
26
  static const char *const GCCRegNames[];
27
28
  enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) };
29
30
  unsigned FPU;
31
  bool HasCRC;
32
  bool HasCrypto;
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
57
  llvm::AArch64::ArchKind ArchKind;
58
59
  static const Builtin::Info BuiltinInfo[];
60
61
  std::string ABI;
62
63
public:
64
  AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
65
66
  StringRef getABI() const override;
67
  bool setABI(const std::string &Name) override;
68
69
  bool validateBranchProtection(StringRef, BranchProtectionInfo &,
70
                                StringRef &) const override;
71
72
  bool isValidCPUName(StringRef Name) const override;
73
  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
74
  bool setCPU(const std::string &Name) override;
75
76
66.2k
  bool useFP16ConversionIntrinsics() const override {
77
66.2k
    return false;
78
66.2k
  }
79
80
  void getTargetDefinesARMV81A(const LangOptions &Opts,
81
                               MacroBuilder &Builder) const;
82
  void getTargetDefinesARMV82A(const LangOptions &Opts,
83
                               MacroBuilder &Builder) const;
84
  void getTargetDefinesARMV83A(const LangOptions &Opts,
85
                               MacroBuilder &Builder) const;
86
  void getTargetDefinesARMV84A(const LangOptions &Opts,
87
                               MacroBuilder &Builder) const;
88
  void getTargetDefinesARMV85A(const LangOptions &Opts,
89
                               MacroBuilder &Builder) const;
90
  void getTargetDefinesARMV86A(const LangOptions &Opts,
91
                               MacroBuilder &Builder) const;
92
  void getTargetDefinesARMV87A(const LangOptions &Opts,
93
                               MacroBuilder &Builder) const;
94
  void getTargetDefines(const LangOptions &Opts,
95
                        MacroBuilder &Builder) const override;
96
97
  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
98
99
  Optional<std::pair<unsigned, unsigned>>
100
  getVScaleRange(const LangOptions &LangOpts) const override;
101
102
  bool hasFeature(StringRef Feature) const override;
103
  bool handleTargetFeatures(std::vector<std::string> &Features,
104
                            DiagnosticsEngine &Diags) override;
105
106
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
107
108
  bool isCLZForZeroUndef() const override;
109
110
  BuiltinVaListKind getBuiltinVaListKind() const override;
111
112
  ArrayRef<const char *> getGCCRegNames() const override;
113
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
114
115
196
  std::string convertConstraint(const char *&Constraint) const override {
116
196
    std::string R;
117
196
    switch (*Constraint) {
118
16
    case 'U': // Three-character constraint; add "@3" hint for later parsing.
119
16
      R = std::string("@3") + std::string(Constraint, 3);
120
16
      Constraint += 2;
121
16
      break;
122
180
    default:
123
180
      R = TargetInfo::convertConstraint(Constraint);
124
180
      break;
125
196
    }
126
196
    return R;
127
196
  }
128
129
  bool validateAsmConstraint(const char *&Name,
130
                             TargetInfo::ConstraintInfo &Info) const override;
131
  bool
132
  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
133
                             std::string &SuggestedModifier) const override;
134
  const char *getClobbers() const override;
135
136
  StringRef getConstraintRegister(StringRef Constraint,
137
231
                                  StringRef Expression) const override {
138
231
    return Expression;
139
231
  }
140
141
  int getEHDataRegisterNumber(unsigned RegNo) const override;
142
143
101
  const char *getBFloat16Mangling() const override { return "u6__bf16"; };
144
  bool hasInt128Type() const override;
145
146
63
  bool hasExtIntType() const override { return true; }
147
};
148
149
class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {
150
public:
151
  AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
152
153
  void getTargetDefines(const LangOptions &Opts,
154
                            MacroBuilder &Builder) const override;
155
private:
156
  void setDataLayout() override;
157
};
158
159
class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo
160
    : public WindowsTargetInfo<AArch64leTargetInfo> {
161
  const llvm::Triple Triple;
162
163
public:
164
  WindowsARM64TargetInfo(const llvm::Triple &Triple,
165
                         const TargetOptions &Opts);
166
167
  void setDataLayout() override;
168
169
  BuiltinVaListKind getBuiltinVaListKind() const override;
170
171
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
172
};
173
174
// Windows ARM, MS (C++) ABI
175
class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo
176
    : public WindowsARM64TargetInfo {
177
public:
178
  MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
179
                           const TargetOptions &Opts);
180
181
  void getTargetDefines(const LangOptions &Opts,
182
                        MacroBuilder &Builder) const override;
183
  TargetInfo::CallingConvKind
184
  getCallingConvKind(bool ClangABICompat4) const override;
185
186
  unsigned getMinGlobalAlign(uint64_t TypeSize) const override;
187
};
188
189
// ARM64 MinGW target
190
class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
191
    : public WindowsARM64TargetInfo {
192
public:
193
  MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
194
};
195
196
class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
197
public:
198
  AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
199
  void getTargetDefines(const LangOptions &Opts,
200
                        MacroBuilder &Builder) const override;
201
202
private:
203
  void setDataLayout() override;
204
};
205
206
class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
207
    : public DarwinTargetInfo<AArch64leTargetInfo> {
208
public:
209
  DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
210
211
  BuiltinVaListKind getBuiltinVaListKind() const override;
212
213
 protected:
214
  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
215
                    MacroBuilder &Builder) const override;
216
};
217
218
// 64-bit RenderScript is aarch64
219
class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
220
    : public AArch64leTargetInfo {
221
public:
222
  RenderScript64TargetInfo(const llvm::Triple &Triple,
223
                           const TargetOptions &Opts);
224
225
  void getTargetDefines(const LangOptions &Opts,
226
                        MacroBuilder &Builder) const override;
227
};
228
229
} // namespace targets
230
} // namespace clang
231
232
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H