22 .Case(
"thumb,arm",
"arm,thumb")
31 if (A.getName().endswith(Syn))
34 return ArchKind::INVALID;
42 case ArchKind::ARMV2A:
45 case ArchKind::ARMV3M:
48 case ArchKind::ARMV4T:
50 case ArchKind::ARMV5T:
51 case ArchKind::ARMV5TE:
52 case ArchKind::IWMMXT:
53 case ArchKind::IWMMXT2:
54 case ArchKind::XSCALE:
55 case ArchKind::ARMV5TEJ:
58 case ArchKind::ARMV6K:
59 case ArchKind::ARMV6T2:
60 case ArchKind::ARMV6KZ:
61 case ArchKind::ARMV6M:
63 case ArchKind::ARMV7A:
64 case ArchKind::ARMV7VE:
65 case ArchKind::ARMV7R:
66 case ArchKind::ARMV7M:
67 case ArchKind::ARMV7S:
68 case ArchKind::ARMV7EM:
69 case ArchKind::ARMV7K:
71 case ArchKind::ARMV8A:
72 case ArchKind::ARMV8_1A:
73 case ArchKind::ARMV8_2A:
74 case ArchKind::ARMV8_3A:
75 case ArchKind::ARMV8_4A:
76 case ArchKind::ARMV8_5A:
77 case ArchKind::ARMV8R:
78 case ArchKind::ARMV8MBaseline:
79 case ArchKind::ARMV8MMainline:
80 case ArchKind::ARMV8_1MMainline:
82 case ArchKind::INVALID:
92 case ArchKind::ARMV6M:
93 case ArchKind::ARMV7M:
94 case ArchKind::ARMV7EM:
95 case ArchKind::ARMV8MMainline:
96 case ArchKind::ARMV8MBaseline:
97 case ArchKind::ARMV8_1MMainline:
98 return ProfileKind::M;
99 case ArchKind::ARMV7R:
100 case ArchKind::ARMV8R:
102 case ArchKind::ARMV7A:
103 case ArchKind::ARMV7VE:
104 case ArchKind::ARMV7K:
105 case ArchKind::ARMV8A:
106 case ArchKind::ARMV8_1A:
107 case ArchKind::ARMV8_2A:
108 case ArchKind::ARMV8_3A:
109 case ArchKind::ARMV8_4A:
110 case ArchKind::ARMV8_5A:
112 case ArchKind::ARMV2:
113 case ArchKind::ARMV2A:
114 case ArchKind::ARMV3:
115 case ArchKind::ARMV3M:
116 case ArchKind::ARMV4:
117 case ArchKind::ARMV4T:
118 case ArchKind::ARMV5T:
119 case ArchKind::ARMV5TE:
120 case ArchKind::ARMV5TEJ:
121 case ArchKind::ARMV6:
122 case ArchKind::ARMV6K:
123 case ArchKind::ARMV6T2:
124 case ArchKind::ARMV6KZ:
125 case ArchKind::ARMV7S:
126 case ArchKind::IWMMXT:
127 case ArchKind::IWMMXT2:
128 case ArchKind::XSCALE:
129 case ArchKind::INVALID:
130 return ProfileKind::INVALID;
141 .
Cases(
"v6m",
"v6sm",
"v6s-m",
"v6-m")
142 .
Cases(
"v6z",
"v6zk",
"v6kz")
143 .
Cases(
"v7",
"v7a",
"v7hl",
"v7l",
"v7-a")
146 .
Case(
"v7em",
"v7e-m")
147 .
Cases(
"v8",
"v8a",
"v8l",
"aarch64",
"arm64",
"v8-a")
148 .
Case(
"v8.1a",
"v8.1-a")
149 .
Case(
"v8.2a",
"v8.2-a")
150 .
Case(
"v8.3a",
"v8.3-a")
151 .
Case(
"v8.4a",
"v8.4-a")
152 .
Case(
"v8.5a",
"v8.5-a")
154 .
Case(
"v8m.base",
"v8-m.base")
155 .
Case(
"v8m.main",
"v8-m.main")
156 .
Case(
"v8.1m.main",
"v8.1-m.main")
162 if (FPUKind >= FK_LAST || FPUKind == FK_INVALID)
165 static const struct FPUFeatureNameInfo {
166 const char *PlusName, *MinusName;
169 } FPUFeatureInfoList[] = {
177 {
"+vfp2",
"-vfp2", FPUVersion::VFPV2, FPURestriction::D16},
178 {
"+vfp2sp",
"-vfp2sp", FPUVersion::VFPV2, FPURestriction::SP_D16},
180 {
"+vfp3d16",
"-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16},
181 {
"+vfp3d16sp",
"-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16},
182 {
"+vfp3sp",
"-vfp3sp", FPUVersion::VFPV3, FPURestriction::None},
183 {
"+fp16",
"-fp16", FPUVersion::VFPV3_FP16, FPURestriction::SP_D16},
184 {
"+vfp4",
"-vfp4", FPUVersion::VFPV4, FPURestriction::None},
185 {
"+vfp4d16",
"-vfp4d16", FPUVersion::VFPV4, FPURestriction::D16},
186 {
"+vfp4d16sp",
"-vfp4d16sp", FPUVersion::VFPV4, FPURestriction::SP_D16},
187 {
"+vfp4sp",
"-vfp4sp", FPUVersion::VFPV4, FPURestriction::None},
188 {
"+fp-armv8",
"-fp-armv8", FPUVersion::VFPV5, FPURestriction::None},
189 {
"+fp-armv8d16",
"-fp-armv8d16", FPUVersion::VFPV5, FPURestriction::D16},
190 {
"+fp-armv8d16sp",
"-fp-armv8d16sp", FPUVersion::VFPV5, FPURestriction::SP_D16},
191 {
"+fp-armv8sp",
"-fp-armv8sp", FPUVersion::VFPV5, FPURestriction::None},
192 {
"+fullfp16",
"-fullfp16", FPUVersion::VFPV5_FULLFP16, FPURestriction::SP_D16},
193 {
"+fp64",
"-fp64", FPUVersion::VFPV2, FPURestriction::D16},
194 {
"+d32",
"-d32", FPUVersion::VFPV3, FPURestriction::None},
197 for (
const auto &
Info: FPUFeatureInfoList) {
200 Features.push_back(
Info.PlusName);
202 Features.push_back(
Info.MinusName);
205 static const struct NeonFeatureNameInfo {
206 const char *PlusName, *MinusName;
208 } NeonFeatureInfoList[] = {
209 {
"+neon",
"-neon", NeonSupportLevel::Neon},
210 {
"+crypto",
"-crypto", NeonSupportLevel::Crypto},
213 for (
const auto &
Info: NeonFeatureInfoList) {
214 if (
FPUNames[FPUKind].NeonSupport >=
Info.MinSupportLevel)
215 Features.push_back(
Info.PlusName);
217 Features.push_back(
Info.MinusName);
227 return EndianKind::BIG;
231 return EndianKind::BIG;
233 return EndianKind::LITTLE;
237 return EndianKind::LITTLE;
239 return EndianKind::INVALID;
245 .StartsWith(
"aarch64", ISAKind::AARCH64)
255 if (Syn ==
F.getName())
262 if (FPUKind >= FK_LAST)
292 if (A.
substr(offset, 3) ==
"_be")
313 if (A.
size() >= 2 && (A[0] !=
'v' || !std::isdigit(A[1])))
326 .Cases(
"fpa",
"fpe2",
"fpe3",
"maverick",
"invalid")
327 .
Case(
"vfp2",
"vfpv2")
328 .
Case(
"vfp3",
"vfpv3")
329 .
Case(
"vfp4",
"vfpv4")
330 .
Case(
"vfp3-d16",
"vfpv3-d16")
331 .
Case(
"vfp4-d16",
"vfpv4-d16")
332 .
Cases(
"fp4-sp-d16",
"vfpv4-sp-d16",
"fpv4-sp-d16")
333 .
Cases(
"fp4-dp-d16",
"fpv4-dp-d16",
"vfpv4-d16")
334 .
Case(
"fp5-sp-d16",
"fpv5-sp-d16")
335 .
Cases(
"fp5-dp-d16",
"fpv5-dp-d16",
"fpv5-d16")
337 .
Case(
"neon-vfpv3",
"neon")
342 if (FPUKind >= FK_LAST)
348 if (FPUKind >= FK_LAST)
354 if (FPUKind >= FK_LAST)
360 if (CPU ==
"generic")
364 #define
ARM_CPU_NAME(NAME,
ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
365 .Case(NAME, DEFAULT_FPU)
366 #include "llvm/Support/ARMTargetParser.def" 367 .Default(ARM::FK_INVALID);
371 if (CPU ==
"generic")
372 return ARM::ARCHNames[
static_cast<unsigned>(AK)].ArchBaseExtensions;
375 #define
ARM_CPU_NAME(NAME,
ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
379 #include "llvm/Support/ARMTargetParser.def" 384 std::vector<StringRef> &Features) {
390 Features.push_back(
"+hwdiv-arm");
392 Features.push_back(
"-hwdiv-arm");
395 Features.push_back(
"+hwdiv");
397 Features.push_back(
"-hwdiv");
403 std::vector<StringRef> &Features) {
409 if ((Extensions & AE.ID) == AE.ID && AE.Feature)
410 Features.push_back(AE.Feature);
411 else if (AE.NegFeature)
412 Features.push_back(AE.NegFeature);
431 return ARCHNames[
static_cast<unsigned>(AK)].ArchAttr;
436 if (ArchExtKind == AE.ID)
453 if (AE.Feature && ArchExt == AE.getName())
454 return StringRef(Negated ? AE.NegFeature : AE.Feature);
472 return ARM::FK_INVALID;
478 if (CandidateFPU.FPUVer == InputFPU.
FPUVer &&
479 CandidateFPU.NeonSupport == InputFPU.
NeonSupport &&
481 return CandidateFPU.
ID;
486 return ARM::FK_INVALID;
491 if (AE.getName() == ArchExtName)
498 std::vector<StringRef> &Features) {
500 size_t StartingNumFeatures = Features.size();
508 if (Negated && (AE.ID & ID) == ID && AE.NegFeature)
509 Features.push_back(AE.NegFeature);
510 else if (AE.ID == ID && AE.Feature)
511 Features.push_back(AE.Feature);
517 if (ArchExt ==
"fp" || ArchExt ==
"fp.dp") {
519 if (ArchExt ==
"fp.dp") {
521 Features.push_back(
"-fp64");
525 }
else if (Negated) {
532 return StartingNumFeatures != Features.size();
537 if (HWDivKind ==
D.ID)
545 if (AK == ArchKind::INVALID)
550 if (CPU.ArchID == AK && CPU.Default)
551 return CPU.getName();
561 if (Syn ==
D.getName())
569 if (ArchExt == A.getName())
580 return ArchKind::INVALID;
585 if (Arch.ArchID != ArchKind::INVALID)
613 return "aapcs-linux";
621 return "aapcs-linux";
StringRef getName() const
ISAKind parseArchISA(StringRef Arch)
LLVM_NODISCARD bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
FPUVersion getFPUVersion(unsigned FPUKind)
This class represents lattice values for constants.
bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, StringRef ArchExt, std::vector< StringRef > &Features)
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
void push_back(const T &Elt)
StringRef getArchExtFeature(StringRef ArchExt)
StringSwitch & StartsWith(StringLiteral S, T Value)
StringRef getCPUAttr(ArchKind AK)
StringRef getCPUAttr(ArchKind AK)
StringSwitch & Case(StringLiteral S, T Value)
static const FPUName FPUNames[]
unsigned getDefaultFPU(StringRef CPU, ArchKind AK)
bool getHWDivFeatures(unsigned HWDivKind, std::vector< StringRef > &Features)
unsigned getDefaultFPU(StringRef CPU, ArchKind AK)
NeonSupportLevel NeonSupport
StringRef getArchName(ArchKind AK)
LLVM_NODISCARD R Default(T Value)
static StringRef getName(Value *V)
StringRef getCanonicalArchName(StringRef Arch)
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
NeonSupportLevel getFPUNeonSupportLevel(unsigned FPUKind)
static StringRef getHWDivSynonym(StringRef HWDiv)
LLVM_NODISCARD size_t size() const
size - Get the string size.
static unsigned findDoublePrecisionFPU(unsigned InputFPUKind)
Analysis containing CSE Info
StringRef getArchName(ArchKind AK)
bool isOSWindows() const
Tests whether the OS is Windows.
A switch()-like statement whose cases are string literals.
StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
StringRef getDefaultCPU(StringRef Arch)
EndianKind parseArchEndian(StringRef Arch)
LLVM_NODISCARD size_t find(char C, size_t From=0) const
Search for the first character C in the string.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Only single-precision instructions, with 16 D registers.
StringRef getFPUSynonym(StringRef FPU)
unsigned parseArchVersion(StringRef Arch)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
FPURestriction getFPURestriction(unsigned FPUKind)
Triple - Helper class for working with autoconf configuration names.
static const ArchNames< ArchKind > ARCHNames[]
StringRef getArchSynonym(StringRef Arch)
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU)
ArchKind parseArch(StringRef Arch)
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
StringRef getHWDivName(unsigned HWDivKind)
#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT)
StringRef getArchExtName(unsigned ArchExtKind)
const struct llvm::ARM::@314 HWDivNames[]
void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values)
ProfileKind parseArchProfile(StringRef Arch)
bool getExtensionFeatures(unsigned Extensions, std::vector< StringRef > &Features)
ArchKind parseCPUArch(StringRef CPU)
FPURestriction Restriction
unsigned parseArchExt(StringRef ArchExt)
StringRef getName() const
Return a constant reference to the value's name.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
StringRef getFPUName(unsigned FPUKind)
unsigned getDefaultExtensions(StringRef CPU, ArchKind AK)
ArchKind parseCPUArch(StringRef CPU)
static Triple::ArchType parseArch(StringRef ArchName)
StringRef getSubArch(ArchKind AK)
StringRef getSubArch(ArchKind AK)
bool getFPUFeatures(unsigned FPUKind, std::vector< StringRef > &Features)
const ExtName ARCHExtNames[]
Lightweight error class with error context and mandatory checking.
unsigned parseHWDiv(StringRef HWDiv)
unsigned parseFPU(StringRef FPU)
StringRef - Represent a constant reference to a string, i.e.
unsigned getArchAttr(ArchKind AK)
static unsigned getAEKID(StringRef ArchExtName)
const CpuNames< ArchKind > CPUNames[]
static bool stripNegationPrefix(StringRef &Name)