31 case amdgcn:
return "amdgcn";
33 case amdil:
return "amdil";
34 case arc:
return "arc";
35 case arm:
return "arm";
36 case armeb:
return "armeb";
37 case avr:
return "avr";
38 case bpfeb:
return "bpfeb";
39 case bpfel:
return "bpfel";
40 case csky:
return "csky";
41 case dxil:
return "dxil";
44 case hsail:
return "hsail";
46 case lanai:
return "lanai";
47 case le32:
return "le32";
48 case le64:
return "le64";
51 case m68k:
return "m68k";
52 case mips64:
return "mips64";
54 case mips:
return "mips";
55 case mipsel:
return "mipsel";
56 case msp430:
return "msp430";
58 case nvptx:
return "nvptx";
59 case ppc64:
return "powerpc64";
60 case ppc64le:
return "powerpc64le";
61 case ppc:
return "powerpc";
62 case ppcle:
return "powerpcle";
63 case r600:
return "r600";
68 case shave:
return "shave";
69 case sparc:
return "sparc";
72 case spir64:
return "spir64";
73 case spir:
return "spir";
74 case spirv:
return "spirv";
78 case tce:
return "tce";
79 case tcele:
return "tcele";
80 case thumb:
return "thumb";
83 case wasm32:
return "wasm32";
84 case wasm64:
return "wasm64";
85 case x86:
return "i386";
86 case x86_64:
return "x86_64";
87 case xcore:
return "xcore";
88 case xtensa:
return "xtensa";
102 return "mipsisa32r6el";
106 return "mipsisa64r6";
110 return "mipsisa64r6el";
158 case arc:
return "arc";
165 case avr:
return "avr";
170 case ppcle:
return "ppc";
172 case m68k:
return "m68k";
179 case hexagon:
return "hexagon";
181 case amdgcn:
return "amdgcn";
182 case r600:
return "r600";
185 case bpfeb:
return "bpf";
189 case sparc:
return "sparc";
194 case x86_64:
return "x86";
196 case xcore:
return "xcore";
199 case nvptx:
return "nvvm";
202 case le32:
return "le32";
203 case le64:
return "le64";
212 case spir64:
return "spir";
218 case kalimba:
return "kalimba";
219 case lanai:
return "lanai";
220 case shave:
return "shave";
222 case wasm64:
return "wasm";
227 case ve:
return "ve";
228 case csky:
return "csky";
233 case dxil:
return "dx";
235 case xtensa:
return "xtensa";
243 case AMD:
return "amd";
244 case Apple:
return "apple";
245 case CSR:
return "csr";
247 case IBM:
return "ibm";
249 case Mesa:
return "mesa";
251 case NVIDIA:
return "nvidia";
253 case PC:
return "pc";
254 case SCEI:
return "scei";
255 case SUSE:
return "suse";
265 case AIX:
return "aix";
266 case AMDHSA:
return "amdhsa";
267 case AMDPAL:
return "amdpal";
269 case CUDA:
return "cuda";
270 case Darwin:
return "darwin";
275 case FreeBSD:
return "freebsd";
276 case Fuchsia:
return "fuchsia";
277 case Haiku:
return "haiku";
279 case Hurd:
return "hurd";
280 case IOS:
return "ios";
282 case Linux:
return "linux";
283 case Lv2:
return "lv2";
284 case MacOSX:
return "macosx";
285 case Mesa3D:
return "mesa3d";
286 case NVCL:
return "nvcl";
287 case NaCl:
return "nacl";
288 case NetBSD:
return "netbsd";
289 case OpenBSD:
return "openbsd";
290 case PS4:
return "ps4";
291 case PS5:
return "ps5";
292 case RTEMS:
return "rtems";
293 case Solaris:
return "solaris";
295 case TvOS:
return "tvos";
296 case UEFI:
return "uefi";
297 case WASI:
return "wasi";
298 case WatchOS:
return "watchos";
299 case Win32:
return "windows";
300 case ZOS:
return "zos";
302 case LiteOS:
return "liteos";
303 case XROS:
return "xros";
304 case Vulkan:
return "vulkan";
313 case Android:
return "android";
314 case CODE16:
return "code16";
315 case CoreCLR:
return "coreclr";
316 case Cygnus:
return "cygnus";
317 case EABI:
return "eabi";
318 case EABIHF:
return "eabihf";
319 case GNU:
return "gnu";
322 case GNUEABI:
return "gnueabi";
324 case GNUF32:
return "gnuf32";
325 case GNUF64:
return "gnuf64";
326 case GNUSF:
return "gnusf";
327 case GNUX32:
return "gnux32";
329 case Itanium:
return "itanium";
330 case MSVC:
return "msvc";
331 case MacABI:
return "macabi";
332 case Musl:
return "musl";
335 case MuslX32:
return "muslx32";
337 case Pixel:
return "pixel";
338 case Vertex:
return "vertex";
340 case Hull:
return "hull";
341 case Domain:
return "domain";
342 case Compute:
return "compute";
343 case Library:
return "library";
346 case AnyHit:
return "anyhit";
348 case Miss:
return "miss";
350 case Mesh:
return "mesh";
363 case COFF:
return "coff";
364 case ELF:
return "elf";
365 case GOFF:
return "goff";
366 case MachO:
return "macho";
367 case Wasm:
return "wasm";
368 case XCOFF:
return "xcoff";
370 case SPIRV:
return "spirv";
376 if (ArchName.
equals(
"bpf")) {
381 }
else if (ArchName.
equals(
"bpf_be") || ArchName.
equals(
"bpfeb")) {
383 }
else if (ArchName.
equals(
"bpf_le") || ArchName.
equals(
"bpfel")) {
506 if (ArchName.
empty())
555 .
Cases(
"mips",
"mipseb",
"mipsallegrex",
"mipsisa32r6",
"mipsr6",
557 .
Cases(
"mipsel",
"mipsallegrexel",
"mipsisa32r6el",
"mipsr6el",
559 .
Cases(
"mips64",
"mips64eb",
"mipsn32",
"mipsisa64r6",
"mips64r6",
561 .
Cases(
"mips64el",
"mipsn32el",
"mipsisa64r6el",
"mips64r6el",
586 .
Cases(
"spirv32",
"spirv32v1.0",
"spirv32v1.1",
"spirv32v1.2",
587 "spirv32v1.3",
"spirv32v1.4",
"spirv32v1.5",
589 .
Cases(
"spirv64",
"spirv64v1.0",
"spirv64v1.1",
"spirv64v1.2",
590 "spirv64v1.3",
"spirv64v1.4",
"spirv64v1.5",
603 .
Cases(
"dxil",
"dxilv1.0",
"dxilv1.1",
"dxilv1.2",
"dxilv1.3",
604 "dxilv1.4",
"dxilv1.5",
"dxilv1.6",
"dxilv1.7",
"dxilv1.8",
753 if (SubArchName ==
"powerpcspe")
756 if (SubArchName ==
"arm64e")
759 if (SubArchName ==
"arm64ec")
789 if (ARMSubArch.
empty())
798 case ARM::ArchKind::ARMV4:
800 case ARM::ArchKind::ARMV4T:
802 case ARM::ArchKind::ARMV5T:
804 case ARM::ArchKind::ARMV5TE:
805 case ARM::ArchKind::IWMMXT:
806 case ARM::ArchKind::IWMMXT2:
807 case ARM::ArchKind::XSCALE:
808 case ARM::ArchKind::ARMV5TEJ:
810 case ARM::ArchKind::ARMV6:
812 case ARM::ArchKind::ARMV6K:
813 case ARM::ArchKind::ARMV6KZ:
815 case ARM::ArchKind::ARMV6T2:
817 case ARM::ArchKind::ARMV6M:
819 case ARM::ArchKind::ARMV7A:
820 case ARM::ArchKind::ARMV7R:
822 case ARM::ArchKind::ARMV7VE:
824 case ARM::ArchKind::ARMV7K:
826 case ARM::ArchKind::ARMV7M:
828 case ARM::ArchKind::ARMV7S:
830 case ARM::ArchKind::ARMV7EM:
832 case ARM::ArchKind::ARMV8A:
834 case ARM::ArchKind::ARMV8_1A:
836 case ARM::ArchKind::ARMV8_2A:
838 case ARM::ArchKind::ARMV8_3A:
840 case ARM::ArchKind::ARMV8_4A:
842 case ARM::ArchKind::ARMV8_5A:
844 case ARM::ArchKind::ARMV8_6A:
846 case ARM::ArchKind::ARMV8_7A:
848 case ARM::ArchKind::ARMV8_8A:
850 case ARM::ArchKind::ARMV8_9A:
852 case ARM::ArchKind::ARMV9A:
854 case ARM::ArchKind::ARMV9_1A:
856 case ARM::ArchKind::ARMV9_2A:
858 case ARM::ArchKind::ARMV9_3A:
860 case ARM::ArchKind::ARMV9_4A:
862 case ARM::ArchKind::ARMV9_5A:
864 case ARM::ArchKind::ARMV8R:
866 case ARM::ArchKind::ARMV8MBaseline:
868 case ARM::ArchKind::ARMV8MMainline:
870 case ARM::ArchKind::ARMV8_1MMainline:
878 switch (
T.getArch()) {
974 :
Data(Str.str()), Arch(UnknownArch), SubArch(NoSubArch),
975 Vendor(UnknownVendor),
OS(UnknownOS), Environment(UnknownEnvironment),
976 ObjectFormat(UnknownObjectFormat) {
980 if (Components.
size() > 0) {
983 if (Components.
size() > 1) {
985 if (Components.
size() > 2) {
987 if (Components.
size() > 3) {
1014 :
Data((ArchStr +
Twine(
'-') + VendorStr +
Twine(
'-') + OSStr).str()),
1019 Environment(), ObjectFormat(
Triple::UnknownObjectFormat) {
1029 const Twine &EnvironmentStr)
1031 EnvironmentStr).str()),
1045 bool IsMinGW32 =
false;
1046 bool IsCygwin =
false;
1050 Str.split(Components,
'-');
1058 if (Components.
size() > 0)
1061 if (Components.
size() > 1)
1064 if (Components.
size() > 2) {
1066 IsCygwin = Components[2].starts_with(
"cygwin");
1067 IsMinGW32 = Components[2].starts_with(
"mingw");
1070 if (Components.
size() > 3)
1073 if (Components.
size() > 4)
1087 for (
unsigned Pos = 0; Pos != std::size(Found); ++Pos) {
1093 if (
Idx < std::size(Found) && Found[
Idx])
1139 for (
unsigned i = Pos; !CurrentComponent.
empty(); ++i) {
1141 while (i < std::size(Found) && Found[i])
1145 std::swap(CurrentComponent, Components[i]);
1147 }
else if (Pos >
Idx) {
1154 for (
unsigned i =
Idx; i < Components.
size();) {
1157 std::swap(CurrentComponent, Components[i]);
1159 if (CurrentComponent.
empty())
1162 while (++i < std::size(Found) && Found[i])
1166 if (!CurrentComponent.
empty())
1170 while (++
Idx < std::size(Found) && Found[
Idx])
1172 }
while (
Idx < Pos);
1174 assert(Pos < Components.
size() && Components[Pos] == Comp &&
1175 "Component moved wrong!");
1183 if (Found[0] && !Found[1] && !Found[2] && Found[3] &&
1184 Components[1] ==
"none" && Components[2].empty())
1185 std::swap(Components[1], Components[2]);
1194 std::string NormalizedEnvironment;
1197 StringRef AndroidVersion = Components[3].drop_front(strlen(
"androideabi"));
1198 if (AndroidVersion.
empty()) {
1199 Components[3] =
"android";
1201 NormalizedEnvironment =
Twine(
"android", AndroidVersion).
str();
1202 Components[3] = NormalizedEnvironment;
1208 Components[3] =
"gnueabihf";
1212 Components[2] =
"windows";
1215 Components[3] =
"msvc";
1219 }
else if (IsMinGW32) {
1221 Components[2] =
"windows";
1222 Components[3] =
"gnu";
1223 }
else if (IsCygwin) {
1225 Components[2] =
"windows";
1226 Components[3] =
"cygnus";
1228 if (IsMinGW32 || IsCygwin ||
1241 if (Components[0] ==
"dxil") {
1242 if (Components.
size() > 4) {
1253 unsigned DXILMinor = 0;
1254 const unsigned SMMajor = 6;
1255 const unsigned LatestCurrentDXILMinor = 8;
1258 if (std::optional<unsigned> SMMinor = Ver.
getMinor()) {
1259 DXILMinor = *SMMinor;
1261 if (DXILMinor > LatestCurrentDXILMinor) {
1269 if (Components[2] ==
"shadermodel6.x") {
1270 DXILMinor = LatestCurrentDXILMinor;
1274 Components[0].str().
append(
"v1.").append(std::to_string(DXILMinor));
1278 return join(Components,
"-");
1287 return Tmp.
split(
'-').first;
1292 Tmp = Tmp.
split(
'-').second;
1293 return Tmp.
split(
'-').first;
1298 Tmp = Tmp.
split(
'-').second;
1299 return Tmp.
split(
'-').second;
1304 return Tmp.
split(
'-').second;
1309 Version.tryParse(
Name);
1310 return Version.withoutBuild();
1322 if (EnvironmentName ==
"none")
1328 if (EnvironmentName.
contains(
"-")) {
1333 const std::string tmp = (
Twine(
"-") + ObjectFormatTypeName).
str();
1337 return EnvironmentName;
1361 if (Version.getMajor() == 0)
1364 if (Version.getMajor() < 4) {
1367 if (Version.getMajor() <= 19) {
1376 if (Version.getMajor() == 0) {
1378 }
else if (Version.getMajor() < 10) {
1413 if (Version.getMajor() == 0)
1420 return Version.withMajorReplaced(Version.getMajor() + 16);
1441 if (Version.getMajor() == 0)
1460 if (Version.getMajor() == 0)
1461 return Version.withMajorReplaced(19);
1483 if (ValidVersionMap.
contains(VulkanVersion) &&
1484 (ValidVersionMap.
lookup(VulkanVersion) == SpirvVersion ||
1486 return VulkanVersion;
1984 return *
this ==
Other;
1990 if (
Other.isOSVersionLT(*
this))
1997 unsigned Micro)
const {
2008 assert(Major >= 11 &&
"Unexpected major version");
2062 "incorrect HLSL stage order");
2064 "incorrect HLSL stage order");
2066 "incorrect HLSL stage order");
2068 "incorrect HLSL stage order");
2070 "incorrect HLSL stage order");
2072 "incorrect HLSL stage order");
2074 "incorrect HLSL stage order");
2076 "incorrect HLSL stage order");
2078 "incorrect HLSL stage order");
2080 "incorrect HLSL stage order");
2082 "incorrect HLSL stage order");
2084 "incorrect HLSL stage order");
2086 "incorrect HLSL stage order");
2088 "incorrect HLSL stage order");
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallString class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName)
static VersionTuple parseVersionFromName(StringRef Name)
static Triple::ObjectFormatType getDefaultFormat(const Triple &T)
static Triple::ArchType parseARMArch(StringRef ArchName)
static Triple::OSType parseOS(StringRef OSName)
static Triple::ArchType parseBPFArch(StringRef ArchName)
static Triple::SubArchType parseSubArch(StringRef SubArchName)
static Triple::ObjectFormatType parseFormat(StringRef EnvironmentName)
static Triple::ArchType parseArch(StringRef ArchName)
static Triple::VendorType parseVendor(StringRef VendorName)
Defines the llvm::VersionTuple class, which represents a version in the form major[....
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
bool contains(const_arg_type_t< KeyT > Val) const
Return true if the specified key is in the map, false otherwise.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool consume_back(StringRef Suffix)
Returns true if this StringRef has the given suffix and removes that suffix.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
bool contains(StringRef Other) const
Return true if the given string is a substring of *this, and false otherwise.
bool consume_front(StringRef Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
bool equals(StringRef RHS) const
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
StringSwitch & StartsWith(StringLiteral S, T Value)
StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
StringSwitch & EndsWith(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
Comparison function for checking OS X version compatibility, which handles supporting skewed version ...
VersionTuple getOSVersion() const
Parse the version number from the OS name component of the triple, if present.
StringRef getVendorName() const
Get the vendor (second) component of the triple.
VersionTuple getWatchOSVersion() const
Parse the version number as with getOSVersion.
void setArchName(StringRef Str)
Set the architecture (first) component of the triple by name.
void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
Triple()=default
Default constructor is the same as an empty string and leaves all triple fields unknown.
std::string normalize() const
Return the normalized form of this triple's string.
unsigned getArchPointerBitWidth() const
Returns the pointer width of this architecture.
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
static StringRef getVendorTypeName(VendorType Kind)
Get the canonical name for the Kind vendor.
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
SubArchType getSubArch() const
get the parsed subarchitecture type for this triple.
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
void setVendorName(StringRef Str)
Set the vendor (second) component of the triple by name.
void setOSAndEnvironmentName(StringRef Str)
Set the operating system and optional environment components with a single string.
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
bool isLittleEndian() const
Tests whether the target triple is little endian.
void setEnvironment(EnvironmentType Kind)
Set the environment (fourth) component of the triple to a known type.
StringRef getOSName() const
Get the operating system (third) component of the triple.
void setTriple(const Twine &Str)
Set all components to the new triple Str.
OSType getOS() const
Get the parsed operating system type of this triple.
VersionTuple getEnvironmentVersion() const
Parse the version number from the OS name component of the triple, if present.
static ArchType getArchTypeForLLVMName(StringRef Str)
The canonical type for the given LLVM architecture name (e.g., "x86").
ArchType getArch() const
Get the parsed architecture type of this triple.
StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.
bool isSimulatorEnvironment() const
const std::string & str() const
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
VersionTuple getVulkanVersion() const
Parse the Vulkan version number from the OSVersion and SPIR-V version (SubArch).
VersionTuple getDriverKitVersion() const
Parse the version number as with getOSVersion.
static StringRef getArchTypeName(ArchType Kind)
Get the canonical name for the Kind architecture.
static StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
std::string merge(const Triple &Other) const
Merge target triples.
@ ImaginationTechnologies
VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
bool isArch64Bit() const
Test whether the architecture is 64-bit.
StringRef getOSAndEnvironmentName() const
Get the operating system and optional environment components as a single string (separated by a '-' i...
@ ARMSubArch_v8m_mainline
@ ARMSubArch_v8m_baseline
@ ARMSubArch_v8_1m_mainline
bool getMacOSXVersion(VersionTuple &Version) const
Parse the version number as with getOSVersion and then translate generic "darwin" versions to the cor...
bool isMacOSX() const
Is this a Mac OS X triple.
void setEnvironmentName(StringRef Str)
Set the optional environment (fourth) component of the triple by name.
void setOS(OSType Kind)
Set the operating system (third) component of the triple to a known type.
void setOSName(StringRef Str)
Set the operating system (third) component of the triple by name.
VendorType getVendor() const
Get the parsed vendor type of this triple.
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
bool isOSVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
Helper function for doing comparisons against version numbers included in the target triple.
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
StringRef getArchName() const
Get the architecture (first) component of the triple.
bool isMacCatalystEnvironment() const
static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat)
Get the name for the Object format.
bool isArch16Bit() const
Test whether the architecture is 16-bit.
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
VersionTuple getiOSVersion() const
Parse the version number as with getOSVersion.
StringRef getEnvironmentVersionString() const
Get the version component of the environment component as a single string (the version after the envi...
bool isArch32Bit() const
Test whether the architecture is 32-bit.
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
bool hasEnvironment() const
Does this triple have the optional environment (fourth) component?
static StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
void setVendor(VendorType Kind)
Set the vendor (second) component of the triple to a known type.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::string str() const
Return the twine contents as a std::string.
Represents a version number in the form major[.minor[.subminor[.build]]].
unsigned getMajor() const
Retrieve the major version number.
bool empty() const
Determine whether this version information is empty (e.g., all version components are zero).
std::optional< unsigned > getMinor() const
Retrieve the minor version number, if provided.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
StringRef getCanonicalArchName(StringRef Arch)
MArch is expected to be of the form (arm|thumb)?(eb)?(v.
ISAKind parseArchISA(StringRef Arch)
ArchKind parseArch(StringRef Arch)
ProfileKind parseArchProfile(StringRef Arch)
unsigned parseArchVersion(StringRef Arch)
EndianKind parseArchEndian(StringRef Arch)
@ C
The default llvm calling convention, compatible with C.
static const bool IsLittleEndianHost
This is an optimization pass for GlobalISel generic memory operations.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.