26 case arm:
return "arm";
27 case armeb:
return "armeb";
28 case avr:
return "avr";
29 case bpfel:
return "bpfel";
30 case bpfeb:
return "bpfeb";
32 case mips:
return "mips";
33 case mipsel:
return "mipsel";
34 case mips64:
return "mips64";
36 case msp430:
return "msp430";
37 case nios2:
return "nios2";
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";
91 case avr:
return "avr";
95 case ppc:
return "ppc";
102 case nios2:
return "nios2";
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";
177 case Ananas:
return "ananas";
179 case Darwin:
return "darwin";
181 case FreeBSD:
return "freebsd";
182 case Fuchsia:
return "fuchsia";
183 case IOS:
return "ios";
185 case Linux:
return "linux";
186 case Lv2:
return "lv2";
187 case MacOSX:
return "macosx";
188 case NetBSD:
return "netbsd";
189 case OpenBSD:
return "openbsd";
190 case Solaris:
return "solaris";
191 case Win32:
return "windows";
192 case Haiku:
return "haiku";
193 case Minix:
return "minix";
194 case RTEMS:
return "rtems";
195 case NaCl:
return "nacl";
196 case CNK:
return "cnk";
197 case Bitrig:
return "bitrig";
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";
216 case GNU:
return "gnu";
219 case GNUEABI:
return "gnueabi";
220 case GNUX32:
return "gnux32";
221 case CODE16:
return "code16";
222 case EABI:
return "eabi";
223 case EABIHF:
return "eabihf";
224 case Android:
return "android";
225 case Musl:
return "musl";
228 case MSVC:
return "msvc";
229 case Itanium:
return "itanium";
230 case Cygnus:
return "cygnus";
232 case CoreCLR:
return "coreclr";
233 case OpenCL:
return "opencl";
240 if (ArchName.
equals(
"bpf")) {
245 }
else if (ArchName.
equals(
"bpf_be") || ArchName.
equals(
"bpfeb")) {
247 }
else if (ArchName.
equals(
"bpf_le") || ArchName.
equals(
"bpfel")) {
347 if (ArchName.
empty())
358 if (Profile ==
ARM::PK_M && Version == 6) {
370 .Cases(
"i386",
"i486",
"i586",
"i686",
Triple::x86)
530 if (ARMSubArch.
empty())
545 case ARM::AK_ARMV5TE:
547 case ARM::AK_IWMMXT2:
549 case ARM::AK_ARMV5TEJ:
554 case ARM::AK_ARMV6KZ:
556 case ARM::AK_ARMV6T2:
563 case ARM::AK_ARMV7VE:
571 case ARM::AK_ARMV7EM:
575 case ARM::AK_ARMV8_1A:
577 case ARM::AK_ARMV8_2A:
581 case ARM::AK_ARMV8MBaseline:
583 case ARM::AK_ARMV8MMainline:
673 :
Data(Str.str()), Arch(UnknownArch), SubArch(NoSubArch),
674 Vendor(UnknownVendor), OS(UnknownOS), Environment(UnknownEnvironment),
675 ObjectFormat(UnknownObjectFormat) {
679 if (Components.
size() > 0) {
682 if (Components.
size() > 1) {
684 if (Components.
size() > 2) {
686 if (Components.
size() > 3) {
704 :
Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).str()),
709 Environment(), ObjectFormat(
Triple::UnknownObjectFormat) {
719 const Twine &EnvironmentStr)
721 EnvironmentStr).str()),
733 bool IsMinGW32 =
false;
734 bool IsCygwin =
false;
738 Str.
split(Components,
'-');
746 if (Components.
size() > 0)
749 if (Components.
size() > 1)
752 if (Components.
size() > 2) {
754 IsCygwin = Components[2].startswith(
"cygwin");
755 IsMinGW32 = Components[2].startswith(
"mingw");
758 if (Components.
size() > 3)
761 if (Components.
size() > 4)
779 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
801 Valid = OS !=
UnknownOS || IsCygwin || IsMinGW32;
824 std::swap(CurrentComponent, Components[Idx]);
827 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
833 std::swap(CurrentComponent, Components[i]);
835 }
else if (Pos > Idx) {
842 for (
unsigned i = Idx; i < Components.
size();) {
845 std::swap(CurrentComponent, Components[i]);
847 if (CurrentComponent.
empty())
854 if (!CurrentComponent.
empty())
862 assert(Pos < Components.
size() && Components[Pos] == Comp &&
863 "Component moved wrong!");
871 std::string NormalizedEnvironment;
873 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
874 if (AndroidVersion.
empty()) {
875 Components[3] =
"android";
877 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
878 Components[3] = NormalizedEnvironment;
884 Components[3] =
"gnueabihf";
888 Components[2] =
"windows";
891 Components[3] =
"msvc";
895 }
else if (IsMinGW32) {
897 Components[2] =
"windows";
898 Components[3] =
"gnu";
899 }
else if (IsCygwin) {
901 Components[2] =
"windows";
902 Components[3] =
"cygnus";
904 if (IsMinGW32 || IsCygwin ||
913 std::string Normalized;
914 for (
unsigned i = 0, e = Components.
size(); i != e; ++i) {
915 if (i) Normalized +=
'-';
916 Normalized += Components[i];
927 return Tmp.
split(
'-').first;
932 Tmp = Tmp.
split(
'-').second;
933 return Tmp.
split(
'-').first;
938 Tmp = Tmp.
split(
'-').second;
939 return Tmp.
split(
'-').second;
944 return Tmp.
split(
'-').second;
948 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
953 Result = Result*10 + (Str[0] -
'0');
957 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
963 unsigned &Minor,
unsigned &Micro) {
965 Major = Minor = Micro = 0;
968 unsigned *Components[3] = {&Major, &Minor, &Micro};
969 for (
unsigned i = 0; i != 3; ++i) {
970 if (Name.
empty() || Name[0] <
'0' || Name[0] >
'9')
983 unsigned &Micro)
const {
986 if (EnvironmentName.
startswith(EnvironmentTypeName))
987 EnvironmentName = EnvironmentName.
substr(EnvironmentTypeName.
size());
993 unsigned &Micro)
const {
1006 unsigned &Micro)
const {
1047 unsigned &Micro)
const {
1073 unsigned &Micro)
const {
1513 return *
this == Other;
1534 if (!MArch.
empty() && MArch ==
"v6")
1535 return "arm1176jzf-s";
1567 return "arm926ej-s";
1579 return "arm1176jzf-s";
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
void push_back(const T &Elt)
static StringRef getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
static Triple::ArchType parseBPFArch(StringRef ArchName)
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
void getWatchOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getWatchOSVersion - Parse the version number as with getOSVersion.
static Triple::ArchType parseARMArch(StringRef ArchName)
const std::string & str() const
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.
unsigned parseArchISA(StringRef Arch)
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
bool isOSWindows() const
Tests whether the OS is Windows.
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch)
std::string str() const
Return the twine contents as a std::string.
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_ATTRIBUTE_ALWAYS_INLINE R Default(const T &Value) const
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 ...
ObjectFormatType getObjectFormat() const
getFormat - Get the object format for this triple.
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
static Triple::OSType parseOS(StringRef OSName)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & EndsWith(const char(&S)[N], const 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])
bool isArch64Bit() const
Test whether the architecture is 64-bit.
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Case(const char(&S)[N], const T &Value)
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.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
StringRef getOSAndEnvironmentName() const
getOSAndEnvironmentName - Get the operating system and optional environment components as a single st...
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
static StringRef getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
unsigned parseArchVersion(StringRef Arch)
SubArchType getSubArch() const
getSubArch - get the parsed subarchitecture type for this triple.
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
StringRef getEnvironmentName() const
getEnvironmentName - Get the optional environment (fourth) component of the triple, or "" if empty.
A switch()-like statement whose cases are string literals.
void setObjectFormat(ObjectFormatType Kind)
setObjectFormat - Set the object file format
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName)
unsigned parseArchEndian(StringRef Arch)
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name...
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
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 getArchTypePrefix(ArchType Kind)
getArchTypePrefix - Get the "prefix" canonical name for the Kind architecture.
StringRef getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
void setArchName(StringRef Str)
setArchName - Set the architecture (first) component of the triple by name.
static Triple::ObjectFormatType getDefaultFormat(const Triple &T)
std::string normalize() const
Return the normalized form of this triple's string.
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getiOSVersion - Parse the version number as with getOSVersion.
static Triple::SubArchType parseSubArch(StringRef SubArchName)
void setOSName(StringRef Str)
setOSName - Set the operating system (third) component of the triple by name.
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
static Triple::VendorType parseVendor(StringRef VendorName)
Triple - Helper class for working with autoconf configuration names.
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getOSVersion - Parse the version number from the OS name component of the triple, if present...
StringRef getOSName() const
getOSName - Get the operating system (third) component of the triple.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
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.
cl::opt< std::string > MArch("march", cl::desc("Architecture to generate code for (see --version)"))
bool isArch16Bit() const
Test whether the architecture is 16-bit.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
LLVM_NODISCARD std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
isOSVersionLT - Helper function for doing comparisons against version numbers included in the target ...
bool isLittleEndian() const
Tests whether the target triple is little endian.
llvm_unreachable("Unknown RegBank!")
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & Cases(const char(&S0)[N0], const char(&S1)[N1], const T &Value)
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
void setOSAndEnvironmentName(StringRef Str)
setOSAndEnvironmentName - Set the operating system and optional environment components with a single ...
unsigned parseArchProfile(StringRef Arch)
static void parseVersionFromName(StringRef Name, unsigned &Major, unsigned &Minor, unsigned &Micro)
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" ...
bool hasEnvironment() const
hasEnvironment - Does this triple have the optional environment (fourth) component?
static Triple::ArchType parseArch(StringRef ArchName)
unsigned parseArch(StringRef Arch)
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
StringRef - Represent a constant reference to a string, i.e.
StringRef getCanonicalArchName(StringRef Arch)
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName)
LLVM_ATTRIBUTE_ALWAYS_INLINE StringSwitch & StartsWith(const char(&S)[N], const T &Value)
bool isArch32Bit() const
Test whether the architecture is 32-bit.
void getEnvironmentVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
Parse the version number from the OS name component of the triple, if present.
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
std::string merge(const Triple &Other) const
Merge target triples.
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.