Coverage Report

Created: 2020-09-22 08:39

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