9#ifndef LLVM_TARGETPARSER_TRIPLE_H
10#define LLVM_TARGETPARSER_TRIPLE_H
342 const Twine &EnvironmentStr);
345 return Arch ==
Other.Arch && SubArch ==
Other.SubArch &&
347 Environment ==
Other.Environment &&
348 ObjectFormat ==
Other.ObjectFormat;
352 return !(*
this ==
Other);
440 const std::string &
str()
const {
return Data; }
501 unsigned Micro = 0)
const {
518 unsigned Micro = 0)
const;
919 assert(PointerWidth == 64 || PointerWidth == 32);
925 : PointerWidth == 64;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Defines the llvm::VersionTuple class, which represents a version in the form major[....
StringRef - Represent a constant reference to a string, i.e.
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.
bool isPPC() const
Tests whether the target is PowerPC (32- or 64-bit LE or BE).
bool isOSDragonFly() const
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.
bool isTargetMachineMac() const
Returns true for targets that run on a macOS machine.
bool isArmT32() const
Tests whether the target is T32.
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
bool isAndroidVersionLT(unsigned Major) const
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
Triple()=default
Default constructor is the same as an empty string and leaves all triple fields unknown.
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
std::string normalize() const
Return the normalized form of this triple's string.
bool isPS4() const
Tests whether the target is the PS4 platform.
bool isPPC64ELFv2ABI() const
Tests whether the target 64-bit PowerPC big endian ABI is ELFv2.
bool isOSWASI() const
Tests whether the OS is WASI.
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
bool isDriverKit() const
Is this an Apple DriverKit triple.
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.
bool isOSHurd() const
Tests whether the OS is Hurd.
bool isBPF() const
Tests whether the target is eBPF.
bool isX32() const
Tests whether the target is X32.
static StringRef getVendorTypeName(VendorType Kind)
Get the canonical name for the Kind vendor.
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
bool isAArch64(int PointerWidth) const
Tests whether the target is AArch64 and pointers are the size specified by PointerWidth.
SubArchType getSubArch() const
get the parsed subarchitecture type for this triple.
bool isX86() const
Tests whether the target is x86 (32- or 64-bit).
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
bool isTargetEHABICompatible() const
Tests whether the target supports the EHABI exception handling standard.
bool isOSBinFormatGOFF() const
Tests whether the OS uses the GOFF binary format.
bool isWindowsGNUEnvironment() const
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.
bool isAndroid() const
Tests whether the target is Android.
bool hasDefaultTLSDESC() const
True if the target supports both general-dynamic and TLSDESC, and TLSDESC is enabled by default.
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
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.
bool supportsCOMDAT() const
Tests whether the target supports comdat.
bool isWindowsCoreCLREnvironment() const
bool isMIPS64() const
Tests whether the target is MIPS 64-bit (little and big endian).
bool hasDefaultDataSections() const
Tests whether the target uses -data-sections as default.
bool isRISCV32() const
Tests whether the target is 32-bit RISC-V.
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
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").
bool isOSVersionLT(const Triple &Other) const
bool isPPC32() const
Tests whether the target is 32-bit PowerPC (little and big endian).
ArchType getArch() const
Get the parsed architecture type of this triple.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
bool isRISCV64() const
Tests whether the target is 64-bit RISC-V.
bool isLoongArch64() const
Tests whether the target is 64-bit LoongArch.
StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.
bool isSPARC32() const
Tests whether the target is 32-bit SPARC (little and big endian).
bool isSimulatorEnvironment() const
VersionTuple getDXILVersion() const
Parse the DXIL version number from the OSVersion and DXIL version (SubArch).
const std::string & str() const
bool isOSSerenity() const
bool isOHOSFamily() const
Tests whether the target is OHOS LiteOS default enviroment is also OHOS, but omited on triple.
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.
bool isMIPS32() const
Tests whether the target is MIPS 32-bit (little and big endian).
bool isShaderModelOS() const
bool isUEFI() const
Tests whether the OS is UEFI.
bool isOSWindows() const
Tests whether the OS is Windows.
bool isMusl() const
Tests whether the environment is musl-libc.
const std::string & getTriple() const
static StringRef getArchTypeName(ArchType Kind)
Get the canonical name for the Kind architecture.
bool isOSBinFormatDXContainer() const
Tests whether the OS uses the DXContainer binary format.
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
static StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
bool isARM() const
Tests whether the target is ARM (little and big endian).
std::string merge(const Triple &Other) const
Merge target triples.
bool isArmMClass() const
Tests whether the target is an M-class.
bool isOSLinux() const
Tests whether the OS is Linux.
bool isRISCV() const
Tests whether the target is RISC-V (32- and 64-bit).
bool isAMDGCN() const
Tests whether the target is AMDGCN.
bool isLoongArch32() const
Tests whether the target is 32-bit LoongArch.
@ ImaginationTechnologies
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
bool isOSAIX() const
Tests whether the OS is AIX.
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 isSPARC64() const
Tests whether the target is 64-bit SPARC (big endian).
bool isWindowsCygwinEnvironment() const
bool isMacOSX() const
Is this a Mac OS X triple.
bool isXROS() const
Is this an Apple XROS 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.
bool isSPARC() const
Tests whether the target is SPARC.
bool isPPC64() const
Tests whether the target is 64-bit PowerPC (little and big endian).
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, XROS, or DriverKit).
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
bool isSPIRVLogical() const
Tests whether the target is SPIR-V Logical.
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.
bool isTvOS() const
Is this an Apple tvOS triple.
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
bool isWindowsArm64EC() const
bool operator==(const Triple &Other) const
bool isWatchOS() const
Is this an Apple watchOS triple.
bool isiOS() const
Is this an iOS triple.
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
bool isOSGlibc() const
Tests whether the OS uses glibc.
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
bool isPS() const
Tests whether the target is the PS4 or PS5 platform.
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
StringRef getArchName() const
Get the architecture (first) component of the triple.
bool isMacCatalystEnvironment() const
bool isPS5() const
Tests whether the target is the PS5 platform.
bool isSPIRV() const
Tests whether the target is SPIR-V (32/64-bit/Logical).
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
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.
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
bool isSystemZ() const
Tests whether the target is SystemZ.
StringRef getEnvironmentVersionString() const
Get the version component of the environment component as a single string (the version after the envi...
bool isPPC32SecurePlt() const
Tests whether the target 32-bit PowerPC uses Secure PLT.
bool isArch32Bit() const
Test whether the architecture is 32-bit.
bool operator!=(const Triple &Other) const
unsigned getOSMajorVersion() const
Return just the major version number, this is specialized because it is a common query.
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
bool hasEnvironment() const
Does this triple have the optional environment (fourth) component?
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
static StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
bool isOSHaiku() const
Tests whether the OS is Haiku.
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
bool isDXIL() const
Tests whether the target is DXIL.
void setVendor(VendorType Kind)
Set the vendor (second) component of the triple to a known type.
bool isGNUEnvironment() const
bool isLoongArch() const
Tests whether the target is LoongArch (32- and 64-bit).
bool isShaderStageEnvironment() const
bool isWindowsItaniumEnvironment() const
bool isVE() const
Tests whether the target is VE.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Represents a version number in the form major[.minor[.subminor[.build]]].
unsigned getMajor() const
Retrieve the major version number.
This is an optimization pass for GlobalISel generic memory operations.