17 #include "llvm/ADT/ArrayRef.h" 18 #include "llvm/ADT/StringExtras.h" 20 using namespace clang;
24 #define BUILTIN(ID, TYPE, ATTRS) \ 25 {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr}, 26 #include "clang/Basic/BuiltinsNEON.def" 28 #define BUILTIN(ID, TYPE, ATTRS) \ 29 {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr}, 30 #define LANGBUILTIN(ID, TYPE, ATTRS, LANG) \ 31 {#ID, TYPE, ATTRS, nullptr, LANG, nullptr}, 32 #include "clang/Basic/BuiltinsAArch64.def" 38 if (
getTriple().getOS() == llvm::Triple::NetBSD ||
39 getTriple().getOS() == llvm::Triple::OpenBSD) {
78 if (Triple.getOS() == llvm::Triple::Linux)
80 else if (Triple.getOS() == llvm::Triple::UnknownOS)
82 Opts.
EABIVersion == llvm::EABI::GNU ?
"\01_mcount" :
"mcount";
88 if (Name !=
"aapcs" && Name !=
"darwinpcs")
96 return Name ==
"generic" ||
97 llvm::AArch64::parseCPUArch(Name) != llvm::AArch64::ArchKind::INVALID;
120 if (
getTriple().getOS() == llvm::Triple::UnknownOS &&
121 (
getTriple().getEnvironment() == llvm::Triple::EABI ||
122 getTriple().getEnvironment() == llvm::Triple::EABIHF))
145 Builder.
defineMacro(
"__ARM_FEATURE_NUMERIC_MAXMIN",
"1");
146 Builder.
defineMacro(
"__ARM_FEATURE_DIRECTED_ROUNDING",
"1");
148 Builder.
defineMacro(
"__ARM_ALIGN_MAX_STACK_PWR",
"4");
155 Builder.
defineMacro(
"__ARM_FP16_FORMAT_IEEE",
"1");
158 if (Opts.UnsafeFPMath)
162 Twine(Opts.WCharSize ? Opts.WCharSize : 4));
164 Builder.
defineMacro(
"__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ?
"1" :
"4");
166 if (FPU & NeonMode) {
182 Builder.
defineMacro(
"__ARM_FEATURE_UNALIGNED",
"1");
184 if ((FPU & NeonMode) && HasFullFP16)
185 Builder.
defineMacro(
"__ARM_FEATURE_FP16_VECTOR_ARITHMETIC",
"1");
190 case llvm::AArch64::ArchKind::ARMV8_1A:
193 case llvm::AArch64::ArchKind::ARMV8_2A:
199 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
200 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
201 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
202 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
211 return Feature ==
"aarch64" || Feature ==
"arm64" || Feature ==
"arm" ||
212 (Feature ==
"neon" && (FPU & NeonMode)) ||
213 (Feature ==
"sve" && (FPU & SveMode));
223 ArchKind = llvm::AArch64::ArchKind::ARMV8A;
225 for (
const auto &Feature : Features) {
226 if (Feature ==
"+neon")
228 if (Feature ==
"+sve")
230 if (Feature ==
"+crc")
232 if (Feature ==
"+crypto")
234 if (Feature ==
"+strict-align")
236 if (Feature ==
"+v8.1a")
237 ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
238 if (Feature ==
"+v8.2a")
239 ArchKind = llvm::AArch64::ArchKind::ARMV8_2A;
240 if (Feature ==
"+fullfp16")
270 const char *
const AArch64TargetInfo::GCCRegNames[] = {
272 "w0",
"w1",
"w2",
"w3",
"w4",
"w5",
"w6",
"w7",
"w8",
"w9",
"w10",
"w11",
273 "w12",
"w13",
"w14",
"w15",
"w16",
"w17",
"w18",
"w19",
"w20",
"w21",
"w22",
274 "w23",
"w24",
"w25",
"w26",
"w27",
"w28",
"w29",
"w30",
"wsp",
277 "x0",
"x1",
"x2",
"x3",
"x4",
"x5",
"x6",
"x7",
"x8",
"x9",
"x10",
"x11",
278 "x12",
"x13",
"x14",
"x15",
"x16",
"x17",
"x18",
"x19",
"x20",
"x21",
"x22",
279 "x23",
"x24",
"x25",
"x26",
"x27",
"x28",
"fp",
"lr",
"sp",
282 "s0",
"s1",
"s2",
"s3",
"s4",
"s5",
"s6",
"s7",
"s8",
"s9",
"s10",
"s11",
283 "s12",
"s13",
"s14",
"s15",
"s16",
"s17",
"s18",
"s19",
"s20",
"s21",
"s22",
284 "s23",
"s24",
"s25",
"s26",
"s27",
"s28",
"s29",
"s30",
"s31",
287 "d0",
"d1",
"d2",
"d3",
"d4",
"d5",
"d6",
"d7",
"d8",
"d9",
"d10",
"d11",
288 "d12",
"d13",
"d14",
"d15",
"d16",
"d17",
"d18",
"d19",
"d20",
"d21",
"d22",
289 "d23",
"d24",
"d25",
"d26",
"d27",
"d28",
"d29",
"d30",
"d31",
292 "v0",
"v1",
"v2",
"v3",
"v4",
"v5",
"v6",
"v7",
"v8",
"v9",
"v10",
"v11",
293 "v12",
"v13",
"v14",
"v15",
"v16",
"v17",
"v18",
"v19",
"v20",
"v21",
"v22",
294 "v23",
"v24",
"v25",
"v26",
"v27",
"v28",
"v29",
"v30",
"v31" 298 return llvm::makeArrayRef(GCCRegNames);
302 {{
"w31"},
"wsp"}, {{
"x29"},
"fp"}, {{
"x30"},
"lr"}, {{
"x31"},
"sp"},
308 return llvm::makeArrayRef(GCCRegAliases);
339 llvm_unreachable(
"FIXME: Unimplemented support for U* constraints.");
351 StringRef Constraint,
char Modifier,
unsigned Size,
352 std::string &SuggestedModifier)
const {
354 while (Constraint[0] ==
'=' || Constraint[0] ==
'+' || Constraint[0] ==
'&')
355 Constraint = Constraint.substr(1);
357 switch (Constraint[0]) {
374 SuggestedModifier =
"w";
395 void AArch64leTargetInfo::setDataLayout() {
399 resetDataLayout(
"e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
420 void AArch64beTargetInfo::setDataLayout() {
421 assert(!
getTriple().isOSBinFormatMachO());
422 resetDataLayout(
"E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
508 const llvm::Triple &Triple,
531 Triple.getEnvironmentName()),
The generic AArch64 ABI is also a modified version of the Itanium ABI, but it has fewer divergences t...
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
The iOS 64-bit ABI is follows ARM's published 64-bit ABI more closely, but we don't guarantee to foll...
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
unsigned short MaxVectorAlign
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
bool setABI(const std::string &Name) override
Use the specified ABI.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
unsigned char LongDoubleAlign
Options for controlling the target.
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, MacroBuilder &Builder) const override
unsigned char LongDoubleWidth
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
void getTargetDefinesARMV81A(const LangOptions &Opts, MacroBuilder &Builder) const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
unsigned char MaxAtomicPromoteWidth
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features (e.g., +sse4).
unsigned char PointerWidth
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
Concrete class used by the front-end to report problems and issues.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
VersionTuple PlatformMinVersion
void setDataLayout() override
bool setCPU(const std::string &Name) override
Target the specified CPU.
AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
unsigned HasBuiltinMSVaList
Exposes information about the current target.
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
void getVisualStudioDefines(const LangOptions &Opts, MacroBuilder &Builder) const
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
void resetDataLayout(StringRef DL)
void getVisualStudioDefines(const LangOptions &Opts, MacroBuilder &Builder) const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Enumerates target-specific builtins in their own namespaces within namespace clang.
DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
unsigned IsRenderScriptTarget
void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, const llvm::Triple &Triple, StringRef &PlatformName, VersionTuple &PlatformMinVersion)
unsigned char DoubleAlign
OpenMPLinearClauseKind Modifier
Modifier of 'linear' clause.
int getEHDataRegisterNumber(unsigned RegNo) const override
Return the register number that __builtin_eh_return_regno would return with the specified argument...
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
unsigned UseZeroLengthBitfieldAlignment
Whether zero length bitfields (e.g., int : 0;) force alignment of the next bitfield.
unsigned char PointerAlign
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
llvm::EABI EABIVersion
The EABI version to use.
unsigned char SuitableAlign
MicrosoftARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
StringRef getABI() const override
Get the ABI currently in use.
Dataflow Directional Tag Classes.
typedef char* __builtin_va_list;
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
unsigned UseSignedCharForObjCBool
Whether Objective-C's built-in boolean type should be signed char.
void getTargetDefinesARMV82A(const LangOptions &Opts, MacroBuilder &Builder) const
bool isValidCPUName(StringRef Name) const override
brief Determine whether this TargetInfo supports the given CPU name.
unsigned char LongLongAlign
AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
RenderScript64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
bool validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size, std::string &SuggestedModifier) const override
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
WindowsARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
Defines the clang::TargetInfo interface.
const llvm::fltSemantics * LongDoubleFormat
unsigned char MaxAtomicInlineWidth
ArrayRef< const char * > getGCCRegNames() const override
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
unsigned UseBitFieldTypeAlignment
Control whether the alignment of bit-field types is respected when laying out structures.
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
bool isCLZForZeroUndef() const override
The __builtin_clz* and __builtin_ctz* built-in functions are specified to have undefined results for ...