26 case arm:
return "arm";
27 case armeb:
return "armeb";
28 case bpfel:
return "bpfel";
29 case bpfeb:
return "bpfeb";
31 case mips:
return "mips";
32 case mipsel:
return "mipsel";
33 case mips64:
return "mips64";
35 case msp430:
return "msp430";
36 case ppc64:
return "powerpc64";
37 case ppc64le:
return "powerpc64le";
38 case ppc:
return "powerpc";
39 case r600:
return "r600";
40 case amdgcn:
return "amdgcn";
41 case sparc:
return "sparc";
45 case tce:
return "tce";
46 case thumb:
return "thumb";
48 case x86:
return "i386";
49 case x86_64:
return "x86_64";
50 case xcore:
return "xcore";
51 case nvptx:
return "nvptx";
53 case le32:
return "le32";
54 case le64:
return "le64";
55 case amdil:
return "amdil";
57 case hsail:
return "hsail";
59 case spir:
return "spir";
60 case spir64:
return "spir64";
62 case shave:
return "shave";
63 case wasm32:
return "wasm32";
64 case wasm64:
return "wasm64";
85 case ppc:
return "ppc";
95 case r600:
return "amdgpu";
98 case bpfeb:
return "bpf";
102 case sparc:
return "sparc";
107 case x86_64:
return "x86";
109 case xcore:
return "xcore";
111 case nvptx:
return "nvptx";
114 case le32:
return "le32";
115 case le64:
return "le64";
124 case spir64:
return "spir";
125 case kalimba:
return "kalimba";
126 case shave:
return "shave";
127 case wasm32:
return "wasm32";
128 case wasm64:
return "wasm64";
136 case Apple:
return "apple";
137 case PC:
return "pc";
138 case SCEI:
return "scei";
139 case BGP:
return "bgp";
140 case BGQ:
return "bgq";
142 case IBM:
return "ibm";
145 case NVIDIA:
return "nvidia";
146 case CSR:
return "csr";
157 case Darwin:
return "darwin";
159 case FreeBSD:
return "freebsd";
160 case IOS:
return "ios";
162 case Linux:
return "linux";
163 case Lv2:
return "lv2";
164 case MacOSX:
return "macosx";
165 case NetBSD:
return "netbsd";
166 case OpenBSD:
return "openbsd";
167 case Solaris:
return "solaris";
168 case Win32:
return "windows";
169 case Haiku:
return "haiku";
170 case Minix:
return "minix";
171 case RTEMS:
return "rtems";
172 case NaCl:
return "nacl";
173 case CNK:
return "cnk";
174 case Bitrig:
return "bitrig";
175 case AIX:
return "aix";
176 case CUDA:
return "cuda";
177 case NVCL:
return "nvcl";
178 case AMDHSA:
return "amdhsa";
179 case PS4:
return "ps4";
188 case GNU:
return "gnu";
190 case GNUEABI:
return "gnueabi";
191 case GNUX32:
return "gnux32";
192 case CODE16:
return "code16";
193 case EABI:
return "eabi";
194 case EABIHF:
return "eabihf";
195 case Android:
return "android";
196 case MSVC:
return "msvc";
197 case Itanium:
return "itanium";
198 case Cygnus:
return "cygnus";
205 if (ArchName.
equals(
"bpf")) {
210 }
else if (ArchName.
equals(
"bpf_be") || ArchName.
equals(
"bpfeb")) {
212 }
else if (ArchName.
equals(
"bpf_le") || ArchName.
equals(
"bpfel")) {
304 if (ArchName.
empty())
315 if (Profile ==
ARM::PK_M && Version == 6) {
330 .Cases(
"i386",
"i486",
"i586",
"i686",
Triple::x86)
448 if (ARMSubArch.
empty())
570 :
Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).str()),
575 Environment(), ObjectFormat(
Triple::UnknownObjectFormat) {
585 const Twine &EnvironmentStr)
587 EnvironmentStr).str()),
599 bool IsMinGW32 =
false;
600 bool IsCygwin =
false;
604 Str.
split(Components,
"-");
612 if (Components.
size() > 0)
615 if (Components.
size() > 1)
618 if (Components.
size() > 2) {
620 IsCygwin = Components[2].startswith(
"cygwin");
621 IsMinGW32 = Components[2].startswith(
"mingw");
624 if (Components.
size() > 3)
627 if (Components.
size() > 4)
645 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
667 Valid = OS !=
UnknownOS || IsCygwin || IsMinGW32;
690 std::swap(CurrentComponent, Components[Idx]);
693 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
699 std::swap(CurrentComponent, Components[i]);
701 }
else if (Pos > Idx) {
708 for (
unsigned i = Idx; i < Components.
size();) {
711 std::swap(CurrentComponent, Components[i]);
713 if (CurrentComponent.
empty())
720 if (!CurrentComponent.
empty())
728 assert(Pos < Components.
size() && Components[Pos] == Comp &&
729 "Component moved wrong!");
737 std::string NormalizedEnvironment;
738 if (Environment ==
Triple::Android && Components[3].startswith(
"androideabi")) {
739 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
740 if (AndroidVersion.
empty()) {
741 Components[3] =
"android";
743 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
744 Components[3] = NormalizedEnvironment;
750 Components[2] =
"windows";
753 Components[3] =
"msvc";
757 }
else if (IsMinGW32) {
759 Components[2] =
"windows";
760 Components[3] =
"gnu";
761 }
else if (IsCygwin) {
763 Components[2] =
"windows";
764 Components[3] =
"cygnus";
766 if (IsMinGW32 || IsCygwin ||
775 std::string Normalized;
776 for (
unsigned i = 0, e = Components.
size(); i != e; ++i) {
777 if (i) Normalized +=
'-';
778 Normalized += Components[i];
789 return Tmp.
split(
'-').first;
794 Tmp = Tmp.
split(
'-').second;
795 return Tmp.
split(
'-').first;
800 Tmp = Tmp.
split(
'-').second;
801 return Tmp.
split(
'-').second;
806 return Tmp.
split(
'-').second;
810 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
815 Result = Result*10 + (Str[0] -
'0');
819 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
825 unsigned &Minor,
unsigned &Micro) {
827 Major = Minor = Micro = 0;
830 unsigned *Components[3] = {&Major, &Minor, &Micro};
831 for (
unsigned i = 0; i != 3; ++i) {
832 if (Name.
empty() || Name[0] <
'0' || Name[0] >
'9')
845 unsigned &Micro)
const {
848 if (EnvironmentName.
startswith(EnvironmentTypeName))
849 EnvironmentName = EnvironmentName.
substr(EnvironmentTypeName.
size());
855 unsigned &Micro)
const {
866 unsigned &Micro)
const {
905 unsigned &Micro)
const {
1293 if (!MArch.
empty() && MArch ==
"v6")
1294 return "arm1176jzf-s";
1319 return "arm926ej-s";
1329 return "arm1176jzf-s";
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
void push_back(const T &Elt)
static const char * getObjectFormatTypeName(Triple::ObjectFormatType Kind)
size_t size() const
size - Get the string size.
static Triple::ArchType parseBPFArch(StringRef ArchName)
void setVendor(VendorType Kind)
setVendor - Set the vendor (second) component of the triple to a known type.
static unsigned parseArch(StringRef Arch)
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
static Triple::ArchType parseARMArch(StringRef ArchName)
const std::string & str() const
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.
StringSwitch & Case(const char(&S)[N], const T &Value)
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)
StringSwitch & EndsWith(const char(&S)[N], const T &Value)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void setVendorName(StringRef Str)
setVendorName - Set the vendor (second) component of the triple by name.
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.
static const bool IsLittleEndianHost
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.
LLVM_CONSTEXPR size_t array_lengthof(T(&)[N])
Find the length of an array.
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)
void setEnvironmentName(StringRef Str)
setEnvironmentName - Set the optional environment (fourth) component of the triple by name...
static const char * getDefaultCPU(StringRef Arch)
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.
static unsigned parseArchVersion(StringRef Arch)
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.
static const char * getArchTypePrefix(ArchType Kind)
getArchTypePrefix - Get the "prefix" canonical name for the Kind architecture.
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 or iOS).
static const char * getEnvironmentTypeName(EnvironmentType Kind)
getEnvironmentTypeName - Get the canonical name for the Kind environment.
StringSwitch & StartsWith(const char(&S)[N], const T &Value)
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
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 unsigned parseArchEndian(StringRef Arch)
static ArchType getArchTypeForLLVMName(StringRef Str)
getArchTypeForLLVMName - The canonical type for the given LLVM architecture name (e.g., "x86").
static const char * getArchTypeName(ArchType Kind)
getArchTypeName - Get the canonical name for the Kind architecture.
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.
R Default(const T &Value) const
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
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 ...
static void parseVersionFromName(StringRef Name, unsigned &Major, unsigned &Minor, unsigned &Micro)
StringRef getArchName() const
getArchName - Get the architecture (first) component of the triple.
static unsigned parseArchProfile(StringRef Arch)
static unsigned parseArchISA(StringRef Arch)
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)
EnvironmentType getEnvironment() const
getEnvironment - Get the parsed environment type of this triple.
const char * getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
const ARM::ArchExtKind Kind
StringSwitch & Cases(const char(&S0)[N0], const char(&S1)[N1], const T &Value)
StringRef - Represent a constant reference to a string, i.e.
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.
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.
static StringRef getCanonicalArchName(StringRef Arch)
void setArch(ArchType Kind)
setArch - Set the architecture (first) component of the triple to a known type.
bool empty() const
empty - Check if the string is empty.