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 #define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \ 33 {#ID, TYPE, ATTRS, HEADER, LANGS, FEATURE}, 34 #include "clang/Basic/BuiltinsAArch64.def" 79 if (Triple.getOS() == llvm::Triple::Linux)
81 else if (Triple.getOS() == llvm::Triple::UnknownOS)
83 Opts.
EABIVersion == llvm::EABI::GNU ?
"\01_mcount" :
"mcount";
89 if (Name !=
"aapcs" && Name !=
"darwinpcs")
97 return Name ==
"generic" ||
98 llvm::AArch64::parseCPUArch(Name) != llvm::AArch64::ArchKind::INVALID;
107 llvm::AArch64::fillValidCPUArchList(Values);
126 if (
getTriple().getOS() == llvm::Triple::UnknownOS &&
150 Builder.
defineMacro(
"__ARM_FEATURE_NUMERIC_MAXMIN",
"1");
151 Builder.
defineMacro(
"__ARM_FEATURE_DIRECTED_ROUNDING",
"1");
153 Builder.
defineMacro(
"__ARM_ALIGN_MAX_STACK_PWR",
"4");
160 Builder.
defineMacro(
"__ARM_FP16_FORMAT_IEEE",
"1");
163 if (Opts.UnsafeFPMath)
167 Twine(Opts.WCharSize ? Opts.WCharSize : 4));
169 Builder.
defineMacro(
"__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ?
"1" :
"4");
171 if (FPU & NeonMode) {
187 Builder.
defineMacro(
"__ARM_FEATURE_UNALIGNED",
"1");
189 if ((FPU & NeonMode) && HasFullFP16)
190 Builder.
defineMacro(
"__ARM_FEATURE_FP16_VECTOR_ARITHMETIC",
"1");
192 Builder.
defineMacro(
"__ARM_FEATURE_FP16_SCALAR_ARITHMETIC",
"1");
197 if ((FPU & NeonMode) && HasFP16FML)
203 case llvm::AArch64::ArchKind::ARMV8_1A:
206 case llvm::AArch64::ArchKind::ARMV8_2A:
212 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
213 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
214 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
215 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
224 return Feature ==
"aarch64" || Feature ==
"arm64" || Feature ==
"arm" ||
225 (Feature ==
"neon" && (FPU & NeonMode)) ||
226 (Feature ==
"sve" && (FPU & SveMode));
238 ArchKind = llvm::AArch64::ArchKind::ARMV8A;
240 for (
const auto &Feature : Features) {
241 if (Feature ==
"+neon")
243 if (Feature ==
"+sve")
245 if (Feature ==
"+crc")
247 if (Feature ==
"+crypto")
249 if (Feature ==
"+strict-align")
251 if (Feature ==
"+v8.1a")
252 ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
253 if (Feature ==
"+v8.2a")
254 ArchKind = llvm::AArch64::ArchKind::ARMV8_2A;
255 if (Feature ==
"+fullfp16")
257 if (Feature ==
"+dotprod")
259 if (Feature ==
"+fp16fml")
290 const char *
const AArch64TargetInfo::GCCRegNames[] = {
292 "w0",
"w1",
"w2",
"w3",
"w4",
"w5",
"w6",
"w7",
"w8",
"w9",
"w10",
"w11",
293 "w12",
"w13",
"w14",
"w15",
"w16",
"w17",
"w18",
"w19",
"w20",
"w21",
"w22",
294 "w23",
"w24",
"w25",
"w26",
"w27",
"w28",
"w29",
"w30",
"wsp",
297 "x0",
"x1",
"x2",
"x3",
"x4",
"x5",
"x6",
"x7",
"x8",
"x9",
"x10",
"x11",
298 "x12",
"x13",
"x14",
"x15",
"x16",
"x17",
"x18",
"x19",
"x20",
"x21",
"x22",
299 "x23",
"x24",
"x25",
"x26",
"x27",
"x28",
"fp",
"lr",
"sp",
302 "s0",
"s1",
"s2",
"s3",
"s4",
"s5",
"s6",
"s7",
"s8",
"s9",
"s10",
"s11",
303 "s12",
"s13",
"s14",
"s15",
"s16",
"s17",
"s18",
"s19",
"s20",
"s21",
"s22",
304 "s23",
"s24",
"s25",
"s26",
"s27",
"s28",
"s29",
"s30",
"s31",
307 "d0",
"d1",
"d2",
"d3",
"d4",
"d5",
"d6",
"d7",
"d8",
"d9",
"d10",
"d11",
308 "d12",
"d13",
"d14",
"d15",
"d16",
"d17",
"d18",
"d19",
"d20",
"d21",
"d22",
309 "d23",
"d24",
"d25",
"d26",
"d27",
"d28",
"d29",
"d30",
"d31",
312 "v0",
"v1",
"v2",
"v3",
"v4",
"v5",
"v6",
"v7",
"v8",
"v9",
"v10",
"v11",
313 "v12",
"v13",
"v14",
"v15",
"v16",
"v17",
"v18",
"v19",
"v20",
"v21",
"v22",
314 "v23",
"v24",
"v25",
"v26",
"v27",
"v28",
"v29",
"v30",
"v31" 318 return llvm::makeArrayRef(GCCRegNames);
354 {{
"r29",
"x29"},
"fp"},
355 {{
"r30",
"x30"},
"lr"},
361 return llvm::makeArrayRef(GCCRegAliases);
392 llvm_unreachable(
"FIXME: Unimplemented support for U* constraints.");
404 StringRef Constraint,
char Modifier,
unsigned Size,
405 std::string &SuggestedModifier)
const {
407 while (Constraint[0] ==
'=' || Constraint[0] ==
'+' || Constraint[0] ==
'&')
408 Constraint = Constraint.substr(1);
410 switch (Constraint[0]) {
427 SuggestedModifier =
"w";
448 void AArch64leTargetInfo::setDataLayout() {
452 resetDataLayout(
"e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
473 void AArch64beTargetInfo::setDataLayout() {
474 assert(!
getTriple().isOSBinFormatMachO());
475 resetDataLayout(
"E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
567 const llvm::Triple &Triple,
590 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...
TargetInfo::CallingConvKind getCallingConvKind(bool ClangABICompat4) const override
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 --------------------——===//
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
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 ...