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 nios2:
return "nios2";
39 case ppc64:
return "powerpc64";
40 case ppc64le:
return "powerpc64le";
41 case ppc:
return "powerpc";
42 case r600:
return "r600";
43 case amdgcn:
return "amdgcn";
46 case sparc:
return "sparc";
50 case tce:
return "tce";
51 case tcele:
return "tcele";
52 case thumb:
return "thumb";
54 case x86:
return "i386";
55 case x86_64:
return "x86_64";
56 case xcore:
return "xcore";
57 case nvptx:
return "nvptx";
59 case le32:
return "le32";
60 case le64:
return "le64";
61 case amdil:
return "amdil";
63 case hsail:
return "hsail";
65 case spir:
return "spir";
66 case spir64:
return "spir64";
68 case lanai:
return "lanai";
69 case shave:
return "shave";
70 case wasm32:
return "wasm32";
71 case wasm64:
return "wasm64";
87 case arc:
return "arc";
94 case avr:
return "avr";
98 case ppc:
return "ppc";
105 case nios2:
return "nios2";
107 case hexagon:
return "hexagon";
109 case amdgcn:
return "amdgcn";
110 case r600:
return "r600";
113 case bpfeb:
return "bpf";
117 case sparc:
return "sparc";
122 case x86_64:
return "x86";
124 case xcore:
return "xcore";
127 case nvptx:
return "nvvm";
130 case le32:
return "le32";
131 case le64:
return "le64";
140 case spir64:
return "spir";
141 case kalimba:
return "kalimba";
142 case lanai:
return "lanai";
143 case shave:
return "shave";
145 case wasm64:
return "wasm";
156 case Apple:
return "apple";
157 case PC:
return "pc";
158 case SCEI:
return "scei";
159 case BGP:
return "bgp";
160 case BGQ:
return "bgq";
162 case IBM:
return "ibm";
165 case NVIDIA:
return "nvidia";
166 case CSR:
return "csr";
167 case Myriad:
return "myriad";
168 case AMD:
return "amd";
169 case Mesa:
return "mesa";
170 case SUSE:
return "suse";
181 case Ananas:
return "ananas";
183 case Darwin:
return "darwin";
185 case FreeBSD:
return "freebsd";
186 case Fuchsia:
return "fuchsia";
187 case IOS:
return "ios";
189 case Linux:
return "linux";
190 case Lv2:
return "lv2";
191 case MacOSX:
return "macosx";
192 case NetBSD:
return "netbsd";
193 case OpenBSD:
return "openbsd";
194 case Solaris:
return "solaris";
195 case Win32:
return "windows";
196 case Haiku:
return "haiku";
197 case Minix:
return "minix";
198 case RTEMS:
return "rtems";
199 case NaCl:
return "nacl";
200 case CNK:
return "cnk";
201 case AIX:
return "aix";
202 case CUDA:
return "cuda";
203 case NVCL:
return "nvcl";
204 case AMDHSA:
return "amdhsa";
205 case PS4:
return "ps4";
207 case TvOS:
return "tvos";
208 case WatchOS:
return "watchos";
209 case Mesa3D:
return "mesa3d";
210 case Contiki:
return "contiki";
211 case AMDPAL:
return "amdpal";
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")) {
359 if (ArchName.
empty())
382 .Cases(
"i386",
"i486",
"i586",
"i686",
Triple::x86)
544 if (ARMSubArch.
empty())
553 case ARM::ArchKind::ARMV4:
555 case ARM::ArchKind::ARMV4T:
557 case ARM::ArchKind::ARMV5T:
559 case ARM::ArchKind::ARMV5TE:
560 case ARM::ArchKind::IWMMXT:
561 case ARM::ArchKind::IWMMXT2:
562 case ARM::ArchKind::XSCALE:
563 case ARM::ArchKind::ARMV5TEJ:
565 case ARM::ArchKind::ARMV6:
567 case ARM::ArchKind::ARMV6K:
568 case ARM::ArchKind::ARMV6KZ:
570 case ARM::ArchKind::ARMV6T2:
572 case ARM::ArchKind::ARMV6M:
574 case ARM::ArchKind::ARMV7A:
575 case ARM::ArchKind::ARMV7R:
577 case ARM::ArchKind::ARMV7VE:
579 case ARM::ArchKind::ARMV7K:
581 case ARM::ArchKind::ARMV7M:
583 case ARM::ArchKind::ARMV7S:
585 case ARM::ArchKind::ARMV7EM:
587 case ARM::ArchKind::ARMV8A:
589 case ARM::ArchKind::ARMV8_1A:
591 case ARM::ArchKind::ARMV8_2A:
593 case ARM::ArchKind::ARMV8_3A:
595 case ARM::ArchKind::ARMV8_4A:
597 case ARM::ArchKind::ARMV8R:
599 case ARM::ArchKind::ARMV8MBaseline:
601 case ARM::ArchKind::ARMV8MMainline:
700 if (Components.
size() > 0) {
703 if (Components.
size() > 1) {
705 if (Components.
size() > 2) {
707 if (Components.
size() > 3) {
725 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).
str()),
740 const Twine &EnvironmentStr)
741 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr +
Twine(
'-') +
742 EnvironmentStr).
str()),
754 bool IsMinGW32 =
false;
755 bool IsCygwin =
false;
759 Str.
split(Components,
'-');
767 if (Components.
size() > 0)
770 if (Components.
size() > 1)
773 if (Components.
size() > 2) {
775 IsCygwin = Components[2].startswith(
"cygwin");
776 IsMinGW32 = Components[2].startswith(
"mingw");
779 if (Components.
size() > 3)
782 if (Components.
size() > 4)
800 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
822 Valid = OS !=
UnknownOS || IsCygwin || IsMinGW32;
845 std::swap(CurrentComponent, Components[Idx]);
848 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
854 std::swap(CurrentComponent, Components[i]);
856 }
else if (Pos > Idx) {
863 for (
unsigned i = Idx; i < Components.
size();) {
866 std::swap(CurrentComponent, Components[i]);
868 if (CurrentComponent.
empty())
875 if (!CurrentComponent.
empty())
883 assert(Pos < Components.
size() && Components[Pos] == Comp &&
884 "Component moved wrong!");
892 std::string NormalizedEnvironment;
894 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
895 if (AndroidVersion.
empty()) {
896 Components[3] =
"android";
898 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
899 Components[3] = NormalizedEnvironment;
905 Components[3] =
"gnueabihf";
909 Components[2] =
"windows";
912 Components[3] =
"msvc";
916 }
else if (IsMinGW32) {
918 Components[2] =
"windows";
919 Components[3] =
"gnu";
920 }
else if (IsCygwin) {
922 Components[2] =
"windows";
923 Components[3] =
"cygnus";
925 if (IsMinGW32 || IsCygwin ||
934 std::string Normalized;
935 for (
unsigned i = 0, e = Components.
size(); i != e; ++i) {
936 if (i) Normalized +=
'-';
937 Normalized += Components[i];
948 return Tmp.
split(
'-').first;
953 Tmp = Tmp.
split(
'-').second;
954 return Tmp.
split(
'-').first;
959 Tmp = Tmp.
split(
'-').second;
960 return Tmp.
split(
'-').second;
965 return Tmp.
split(
'-').second;
969 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
974 Result = Result*10 + (Str[0] -
'0');
978 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
984 unsigned &Minor,
unsigned &Micro) {
986 Major = Minor = Micro = 0;
989 unsigned *Components[3] = {&Major, &Minor, &Micro};
990 for (
unsigned i = 0; i != 3; ++i) {
991 if (Name.
empty() || Name[0] <
'0' || Name[0] >
'9')
1004 unsigned &Micro)
const {
1007 if (EnvironmentName.
startswith(EnvironmentTypeName))
1008 EnvironmentName = EnvironmentName.
substr(EnvironmentTypeName.
size());
1014 unsigned &Micro)
const {
1027 unsigned &Micro)
const {
1068 unsigned &Micro)
const {
1094 unsigned &Micro)
const {
1537 return *
this == Other;
1558 if (!MArch.
empty() && MArch ==
"v6")
1559 return "arm1176jzf-s";
1591 return "arm926ej-s";
1603 return "arm1176jzf-s";
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
void push_back(const T &Elt)
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
static StringRef getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
Compute iterated dominance frontiers using a linear time algorithm.
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 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)
StringRef getDefaultCPU(StringRef Arch)
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)
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.
ISAKind parseArchISA(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
unsigned parseArchVersion(StringRef Arch)
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.
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.
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.
EndianKind parseArchEndian(StringRef Arch)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & EndsWith(StringLiteral S, T Value)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & StartsWith(StringLiteral S, T Value)
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.
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" ...
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.
ProfileKind parseArchProfile(StringRef Arch)
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 ...
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)
ArchKind parseArch(StringRef Arch)
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.
StringRef getCanonicalArchName(StringRef Arch)
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.