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" 80 if (Triple.getOS() == llvm::Triple::Linux)
82 else if (Triple.getOS() == llvm::Triple::UnknownOS)
84 Opts.
EABIVersion == llvm::EABI::GNU ?
"\01_mcount" :
"mcount";
90 if (Name !=
"aapcs" && Name !=
"darwinpcs")
98 return Name ==
"generic" ||
99 llvm::AArch64::parseCPUArch(Name) != llvm::AArch64::ArchKind::INVALID;
108 llvm::AArch64::fillValidCPUArchList(Values);
127 if (
getTriple().getOS() == llvm::Triple::UnknownOS &&
151 Builder.
defineMacro(
"__ARM_FEATURE_NUMERIC_MAXMIN",
"1");
152 Builder.
defineMacro(
"__ARM_FEATURE_DIRECTED_ROUNDING",
"1");
154 Builder.
defineMacro(
"__ARM_ALIGN_MAX_STACK_PWR",
"4");
161 Builder.
defineMacro(
"__ARM_FP16_FORMAT_IEEE",
"1");
164 if (Opts.UnsafeFPMath)
168 Twine(Opts.WCharSize ? Opts.WCharSize : 4));
170 Builder.
defineMacro(
"__ARM_SIZEOF_MINIMAL_ENUM", Opts.ShortEnums ?
"1" :
"4");
172 if (FPU & NeonMode) {
188 Builder.
defineMacro(
"__ARM_FEATURE_UNALIGNED",
"1");
190 if ((FPU & NeonMode) && HasFullFP16)
191 Builder.
defineMacro(
"__ARM_FEATURE_FP16_VECTOR_ARITHMETIC",
"1");
193 Builder.
defineMacro(
"__ARM_FEATURE_FP16_SCALAR_ARITHMETIC",
"1");
198 if ((FPU & NeonMode) && HasFP16FML)
204 case llvm::AArch64::ArchKind::ARMV8_1A:
207 case llvm::AArch64::ArchKind::ARMV8_2A:
213 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
214 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
215 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
216 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
225 return Feature ==
"aarch64" || Feature ==
"arm64" || Feature ==
"arm" ||
226 (Feature ==
"neon" && (FPU & NeonMode)) ||
227 (Feature ==
"sve" && (FPU & SveMode));
239 ArchKind = llvm::AArch64::ArchKind::ARMV8A;
241 for (
const auto &Feature : Features) {
242 if (Feature ==
"+neon")
244 if (Feature ==
"+sve")
246 if (Feature ==
"+crc")
248 if (Feature ==
"+crypto")
250 if (Feature ==
"+strict-align")
252 if (Feature ==
"+v8.1a")
253 ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
254 if (Feature ==
"+v8.2a")
255 ArchKind = llvm::AArch64::ArchKind::ARMV8_2A;
256 if (Feature ==
"+fullfp16")
258 if (Feature ==
"+dotprod")
260 if (Feature ==
"+fp16fml")
291 const char *
const AArch64TargetInfo::GCCRegNames[] = {
293 "w0",
"w1",
"w2",
"w3",
"w4",
"w5",
"w6",
"w7",
"w8",
"w9",
"w10",
"w11",
294 "w12",
"w13",
"w14",
"w15",
"w16",
"w17",
"w18",
"w19",
"w20",
"w21",
"w22",
295 "w23",
"w24",
"w25",
"w26",
"w27",
"w28",
"w29",
"w30",
"wsp",
298 "x0",
"x1",
"x2",
"x3",
"x4",
"x5",
"x6",
"x7",
"x8",
"x9",
"x10",
"x11",
299 "x12",
"x13",
"x14",
"x15",
"x16",
"x17",
"x18",
"x19",
"x20",
"x21",
"x22",
300 "x23",
"x24",
"x25",
"x26",
"x27",
"x28",
"fp",
"lr",
"sp",
303 "s0",
"s1",
"s2",
"s3",
"s4",
"s5",
"s6",
"s7",
"s8",
"s9",
"s10",
"s11",
304 "s12",
"s13",
"s14",
"s15",
"s16",
"s17",
"s18",
"s19",
"s20",
"s21",
"s22",
305 "s23",
"s24",
"s25",
"s26",
"s27",
"s28",
"s29",
"s30",
"s31",
308 "d0",
"d1",
"d2",
"d3",
"d4",
"d5",
"d6",
"d7",
"d8",
"d9",
"d10",
"d11",
309 "d12",
"d13",
"d14",
"d15",
"d16",
"d17",
"d18",
"d19",
"d20",
"d21",
"d22",
310 "d23",
"d24",
"d25",
"d26",
"d27",
"d28",
"d29",
"d30",
"d31",
313 "v0",
"v1",
"v2",
"v3",
"v4",
"v5",
"v6",
"v7",
"v8",
"v9",
"v10",
"v11",
314 "v12",
"v13",
"v14",
"v15",
"v16",
"v17",
"v18",
"v19",
"v20",
"v21",
"v22",
315 "v23",
"v24",
"v25",
"v26",
"v27",
"v28",
"v29",
"v30",
"v31" 319 return llvm::makeArrayRef(GCCRegNames);
355 {{
"r29",
"x29"},
"fp"},
356 {{
"r30",
"x30"},
"lr"},
362 return llvm::makeArrayRef(GCCRegAliases);
393 llvm_unreachable(
"FIXME: Unimplemented support for U* constraints.");
405 StringRef Constraint,
char Modifier,
unsigned Size,
406 std::string &SuggestedModifier)
const {
408 while (Constraint[0] ==
'=' || Constraint[0] ==
'+' || Constraint[0] ==
'&')
409 Constraint = Constraint.substr(1);
411 switch (Constraint[0]) {
428 SuggestedModifier =
"w";
449 void AArch64leTargetInfo::setDataLayout() {
453 resetDataLayout(
"e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
474 void AArch64beTargetInfo::setDataLayout() {
475 assert(!
getTriple().isOSBinFormatMachO());
476 resetDataLayout(
"E-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128");
568 const llvm::Triple &Triple,
591 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 ...