23 case arm:
return "arm";
25 case mips:
return "mips";
26 case mipsel:
return "mipsel";
27 case mips64:
return "mips64";
29 case msp430:
return "msp430";
30 case ppc64:
return "powerpc64";
31 case ppc64le:
return "powerpc64le";
32 case ppc:
return "powerpc";
33 case r600:
return "r600";
34 case sparc:
return "sparc";
37 case tce:
return "tce";
38 case thumb:
return "thumb";
39 case x86:
return "i386";
40 case x86_64:
return "x86_64";
41 case xcore:
return "xcore";
42 case nvptx:
return "nvptx";
44 case le32:
return "le32";
45 case amdil:
return "amdil";
46 case spir:
return "spir";
47 case spir64:
return "spir64";
61 case thumb:
return "arm";
65 case ppc:
return "ppc";
74 case r600:
return "r600";
77 case sparc:
return "sparc";
84 case xcore:
return "xcore";
86 case nvptx:
return "nvptx";
88 case le32:
return "le32";
89 case amdil:
return "amdil";
90 case spir:
return "spir";
91 case spir64:
return "spir";
99 case Apple:
return "apple";
100 case PC:
return "pc";
101 case SCEI:
return "scei";
102 case BGP:
return "bgp";
103 case BGQ:
return "bgq";
105 case IBM:
return "ibm";
106 case NVIDIA:
return "nvidia";
117 case Cygwin:
return "cygwin";
118 case Darwin:
return "darwin";
120 case FreeBSD:
return "freebsd";
121 case IOS:
return "ios";
123 case Linux:
return "linux";
124 case Lv2:
return "lv2";
125 case MacOSX:
return "macosx";
126 case MinGW32:
return "mingw32";
127 case NetBSD:
return "netbsd";
128 case OpenBSD:
return "openbsd";
129 case Solaris:
return "solaris";
130 case Win32:
return "win32";
131 case Haiku:
return "haiku";
132 case Minix:
return "minix";
133 case RTEMS:
return "rtems";
134 case NaCl:
return "nacl";
135 case CNK:
return "cnk";
136 case Bitrig:
return "bitrig";
137 case AIX:
return "aix";
138 case CUDA:
return "cuda";
139 case NVCL:
return "nvcl";
148 case GNU:
return "gnu";
150 case GNUEABI:
return "gnueabi";
151 case GNUX32:
return "gnux32";
152 case EABI:
return "eabi";
153 case MachO:
return "macho";
154 case Android:
return "android";
155 case ELF:
return "elf";
199 .Case(
"i386",
"i386")
200 .
Case(
"x86_64",
"x86_64")
201 .
Case(
"powerpc",
"ppc")
202 .
Case(
"powerpc64",
"ppc64")
203 .
Case(
"powerpc64le",
"ppc64le")
205 .
Cases(
"armv4t",
"thumbv4t",
"armv4t")
206 .
Cases(
"armv5",
"armv5e",
"thumbv5",
"thumbv5e",
"armv5")
207 .
Cases(
"armv6",
"thumbv6",
"armv6")
208 .
Cases(
"armv7",
"thumbv7",
"armv7")
209 .
Case(
"r600",
"r600")
210 .
Case(
"nvptx",
"nvptx")
211 .
Case(
"nvptx64",
"nvptx64")
212 .
Case(
"le32",
"le32")
213 .
Case(
"amdil",
"amdil")
214 .
Case(
"spir",
"spir")
215 .
Case(
"spir64",
"spir64")
221 .Cases(
"i386",
"i486",
"i586",
"i686",
Triple::x86)
330 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).str()),
343 const Twine &EnvironmentStr)
344 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr +
Twine(
'-') +
345 EnvironmentStr).str()),
355 Str.
split(Components,
"-");
363 if (Components.
size() > 0)
366 if (Components.
size() > 1)
369 if (Components.
size() > 2)
372 if (Components.
size() > 3)
390 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
429 std::swap(CurrentComponent, Components[Idx]);
432 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
438 std::swap(CurrentComponent, Components[i]);
440 }
else if (Pos > Idx) {
447 for (
unsigned i = Idx; i < Components.
size();) {
450 std::swap(CurrentComponent, Components[i]);
452 if (CurrentComponent.
empty())
459 if (!CurrentComponent.
empty())
467 assert(Pos < Components.
size() && Components[Pos] == Comp &&
468 "Component moved wrong!");
478 std::string Normalized;
479 for (
unsigned i = 0, e = Components.
size(); i != e; ++i) {
480 if (i) Normalized +=
'-';
481 Normalized += Components[i];
492 return Tmp.
split(
'-').first;
497 Tmp = Tmp.
split(
'-').second;
498 return Tmp.
split(
'-').first;
503 Tmp = Tmp.
split(
'-').second;
504 return Tmp.
split(
'-').second;
509 return Tmp.
split(
'-').second;
513 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
518 Result = Result*10 + (Str[0] -
'0');
522 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
528 unsigned &Micro)
const {
537 Major = Minor = Micro = 0;
540 unsigned *Components[3] = { &Major, &Minor, &Micro };
541 for (
unsigned i = 0; i != 3; ++i) {
542 if (OSName.
empty() || OSName[0] <
'0' || OSName[0] >
'9')
550 OSName = OSName.
substr(1);
555 unsigned &Micro)
const {
594 unsigned &Micro)
const {
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
void push_back(const T &Elt)
static std::string normalize(StringRef Str)
size_t size() const
size - Get the string size.
void setVendor(VendorType Kind)
std::pair< StringRef, StringRef > split(char Separator) const
StringRef substr(size_t Start, size_t N=npos) const
void setEnvironment(EnvironmentType Kind)
StringSwitch & Case(const char(&S)[N], const T &Value)
static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch)
static unsigned EatNumber(StringRef &Str)
#define llvm_unreachable(msg)
void setVendorName(StringRef Str)
static Triple::OSType parseOS(StringRef OSName)
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
size_t array_lengthof(T(&)[N])
Find the length of an array.
StringRef getOSAndEnvironmentName() const
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
StringRef getEnvironmentName() const
A switch()-like statement whose cases are string literals.
void setEnvironmentName(StringRef Str)
static const char * getVendorTypeName(VendorType Kind)
getVendorTypeName - Get the canonical name for the Kind vendor.
void setTriple(const Twine &Str)
setTriple - Set all components to the new triple Str.
void setArchName(StringRef Str)
void getiOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
void setOSName(StringRef Str)
static const char * getArchTypePrefix(ArchType Kind)
static Triple::VendorType parseVendor(StringRef VendorName)
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X or iOS).
static const char * getEnvironmentTypeName(EnvironmentType Kind)
StringSwitch & StartsWith(const char(&S)[N], const T &Value)
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
StringRef getOSName() const
static ArchType getArchTypeForLLVMName(StringRef Str)
static const char * getArchTypeName(ArchType Kind)
getArchTypeName - Get the canonical name for the Kind architecture.
bool isArch16Bit() const
Test whether the architecture is 16-bit.
R Default(const T &Value) const
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
StringRef str() const
Explicit conversion to StringRef.
const char * getArchNameForAssembler()
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
void setOSAndEnvironmentName(StringRef Str)
StringRef getArchName() const
bool getMacOSXVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
bool hasEnvironment() const
static Triple::ArchType parseArch(StringRef ArchName)
StringSwitch & Cases(const char(&S0)[N0], const char(&S1)[N1], const T &Value)
VendorType getVendor() const
getVendor - Get the parsed vendor type of this triple.
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName)
static const char * getOSTypeName(OSType Kind)
getOSTypeName - Get the canonical name for the Kind operating system.
bool isArch32Bit() const
Test whether the architecture is 32-bit.
StringRef getVendorName() const
getVendorName - Get the vendor (second) component of the triple.
void setArch(ArchType Kind)
bool empty() const
empty - Check if the string is empty.