Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Basic/Targets/AArch64.h
Line
Count
Source
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
40
  llvm::AArch64::ArchKind ArchKind;
41
42
  static const Builtin::Info BuiltinInfo[];
43
44
  std::string ABI;
45
46
public:
47
  AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
48
49
  StringRef getABI() const override;
50
  bool setABI(const std::string &Name) override;
51
52
  bool validateBranchProtection(StringRef, BranchProtectionInfo &,
53
                                StringRef &) const override;
54
55
  bool isValidCPUName(StringRef Name) const override;
56
  void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override;
57
  bool setCPU(const std::string &Name) override;
58
59
31.4k
  bool useFP16ConversionIntrinsics() const override {
60
31.4k
    return false;
61
31.4k
  }
62
63
  void getTargetDefinesARMV81A(const LangOptions &Opts,
64
                               MacroBuilder &Builder) const;
65
  void getTargetDefinesARMV82A(const LangOptions &Opts,
66
                               MacroBuilder &Builder) const;
67
  void getTargetDefinesARMV83A(const LangOptions &Opts,
68
                               MacroBuilder &Builder) const;
69
  void getTargetDefinesARMV84A(const LangOptions &Opts,
70
                               MacroBuilder &Builder) const;
71
  void getTargetDefinesARMV85A(const LangOptions &Opts,
72
                               MacroBuilder &Builder) const;
73
  void getTargetDefines(const LangOptions &Opts,
74
                        MacroBuilder &Builder) const override;
75
76
  ArrayRef<Builtin::Info> getTargetBuiltins() const override;
77
78
  bool hasFeature(StringRef Feature) const override;
79
  bool handleTargetFeatures(std::vector<std::string> &Features,
80
                            DiagnosticsEngine &Diags) override;
81
82
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
83
84
  bool isCLZForZeroUndef() const override;
85
86
  BuiltinVaListKind getBuiltinVaListKind() const override;
87
88
  ArrayRef<const char *> getGCCRegNames() const override;
89
  ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
90
  bool validateAsmConstraint(const char *&Name,
91
                             TargetInfo::ConstraintInfo &Info) const override;
92
  bool
93
  validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size,
94
                             std::string &SuggestedModifier) const override;
95
  const char *getClobbers() const override;
96
97
  StringRef getConstraintRegister(StringRef Constraint,
98
61
                                  StringRef Expression) const override {
99
61
    return Expression;
100
61
  }
101
102
  int getEHDataRegisterNumber(unsigned RegNo) const override;
103
104
  bool hasInt128Type() const override;
105
};
106
107
class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo {
108
public:
109
  AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
110
111
  void getTargetDefines(const LangOptions &Opts,
112
                            MacroBuilder &Builder) const override;
113
private:
114
  void setDataLayout() override;
115
};
116
117
class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo
118
    : public WindowsTargetInfo<AArch64leTargetInfo> {
119
  const llvm::Triple Triple;
120
121
public:
122
  WindowsARM64TargetInfo(const llvm::Triple &Triple,
123
                         const TargetOptions &Opts);
124
125
  void setDataLayout() override;
126
127
  BuiltinVaListKind getBuiltinVaListKind() const override;
128
129
  CallingConvCheckResult checkCallingConvention(CallingConv CC) const override;
130
};
131
132
// Windows ARM, MS (C++) ABI
133
class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo
134
    : public WindowsARM64TargetInfo {
135
public:
136
  MicrosoftARM64TargetInfo(const llvm::Triple &Triple,
137
                           const TargetOptions &Opts);
138
139
  void getTargetDefines(const LangOptions &Opts,
140
                        MacroBuilder &Builder) const override;
141
  TargetInfo::CallingConvKind
142
  getCallingConvKind(bool ClangABICompat4) const override;
143
144
  unsigned getMinGlobalAlign(uint64_t TypeSize) const override;
145
};
146
147
// ARM64 MinGW target
148
class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo
149
    : public WindowsARM64TargetInfo {
150
public:
151
  MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
152
};
153
154
class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo {
155
public:
156
  AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
157
  void getTargetDefines(const LangOptions &Opts,
158
                        MacroBuilder &Builder) const override;
159
160
private:
161
  void setDataLayout() override;
162
};
163
164
class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo
165
    : public DarwinTargetInfo<AArch64leTargetInfo> {
166
public:
167
  DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts);
168
169
  BuiltinVaListKind getBuiltinVaListKind() const override;
170
171
 protected:
172
  void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple,
173
                    MacroBuilder &Builder) const override;
174
};
175
176
// 64-bit RenderScript is aarch64
177
class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo
178
    : public AArch64leTargetInfo {
179
public:
180
  RenderScript64TargetInfo(const llvm::Triple &Triple,
181
                           const TargetOptions &Opts);
182
183
  void getTargetDefines(const LangOptions &Opts,
184
                        MacroBuilder &Builder) const override;
185
};
186
187
} // namespace targets
188
} // namespace clang
189
190
#endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H