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 ppc64:
return "powerpc64";
38 case ppc64le:
return "powerpc64le";
39 case ppc:
return "powerpc";
40 case r600:
return "r600";
41 case amdgcn:
return "amdgcn";
44 case sparc:
return "sparc";
48 case tce:
return "tce";
49 case tcele:
return "tcele";
50 case thumb:
return "thumb";
52 case x86:
return "i386";
53 case x86_64:
return "x86_64";
54 case xcore:
return "xcore";
55 case nvptx:
return "nvptx";
57 case le32:
return "le32";
58 case le64:
return "le64";
59 case amdil:
return "amdil";
61 case hsail:
return "hsail";
63 case spir:
return "spir";
64 case spir64:
return "spir64";
66 case lanai:
return "lanai";
67 case shave:
return "shave";
68 case wasm32:
return "wasm32";
69 case wasm64:
return "wasm64";
90 case avr:
return "avr";
94 case ppc:
return "ppc";
101 case hexagon:
return "hexagon";
103 case amdgcn:
return "amdgcn";
104 case r600:
return "r600";
107 case bpfeb:
return "bpf";
111 case sparc:
return "sparc";
116 case x86_64:
return "x86";
118 case xcore:
return "xcore";
121 case nvptx:
return "nvvm";
124 case le32:
return "le32";
125 case le64:
return "le64";
134 case spir64:
return "spir";
135 case kalimba:
return "kalimba";
136 case lanai:
return "lanai";
137 case shave:
return "shave";
139 case wasm64:
return "wasm";
150 case Apple:
return "apple";
151 case PC:
return "pc";
152 case SCEI:
return "scei";
153 case BGP:
return "bgp";
154 case BGQ:
return "bgq";
156 case IBM:
return "ibm";
159 case NVIDIA:
return "nvidia";
160 case CSR:
return "csr";
161 case Myriad:
return "myriad";
162 case AMD:
return "amd";
163 case Mesa:
return "mesa";
174 case Darwin:
return "darwin";
176 case FreeBSD:
return "freebsd";
177 case Fuchsia:
return "fuchsia";
178 case IOS:
return "ios";
180 case Linux:
return "linux";
181 case Lv2:
return "lv2";
182 case MacOSX:
return "macosx";
183 case NetBSD:
return "netbsd";
184 case OpenBSD:
return "openbsd";
185 case Solaris:
return "solaris";
186 case Win32:
return "windows";
187 case Haiku:
return "haiku";
188 case Minix:
return "minix";
189 case RTEMS:
return "rtems";
190 case NaCl:
return "nacl";
191 case CNK:
return "cnk";
192 case Bitrig:
return "bitrig";
193 case AIX:
return "aix";
194 case CUDA:
return "cuda";
195 case NVCL:
return "nvcl";
196 case AMDHSA:
return "amdhsa";
197 case PS4:
return "ps4";
199 case TvOS:
return "tvos";
200 case WatchOS:
return "watchos";
201 case Mesa3D:
return "mesa3d";
202 case Contiki:
return "contiki";
211 case GNU:
return "gnu";
214 case GNUEABI:
return "gnueabi";
215 case GNUX32:
return "gnux32";
216 case CODE16:
return "code16";
217 case EABI:
return "eabi";
218 case EABIHF:
return "eabihf";
219 case Android:
return "android";
220 case Musl:
return "musl";
223 case MSVC:
return "msvc";
224 case Itanium:
return "itanium";
225 case Cygnus:
return "cygnus";
227 case CoreCLR:
return "coreclr";
228 case OpenCL:
return "opencl";
235 if (ArchName.
equals(
"bpf")) {
240 }
else if (ArchName.
equals(
"bpf_be") || ArchName.
equals(
"bpfeb")) {
242 }
else if (ArchName.
equals(
"bpf_le") || ArchName.
equals(
"bpfel")) {
341 if (ArchName.
empty())
352 if (Profile ==
ARM::PK_M && Version == 6) {
520 if (ARMSubArch.
empty())
535 case ARM::AK_ARMV5TE:
537 case ARM::AK_IWMMXT2:
539 case ARM::AK_ARMV5TEJ:
544 case ARM::AK_ARMV6KZ:
546 case ARM::AK_ARMV6T2:
559 case ARM::AK_ARMV7EM:
563 case ARM::AK_ARMV8_1A:
565 case ARM::AK_ARMV8_2A:
569 case ARM::AK_ARMV8MBaseline:
571 case ARM::AK_ARMV8MMainline:
659 : Data(Str.str()), Arch(UnknownArch), SubArch(NoSubArch),
660 Vendor(UnknownVendor), OS(UnknownOS), Environment(UnknownEnvironment),
661 ObjectFormat(UnknownObjectFormat) {
665 if (Components.
size() > 0) {
668 if (Components.
size() > 1) {
670 if (Components.
size() > 2) {
672 if (Components.
size() > 3) {
690 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).str()),
695 Environment(), ObjectFormat(
Triple::UnknownObjectFormat) {
705 const Twine &EnvironmentStr)
706 : Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr +
Twine(
'-') +
707 EnvironmentStr).str()),
719 bool IsMinGW32 =
false;
720 bool IsCygwin =
false;
724 Str.
split(Components,
'-');
732 if (Components.
size() > 0)
735 if (Components.
size() > 1)
738 if (Components.
size() > 2) {
740 IsCygwin = Components[2].startswith(
"cygwin");
741 IsMinGW32 = Components[2].startswith(
"mingw");
744 if (Components.
size() > 3)
747 if (Components.
size() > 4)
765 for (
unsigned Idx = 0; Idx != Components.
size(); ++Idx) {
787 Valid = OS !=
UnknownOS || IsCygwin || IsMinGW32;
810 std::swap(CurrentComponent, Components[Idx]);
813 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++
i) {
821 }
else if (Pos > Idx) {
828 for (
unsigned i = Idx;
i < Components.
size();) {
833 if (CurrentComponent.
empty())
840 if (!CurrentComponent.
empty())
848 assert(Pos < Components.
size() && Components[Pos] == Comp &&
849 "Component moved wrong!");
857 std::string NormalizedEnvironment;
859 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
860 if (AndroidVersion.
empty()) {
861 Components[3] =
"android";
863 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
864 Components[3] = NormalizedEnvironment;
870 Components[2] =
"windows";
873 Components[3] =
"msvc";
877 }
else if (IsMinGW32) {
879 Components[2] =
"windows";
880 Components[3] =
"gnu";
881 }
else if (IsCygwin) {
883 Components[2] =
"windows";
884 Components[3] =
"cygnus";
886 if (IsMinGW32 || IsCygwin ||
895 std::string Normalized;
896 for (
unsigned i = 0, e = Components.
size();
i != e; ++
i) {
897 if (
i) Normalized +=
'-';
898 Normalized += Components[
i];
909 return Tmp.
split(
'-').first;
914 Tmp = Tmp.
split(
'-').second;
915 return Tmp.
split(
'-').first;
920 Tmp = Tmp.
split(
'-').second;
921 return Tmp.
split(
'-').second;
926 return Tmp.
split(
'-').second;
930 assert(!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9' &&
"Not a number");
935 Result = Result*10 + (Str[0] -
'0');
939 }
while (!Str.
empty() && Str[0] >=
'0' && Str[0] <=
'9');
945 unsigned &Minor,
unsigned &Micro) {
947 Major = Minor = Micro = 0;
950 unsigned *Components[3] = {&Major, &Minor, &Micro};
951 for (
unsigned i = 0;
i != 3; ++
i) {
952 if (Name.
empty() || Name[0] <
'0' || Name[0] >
'9')
965 unsigned &Micro)
const {
968 if (EnvironmentName.
startswith(EnvironmentTypeName))
969 EnvironmentName = EnvironmentName.
substr(EnvironmentTypeName.
size());
975 unsigned &Micro)
const {
986 unsigned &Micro)
const {
1027 unsigned &Micro)
const {
1053 unsigned &Micro)
const {
1476 if (!MArch.
empty() && MArch ==
"v6")
1477 return "arm1176jzf-s";
1509 return "arm926ej-s";
1520 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 ...
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.
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_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)
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.
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.
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 isLittleEndian() const
Tests whether the target triple is little endian.
static bool startswith(StringRef Magic, const char(&S)[N])
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())
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.
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.