26 case arm:
return "arm";
27 case armeb:
return "armeb";
28 case arc:
return "arc";
29 case avr:
return "avr";
30 case bpfel:
return "bpfel";
31 case bpfeb:
return "bpfeb";
33 case mips:
return "mips";
34 case mipsel:
return "mipsel";
35 case mips64:
return "mips64";
37 case msp430:
return "msp430";
38 case ppc64:
return "powerpc64";
39 case ppc64le:
return "powerpc64le";
40 case ppc:
return "powerpc";
41 case r600:
return "r600";
42 case amdgcn:
return "amdgcn";
45 case sparc:
return "sparc";
49 case tce:
return "tce";
50 case tcele:
return "tcele";
51 case thumb:
return "thumb";
53 case x86:
return "i386";
54 case x86_64:
return "x86_64";
55 case xcore:
return "xcore";
56 case nvptx:
return "nvptx";
58 case le32:
return "le32";
59 case le64:
return "le64";
60 case amdil:
return "amdil";
62 case hsail:
return "hsail";
64 case spir:
return "spir";
65 case spir64:
return "spir64";
67 case lanai:
return "lanai";
68 case shave:
return "shave";
69 case wasm32:
return "wasm32";
70 case wasm64:
return "wasm64";
86 case arc:
return "arc";
93 case avr:
return "avr";
97 case ppc:
return "ppc";
104 case hexagon:
return "hexagon";
106 case amdgcn:
return "amdgcn";
107 case r600:
return "r600";
110 case bpfeb:
return "bpf";
114 case sparc:
return "sparc";
119 case x86_64:
return "x86";
121 case xcore:
return "xcore";
124 case nvptx:
return "nvvm";
127 case le32:
return "le32";
128 case le64:
return "le64";
137 case spir64:
return "spir";
138 case kalimba:
return "kalimba";
139 case lanai:
return "lanai";
140 case shave:
return "shave";
142 case wasm64:
return "wasm";
153 case Apple:
return "apple";
154 case PC:
return "pc";
155 case SCEI:
return "scei";
156 case BGP:
return "bgp";
157 case BGQ:
return "bgq";
159 case IBM:
return "ibm";
162 case NVIDIA:
return "nvidia";
163 case CSR:
return "csr";
164 case Myriad:
return "myriad";
165 case AMD:
return "amd";
166 case Mesa:
return "mesa";
167 case SUSE:
return "suse";
178 case Ananas:
return "ananas";
180 case Darwin:
return "darwin";
182 case FreeBSD:
return "freebsd";
183 case Fuchsia:
return "fuchsia";
184 case IOS:
return "ios";
186 case Linux:
return "linux";
187 case Lv2:
return "lv2";
188 case MacOSX:
return "macosx";
189 case NetBSD:
return "netbsd";
190 case OpenBSD:
return "openbsd";
191 case Solaris:
return "solaris";
192 case Win32:
return "windows";
193 case Haiku:
return "haiku";
194 case Minix:
return "minix";
195 case RTEMS:
return "rtems";
196 case NaCl:
return "nacl";
197 case CNK:
return "cnk";
198 case AIX:
return "aix";
199 case CUDA:
return "cuda";
200 case NVCL:
return "nvcl";
201 case AMDHSA:
return "amdhsa";
202 case PS4:
return "ps4";
204 case TvOS:
return "tvos";
205 case WatchOS:
return "watchos";
206 case Mesa3D:
return "mesa3d";
207 case Contiki:
return "contiki";
208 case AMDPAL:
return "amdpal";
210 case Hurd:
return "hurd";
211 case WASI:
return "wasi";
220 case GNU:
return "gnu";
224 case GNUEABI:
return "gnueabi";
225 case GNUX32:
return "gnux32";
226 case CODE16:
return "code16";
227 case EABI:
return "eabi";
228 case EABIHF:
return "eabihf";
229 case Android:
return "android";
230 case Musl:
return "musl";
233 case MSVC:
return "msvc";
234 case Itanium:
return "itanium";
235 case Cygnus:
return "cygnus";
236 case CoreCLR:
return "coreclr";
244 if (ArchName.
equals(
"bpf")) {
249 }
else if (ArchName.
equals(
"bpf_be") || ArchName.
equals(
"bpfeb")) {
251 }
else if (ArchName.
equals(
"bpf_le") || ArchName.
equals(
"bpfel")) {
358 if (ArchName.
empty())
381 .Cases(
"i386",
"i486",
"i586",
"i686",
Triple::x86)
400 .
Cases(
"mips",
"mipseb",
"mipsallegrex",
"mipsisa32r6",
402 .
Cases(
"mipsel",
"mipsallegrexel",
"mipsisa32r6el",
"mipsr6el",
404 .
Cases(
"mips64",
"mips64eb",
"mipsn32",
"mipsisa64r6",
406 .
Cases(
"mips64el",
"mipsn32el",
"mipsisa64r6el",
"mips64r6el",
553 if (ARMSubArch.
empty())
562 case ARM::ArchKind::ARMV4:
564 case ARM::ArchKind::ARMV4T:
566 case ARM::ArchKind::ARMV5T:
568 case ARM::ArchKind::ARMV5TE:
569 case ARM::ArchKind::IWMMXT:
570 case ARM::ArchKind::IWMMXT2:
571 case ARM::ArchKind::XSCALE:
572 case ARM::ArchKind::ARMV5TEJ:
574 case ARM::ArchKind::ARMV6:
576 case ARM::ArchKind::ARMV6K:
577 case ARM::ArchKind::ARMV6KZ:
579 case ARM::ArchKind::ARMV6T2:
581 case ARM::ArchKind::ARMV6M:
583 case ARM::ArchKind::ARMV7A:
584 case ARM::ArchKind::ARMV7R:
586 case ARM::ArchKind::ARMV7VE:
588 case ARM::ArchKind::ARMV7K:
590 case ARM::ArchKind::ARMV7M:
592 case ARM::ArchKind::ARMV7S:
594 case ARM::ArchKind::ARMV7EM:
596 case ARM::ArchKind::ARMV8A:
598 case ARM::ArchKind::ARMV8_1A:
600 case ARM::ArchKind::ARMV8_2A:
602 case ARM::ArchKind::ARMV8_3A:
604 case ARM::ArchKind::ARMV8_4A:
606 case ARM::ArchKind::ARMV8_5A:
608 case ARM::ArchKind::ARMV8R:
610 case ARM::ArchKind::ARMV8MBaseline:
612 case ARM::ArchKind::ARMV8MMainline:
710 if (Components.
size() > 0) {
713 if (Components.
size() > 1) {
715 if (Components.
size() > 2) {
717 if (Components.
size() > 3) {
744 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).
str()),
759 const Twine &EnvironmentStr)
760 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr +
Twine(
'-') +
761 EnvironmentStr).
str()),
773 bool IsMinGW32 =
false;
774 bool IsCygwin =
false;
778 Str.
split(Components,
'-');
786 if (Components.
size() > 0)
789 if (Components.
size() > 1)
792 if (Components.
size() > 2) {
794 IsCygwin = Components[2].startswith(
"cygwin");
795 IsMinGW32 = Components[2].startswith(
"mingw");
798 if (Components.
size() > 3)
801 if (Components.
size() > 4)
819 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
841 Valid = OS !=
UnknownOS || IsCygwin || IsMinGW32;
864 std::swap(CurrentComponent, Components[Idx]);
867 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
873 std::swap(CurrentComponent, Components[i]);
875 }
else if (Pos > Idx) {
882 for (
unsigned i = Idx; i < Components.
size();) {
885 std::swap(CurrentComponent, Components[i]);
887 if (CurrentComponent.
empty())
894 if (!CurrentComponent.
empty())
902 assert(Pos < Components.
size() && Components[Pos] == Comp &&
903 "Component moved wrong!");
910 for (
unsigned i = 0, e = Components.
size(); i < e; ++i) {
911 if (Components[i].
empty())
912 Components[i] =
"unknown";
917 std::string NormalizedEnvironment;
919 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
920 if (AndroidVersion.
empty()) {
921 Components[3] =
"android";
923 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
924 Components[3] = NormalizedEnvironment;
930 Components[3] =
"gnueabihf";
934 Components[2] =
"windows";
937 Components[3] =
"msvc";
941 }
else if (IsMinGW32) {
943 Components[2] =
"windows";
944 Components[3] =
"gnu";
945 }
else if (IsCygwin) {
947 Components[2] =
"windows";
948 Components[3] =
"cygnus";
950 if (IsMinGW32 || IsCygwin ||
959 std::string Normalized;
960 for (
unsigned i = 0, e = Components.
size(); i != e; ++i) {
961 if (i) Normalized +=
'-';
962 Normalized += Components[i];
973 return Tmp.
split(
'-').first;
978 Tmp = Tmp.
split(
'-').second;
979 return Tmp.
split(
'-').first;
984 Tmp = Tmp.
split(
'-').second;
985 return Tmp.
split(
'-').second;
990 return Tmp.
split(
'-').second;
994 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
999 Result = Result*10 + (Str[0] -
'0');
1003 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
1009 unsigned &Minor,
unsigned &Micro) {
1011 Major = Minor = Micro = 0;
1014 unsigned *Components[3] = {&Major, &Minor, &Micro};
1015 for (
unsigned i = 0; i != 3; ++i) {
1016 if (Name.
empty() || Name[0] <
'0' || Name[0] >
'9')
1029 unsigned &Micro)
const {
1032 if (EnvironmentName.
startswith(EnvironmentTypeName))
1033 EnvironmentName = EnvironmentName.
substr(EnvironmentTypeName.
size());
1039 unsigned &Micro)
const {
1052 unsigned &Micro)
const {
1093 unsigned &Micro)
const {
1119 unsigned &Micro)
const {
1557 return *
this == Other;
1578 if (!MArch.
empty() && MArch ==
"v6")
1579 return "arm1176jzf-s";
1611 return "arm926ej-s";
1623 return "arm1176jzf-s";
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, 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.
This class represents lattice values for constants.
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.
void push_back(const T &Elt)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
bool isArch16Bit() const
Test whether the architecture is 16-bit.
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
static Triple::ArchType parseARMArch(StringRef ArchName)
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.
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool endswith(StringRef Suffix) const
Check if this string ends with the given Suffix.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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.
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 LLVM_ATTRIBUTE_ALWAYS_INLINE R Default(T Value)
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.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
static const bool IsLittleEndianHost
LLVM_ATTRIBUTE_ALWAYS_INLINE bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
bool isArch32Bit() const
Test whether the architecture is 32-bit.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
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.
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.
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & EndsWith(StringLiteral S, T Value)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & StartsWith(StringLiteral S, T Value)
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.
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(StringLiteral S, T Value)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
ProfileKind parseArchProfile(StringRef Arch)
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)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
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.