26 case amdgcn:
return "amdgcn";
28 case amdil:
return "amdil";
29 case arc:
return "arc";
30 case arm:
return "arm";
31 case armeb:
return "armeb";
32 case avr:
return "avr";
33 case bpfeb:
return "bpfeb";
34 case bpfel:
return "bpfel";
37 case hsail:
return "hsail";
39 case lanai:
return "lanai";
40 case le32:
return "le32";
41 case le64:
return "le64";
42 case mips64:
return "mips64";
44 case mips:
return "mips";
45 case mipsel:
return "mipsel";
46 case msp430:
return "msp430";
48 case nvptx:
return "nvptx";
49 case ppc64:
return "powerpc64";
50 case ppc64le:
return "powerpc64le";
51 case ppc:
return "powerpc";
52 case r600:
return "r600";
57 case shave:
return "shave";
58 case sparc:
return "sparc";
61 case spir64:
return "spir64";
62 case spir:
return "spir";
64 case tce:
return "tce";
65 case tcele:
return "tcele";
66 case thumb:
return "thumb";
69 case wasm32:
return "wasm32";
70 case wasm64:
return "wasm64";
71 case x86:
return "i386";
72 case x86_64:
return "x86_64";
73 case xcore:
return "xcore";
88 case arc:
return "arc";
95 case avr:
return "avr";
99 case ppc:
return "ppc";
106 case hexagon:
return "hexagon";
108 case amdgcn:
return "amdgcn";
109 case r600:
return "r600";
112 case bpfeb:
return "bpf";
116 case sparc:
return "sparc";
121 case x86_64:
return "x86";
123 case xcore:
return "xcore";
126 case nvptx:
return "nvvm";
129 case le32:
return "le32";
130 case le64:
return "le64";
139 case spir64:
return "spir";
140 case kalimba:
return "kalimba";
141 case lanai:
return "lanai";
142 case shave:
return "shave";
144 case wasm64:
return "wasm";
149 case ve:
return "ve";
157 case AMD:
return "amd";
158 case Apple:
return "apple";
159 case BGP:
return "bgp";
160 case BGQ:
return "bgq";
161 case CSR:
return "csr";
163 case IBM:
return "ibm";
165 case Mesa:
return "mesa";
167 case Myriad:
return "myriad";
168 case NVIDIA:
return "nvidia";
170 case PC:
return "pc";
171 case SCEI:
return "scei";
172 case SUSE:
return "suse";
182 case AIX:
return "aix";
183 case AMDHSA:
return "amdhsa";
184 case AMDPAL:
return "amdpal";
185 case Ananas:
return "ananas";
186 case CNK:
return "cnk";
187 case CUDA:
return "cuda";
189 case Contiki:
return "contiki";
190 case Darwin:
return "darwin";
194 case FreeBSD:
return "freebsd";
195 case Fuchsia:
return "fuchsia";
196 case Haiku:
return "haiku";
198 case Hurd:
return "hurd";
199 case IOS:
return "ios";
201 case Linux:
return "linux";
202 case Lv2:
return "lv2";
203 case MacOSX:
return "macosx";
204 case Mesa3D:
return "mesa3d";
205 case Minix:
return "minix";
206 case NVCL:
return "nvcl";
207 case NaCl:
return "nacl";
208 case NetBSD:
return "netbsd";
209 case OpenBSD:
return "openbsd";
210 case PS4:
return "ps4";
211 case RTEMS:
return "rtems";
212 case Solaris:
return "solaris";
213 case TvOS:
return "tvos";
214 case WASI:
return "wasi";
215 case WatchOS:
return "watchos";
216 case Win32:
return "windows";
225 case Android:
return "android";
226 case CODE16:
return "code16";
227 case CoreCLR:
return "coreclr";
228 case Cygnus:
return "cygnus";
229 case EABI:
return "eabi";
230 case EABIHF:
return "eabihf";
231 case GNU:
return "gnu";
234 case GNUEABI:
return "gnueabi";
236 case GNUX32:
return "gnux32";
237 case Itanium:
return "itanium";
238 case MSVC:
return "msvc";
239 case MacABI:
return "macabi";
240 case Musl:
return "musl";
250 if (ArchName.
equals(
"bpf")) {
255 }
else if (ArchName.
equals(
"bpf_be") || ArchName.
equals(
"bpfeb")) {
257 }
else if (ArchName.
equals(
"bpf_le") || ArchName.
equals(
"bpfel")) {
367 if (ArchName.
empty())
390 .Cases(
"i386",
"i486",
"i586",
"i686",
Triple::x86)
411 .
Cases(
"mips",
"mipseb",
"mipsallegrex",
"mipsisa32r6",
413 .
Cases(
"mipsel",
"mipsallegrexel",
"mipsisa32r6el",
"mipsr6el",
415 .
Cases(
"mips64",
"mips64eb",
"mipsn32",
"mipsisa64r6",
417 .
Cases(
"mips64el",
"mipsn32el",
"mipsisa64r6el",
"mips64r6el",
567 if (SubArchName ==
"powerpcspe")
573 if (ARMSubArch.
empty())
582 case ARM::ArchKind::ARMV4:
584 case ARM::ArchKind::ARMV4T:
586 case ARM::ArchKind::ARMV5T:
588 case ARM::ArchKind::ARMV5TE:
589 case ARM::ArchKind::IWMMXT:
590 case ARM::ArchKind::IWMMXT2:
591 case ARM::ArchKind::XSCALE:
592 case ARM::ArchKind::ARMV5TEJ:
594 case ARM::ArchKind::ARMV6:
596 case ARM::ArchKind::ARMV6K:
597 case ARM::ArchKind::ARMV6KZ:
599 case ARM::ArchKind::ARMV6T2:
601 case ARM::ArchKind::ARMV6M:
603 case ARM::ArchKind::ARMV7A:
604 case ARM::ArchKind::ARMV7R:
606 case ARM::ArchKind::ARMV7VE:
608 case ARM::ArchKind::ARMV7K:
610 case ARM::ArchKind::ARMV7M:
612 case ARM::ArchKind::ARMV7S:
614 case ARM::ArchKind::ARMV7EM:
616 case ARM::ArchKind::ARMV8A:
618 case ARM::ArchKind::ARMV8_1A:
620 case ARM::ArchKind::ARMV8_2A:
622 case ARM::ArchKind::ARMV8_3A:
624 case ARM::ArchKind::ARMV8_4A:
626 case ARM::ArchKind::ARMV8_5A:
628 case ARM::ArchKind::ARMV8R:
630 case ARM::ArchKind::ARMV8MBaseline:
632 case ARM::ArchKind::ARMV8MMainline:
634 case ARM::ArchKind::ARMV8_1MMainline:
737 if (Components.
size() > 0) {
740 if (Components.
size() > 1) {
742 if (Components.
size() > 2) {
744 if (Components.
size() > 3) {
771 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).
str()),
786 const Twine &EnvironmentStr)
787 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr +
Twine(
'-') +
788 EnvironmentStr).
str()),
800 bool IsMinGW32 =
false;
801 bool IsCygwin =
false;
805 Str.
split(Components,
'-');
813 if (Components.
size() > 0)
816 if (Components.
size() > 1)
819 if (Components.
size() > 2) {
821 IsCygwin = Components[2].startswith(
"cygwin");
822 IsMinGW32 = Components[2].startswith(
"mingw");
825 if (Components.
size() > 3)
828 if (Components.
size() > 4)
846 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
868 Valid = OS !=
UnknownOS || IsCygwin || IsMinGW32;
891 std::swap(CurrentComponent, Components[Idx]);
894 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
900 std::swap(CurrentComponent, Components[i]);
902 }
else if (Pos > Idx) {
909 for (
unsigned i = Idx; i < Components.
size();) {
912 std::swap(CurrentComponent, Components[i]);
914 if (CurrentComponent.
empty())
921 if (!CurrentComponent.
empty())
929 assert(Pos < Components.
size() && Components[Pos] == Comp &&
930 "Component moved wrong!");
937 for (
unsigned i = 0,
e = Components.
size(); i <
e; ++i) {
938 if (Components[i].
empty())
939 Components[i] =
"unknown";
944 std::string NormalizedEnvironment;
946 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
947 if (AndroidVersion.
empty()) {
948 Components[3] =
"android";
950 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
951 Components[3] = NormalizedEnvironment;
957 Components[3] =
"gnueabihf";
961 Components[2] =
"windows";
964 Components[3] =
"msvc";
968 }
else if (IsMinGW32) {
970 Components[2] =
"windows";
971 Components[3] =
"gnu";
972 }
else if (IsCygwin) {
974 Components[2] =
"windows";
975 Components[3] =
"cygnus";
977 if (IsMinGW32 || IsCygwin ||
986 std::string Normalized;
987 for (
unsigned i = 0, e = Components.
size(); i !=
e; ++i) {
988 if (i) Normalized +=
'-';
989 Normalized += Components[i];
1000 return Tmp.
split(
'-').first;
1005 Tmp = Tmp.
split(
'-').second;
1006 return Tmp.
split(
'-').first;
1011 Tmp = Tmp.
split(
'-').second;
1012 return Tmp.
split(
'-').second;
1017 return Tmp.
split(
'-').second;
1021 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
1022 unsigned Result = 0;
1026 Result = Result*10 + (Str[0] -
'0');
1030 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
1036 unsigned &Minor,
unsigned &Micro) {
1038 Major = Minor = Micro = 0;
1041 unsigned *Components[3] = {&Major, &Minor, &Micro};
1042 for (
unsigned i = 0; i != 3; ++i) {
1043 if (Name.
empty() || Name[0] <
'0' || Name[0] >
'9')
1056 unsigned &Micro)
const {
1059 if (EnvironmentName.
startswith(EnvironmentTypeName))
1060 EnvironmentName = EnvironmentName.
substr(EnvironmentTypeName.
size());
1066 unsigned &Micro)
const {
1079 unsigned &Micro)
const {
1120 unsigned &Micro)
const {
1146 unsigned &Micro)
const {
1593 return *
this ==
Other;
1614 if (!MArch.
empty() && MArch ==
"v6")
1615 return "arm1176jzf-s";
1647 return "arm926ej-s";
1659 return "arm1176jzf-s";
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
ISAKind parseArchISA(StringRef Arch)
static StringRef getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
LLVM_NODISCARD bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
This class represents lattice values for constants.
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static Triple::ArchType parseBPFArch(StringRef ArchName)
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
void push_back(const T &Elt)
bool isArch16Bit() const
Test whether the architecture is 16-bit.
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
static Triple::ArchType parseARMArch(StringRef ArchName)
StringSwitch & StartsWith(StringLiteral S, T Value)
void setOS(OSType Kind)
setOS - Set the operating system (third) component of the triple to a known type. ...
void setEnvironment(EnvironmentType Kind)
setEnvironment - Set the environment (fourth) component of the triple to a known type.
void getEnvironmentVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
Parse the version number from the OS name component of the triple, if present.
StringRef getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
StringSwitch & Case(StringLiteral S, T Value)
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch)
static unsigned EatNumber(StringRef &Str)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
static StringRef getArchTypeName(ArchType Kind)
getArchTypeName - Get the canonical name for the Kind architecture.
LLVM_NODISCARD R Default(T Value)
StringRef getCanonicalArchName(StringRef Arch)
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
static Triple::OSType parseOS(StringRef OSName)
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.
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
static bool startswith(StringRef Magic, const char(&S)[N])
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
static const bool IsLittleEndianHost
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
bool isArch32Bit() const
Test whether the architecture is 32-bit.
LLVM_NODISCARD size_t size() const
size - Get the string size.
static StringRef getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
const std::string & str() const
bool isOSWindows() const
Tests whether the OS is Windows.
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getOSVersion - Parse the version number from the OS name component of the triple, if present...
A switch()-like statement whose cases are string literals.
StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
void setObjectFormat(ObjectFormatType Kind)
setObjectFormat - Set the object file format
StringRef getOSAndEnvironmentName() const
getOSAndEnvironmentName - Get the operating system and optional environment components as a single st...
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
StringRef getDefaultCPU(StringRef Arch)
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName)
bool isLittleEndian() const
Tests whether the target triple is little endian.
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
EndianKind parseArchEndian(StringRef Arch)
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name...
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
StringSwitch & EndsWith(StringLiteral S, T Value)
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
static StringRef getArchTypePrefix(ArchType Kind)
getArchTypePrefix - Get the "prefix" canonical name for the Kind architecture.
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
static Triple::ObjectFormatType getDefaultFormat(const Triple &T)
static Triple::SubArchType parseSubArch(StringRef SubArchName)
void setOSName(StringRef Str)
setOSName - Set the operating system (third) component of the triple by name.
unsigned parseArchVersion(StringRef Arch)
static Triple::VendorType parseVendor(StringRef VendorName)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
bool isOSAIX() const
Tests whether the OS is AIX.
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" ...
ArchKind parseArch(StringRef Arch)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e.g., "x86").
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
StringRef getOSName() const
getOSName - Get the operating system (third) component of the triple.
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
std::string merge(const Triple &Other) const
Merge target triples.
std::string normalize() const
Return the normalized form of this triple's string.
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple, or "" if empty.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
ProfileKind parseArchProfile(StringRef Arch)
LLVM_NODISCARD bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
void setOSAndEnvironmentName(StringRef Str)
setOSAndEnvironmentName - Set the operating system and optional environment components with a single ...
bool isArch64Bit() const
Test whether the architecture is 64-bit.
static void parseVersionFromName(StringRef Name, unsigned &Major, unsigned &Minor, unsigned &Micro)
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
std::string str() const
Return the twine contents as a std::string.
static Triple::ArchType parseArch(StringRef ArchName)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
StringRef - Represent a constant reference to a string, i.e.
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isOSVersionLT - Helper function for doing comparisons against version numbers included in the target ...
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName)
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.
static StringRef getObjectFormatTypeName(Triple::ObjectFormatType Kind)
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
getEnvironmentTypeName - Get the canonical name for the Kind environment.