Coverage Report

Created: 2021-01-26 06:56

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