9#ifndef LLVM_TARGETPARSER_TRIPLE_H
10#define LLVM_TARGETPARSER_TRIPLE_H
365 const Twine &OSStr,
const Twine &EnvironmentStr);
368 return Arch ==
Other.Arch && SubArch ==
Other.SubArch &&
370 Environment ==
Other.Environment &&
371 ObjectFormat ==
Other.ObjectFormat;
375 return !(*
this ==
Other);
475 const std::string &
str()
const {
return Data; }
480 bool empty()
const {
return Data.empty(); }
542 unsigned Micro = 0)
const {
559 unsigned Micro = 0)
const;
1003 assert(PointerWidth == 64 || PointerWidth == 32);
1008 ? PointerWidth == 32
1009 : PointerWidth == 64;
1321 bool IsInValidRange);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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.
LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
Comparison function for checking OS X version compatibility, which handles supporting skewed version ...
LLVM_ABI 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
LLVM_ABI StringRef getVendorName() const
Get the vendor (second) component of the triple.
LLVM_ABI VersionTuple getWatchOSVersion() const
Parse the version number as with getOSVersion.
LLVM_ABI 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.
LLVM_ABI void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
bool isAndroidVersionLT(unsigned Major) const
LLVM_ABI 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).
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.
static LLVM_ABI VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version, bool IsInValidRange)
Returns a canonicalized OS version number for the specified OS.
bool isOSWASI() const
Tests whether the OS is WASI.
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
CanonicalForm
Canonical form.
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_ABI 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 isHardFloatABI() const
Tests if the target forces hardfloat.
bool isBPF() const
Tests whether the target is eBPF.
bool isX32() const
Tests whether the target is X32.
static LLVM_ABI 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.
std::string normalize(CanonicalForm Form=CanonicalForm::ANY) const
Return the normalized form of this triple's string.
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
LLVM_ABI void setVendorName(StringRef Str)
Set the vendor (second) component of the triple by name.
LLVM_ABI 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 uses TLSDESC by default.
LLVM_ABI 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.
LLVM_ABI bool isLittleEndian() const
Tests whether the target triple is little endian.
LLVM_ABI void setEnvironment(EnvironmentType Kind)
Set the environment (fourth) component of the triple to a known type.
LLVM_ABI 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 isSPIROrSPIRV() const
LLVM_ABI ExceptionHandling getDefaultExceptionHandling() 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 isTargetGNUAEABI() const
bool isRISCV32() const
Tests whether the target is 32-bit RISC-V.
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
LLVM_ABI 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.
LLVM_ABI VersionTuple getEnvironmentVersion() const
Parse the version number from the OS name component of the triple, if present.
static LLVM_ABI std::string normalize(StringRef Str, CanonicalForm Form=CanonicalForm::ANY)
Turn an arbitrary machine specification into the canonical triple form (or something sensible that th...
static LLVM_ABI 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.
LLVM_ABI unsigned getTrampolineSize() const
Returns the trampoline size in bytes for this configuration.
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.
LLVM_ABI 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
LLVM_ABI 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.
LLVM_ABI VersionTuple getVulkanVersion() const
Parse the Vulkan version number from the OSVersion and SPIR-V version (SubArch).
LLVM_ABI 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 LLVM_ABI 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 isGPU() const
Test whether the target triple is for a GPU.
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
static LLVM_ABI StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
bool isTargetMuslAEABI() const
bool isARM() const
Tests whether the target is ARM (little and big endian).
LLVM_ABI 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 isBridgeOS() const
Is this an Apple BridgeOS triple.
bool isOSManagarm() const
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.
LLVM_ABI VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
LLVM_ABI bool isArch64Bit() const
Test whether the architecture is 64-bit.
LLVM_ABI 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
LLVM_ABI 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
static LLVM_ABI bool isValidVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns whether an OS version is invalid and would not map to an Apple OS.
bool isMacOSX() const
Is this a Mac OS X triple.
Triple(const std::string &Str)
bool isXROS() const
Is this an Apple XROS triple.
LLVM_ABI void setEnvironmentName(StringRef Str)
Set the optional environment (fourth) component of the triple by name.
LLVM_ABI void setOS(OSType Kind)
Set the operating system (third) component of the triple to a known type.
LLVM_ABI 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, DriverKit, XROS, or bridgeOS).
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
bool isSPIRVLogical() const
Tests whether the target is SPIR-V Logical.
static LLVM_ABI 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 empty() const
Whether the triple is empty / default constructed.
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.
bool isTargetAEABI() const
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).
LLVM_ABI 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 LLVM_ABI StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat)
Get the name for the Object format.
bool isAppleMachO() const
Is this an Apple MachO triple.
LLVM_ABI bool isArch16Bit() const
Test whether the architecture is 16-bit.
LLVM_ABI llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
LLVM_ABI 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.
LLVM_ABI 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 isTime64ABI() const
Tests if the target forces 64-bit time_t on a 32-bit architecture.
LLVM_ABI 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.
LLVM_ABI 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 LLVM_ABI StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
bool isOSHaiku() const
Tests whether the OS is Haiku.
LLVM_ABI 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.
LLVM_ABI 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.
Implement std::hash so that hash_code can be used in STL containers.