Go to the documentation of this file.
9 #ifndef LLVM_ADT_TRIPLE_H
10 #define LLVM_ADT_TRIPLE_H
309 Triple() : Arch(), SubArch(), Vendor(), OS(), Environment(), ObjectFormat() {}
314 const Twine &EnvironmentStr);
317 return Arch ==
Other.Arch && SubArch ==
Other.SubArch &&
319 Environment ==
Other.Environment &&
320 ObjectFormat ==
Other.ObjectFormat;
324 return !(*
this ==
Other);
404 const std::string &
str()
const {
return Data; }
454 unsigned Micro = 0)
const {
471 unsigned Micro = 0)
const;
817 assert(PointerWidth == 64 || PointerWidth == 32);
823 : PointerWidth == 64;
void setEnvironment(EnvironmentType Kind)
Set the environment (fourth) component of the triple to a known type.
bool getMacOSXVersion(VersionTuple &Version) const
Parse the version number as with getOSVersion and then translate generic "darwin" versions to the cor...
bool isMacOSXVersionLT(unsigned Major, unsigned Minor=0, unsigned Micro=0) const
Comparison function for checking OS X version compatibility, which handles supporting skewed version ...
void setVendorName(StringRef Str)
Set the vendor (second) component of the triple by name.
StringRef getARMCPUForArch(StringRef Arch=StringRef()) const
Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
void setTriple(const Twine &Str)
Set all components to the new triple Str.
bool isPS5() const
Tests whether the target is the PS5 platform.
This is an optimization pass for GlobalISel generic memory operations.
bool isMIPS32() const
Tests whether the target is MIPS 32-bit (little and big endian).
bool isPS4() const
Tests whether the target is the PS4 platform.
bool isOSBinFormatCOFF() const
Tests whether the OS uses the COFF binary format.
@ ARMSubArch_v8m_mainline
bool isPS() const
Tests whether the target is the PS4 or PS5 platform.
bool isGNUEnvironment() const
VersionTuple getWatchOSVersion() const
Parse the version number as with getOSVersion.
unsigned getOSMajorVersion() const
Return just the major version number, this is specialized because it is a common query.
static ArchType getArchTypeForLLVMName(StringRef Str)
The canonical type for the given LLVM architecture name (e.g., "x86").
llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
bool isRISCV() const
Tests whether the target is RISC-V (32- and 64-bit).
Triple - Helper class for working with autoconf configuration names.
VersionTuple getEnvironmentVersion() const
Parse the version number from the OS name component of the triple, if present.
StringRef getOSAndEnvironmentName() const
Get the operating system and optional environment components as a single string (separated by a '-' i...
bool isDriverKit() const
Is this an Apple DriverKit triple.
bool isWindowsItaniumEnvironment() const
bool isTvOS() const
Is this an Apple tvOS triple.
VersionTuple getMinimumSupportedOSVersion() const
Some platforms have different minimum supported OS versions that varies by the architecture specified...
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
bool isOSLinux() const
Tests whether the OS is Linux.
bool hasDefaultDataSections() const
Tests whether the target uses -data-sections as default.
bool hasDefaultEmulatedTLS() const
Tests whether the target uses emulated TLS as default.
bool isNVPTX() const
Tests whether the target is NVPTX (32- or 64-bit).
std::string merge(const Triple &Other) const
Merge target triples.
bool isOSEmscripten() const
Tests whether the OS is Emscripten.
bool isOSBinFormatWasm() const
Tests whether the OS uses the Wasm binary format.
@ ARMSubArch_v8m_baseline
static VersionTuple getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version)
Returns a canonicalized OS version number for the specified OS.
void setOSAndEnvironmentName(StringRef Str)
Set the operating system and optional environment components with a single string.
bool isWindowsMSVCEnvironment() const
Checks if the environment could be MSVC.
bool isArch64Bit() const
Test whether the architecture is 64-bit.
unsigned getMajor() const
Retrieve the major version number.
@ ARMSubArch_v8_1m_mainline
bool isMacOSX() const
Is this a Mac OS X triple.
bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
bool isLittleEndian() const
Tests whether the target triple is little endian.
bool isAndroid() const
Tests whether the target is Android.
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
const std::string & str() const
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit).
VersionTuple getOSVersion() const
Parse the version number from the OS name component of the triple, if present.
bool isAArch64() const
Tests whether the target is AArch64 (little and big endian).
bool isSPARC() const
Tests whether the target is SPARC.
bool isTargetMachineMac() const
Returns true for targets that run on a macOS machine.
bool isVE() const
Tests whether the target is VE.
bool supportsCOMDAT() const
Tests whether the target supports comdat.
bool isLoongArch() const
Tests whether the target is LoongArch (32- and 64-bit).
bool isSPIRV() const
Tests whether the target is SPIR-V (32/64-bit).
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
void setVendor(VendorType Kind)
Set the vendor (second) component of the triple to a known type.
void setEnvironmentName(StringRef Str)
Set the optional environment (fourth) component of the triple by name.
ObjectFormatType getObjectFormat() const
Get the object format for this triple.
Represents a version number in the form major[.minor[.subminor[.build]]].
StringRef getArchName() const
Get the architecture (first) component of the triple.
bool isPPC32() const
Tests whether the target is 32-bit PowerPC (little and big endian).
bool isOSBinFormatGOFF() const
Tests whether the OS uses the GOFF binary format.
static StringRef getEnvironmentTypeName(EnvironmentType Kind)
Get the canonical name for the Kind environment.
bool isOSAIX() const
Tests whether the OS is AIX.
ArchType getArch() const
Get the parsed architecture type of this triple.
const std::string & getTriple() const
VersionTuple getiOSVersion() const
Parse the version number as with getOSVersion.
bool isOSNaCl() const
Tests whether the OS is NaCl (Native Client)
bool isDXIL() const
Tests whether the target is DXIL.
bool isOSMSVCRT() const
Is this a "Windows" OS targeting a "MSVCRT.dll" environment.
bool hasDLLImportExport() const
Tests if the environment supports dllimport/export annotations.
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 isAArch64(int PointerWidth) const
Tests whether the target is AArch64 and pointers are the size specified by PointerWidth.
VersionTuple getDriverKitVersion() const
Parse the version number as with getOSVersion.
bool isArmT32() const
Tests whether the target is T32.
bool isOSHaiku() const
Tests whether the OS is Haiku.
bool isTargetEHABICompatible() const
Tests whether the target supports the EHABI exception handling standard.
bool isThumb() const
Tests whether the target is Thumb (little and big endian).
bool isOSDragonFly() const
bool isARM() const
Tests whether the target is ARM (little and big endian).
bool isOSCygMing() const
Tests for either Cygwin or MinGW OS.
bool isArch16Bit() const
Test whether the architecture is 16-bit.
bool isMIPS64() const
Tests whether the target is MIPS 64-bit (little and big endian).
OSType getOS() const
Get the parsed operating system type of this triple.
std::string normalize() const
Return the normalized form of this triple's string.
bool isSPIR() const
Tests whether the target is SPIR (32- or 64-bit).
bool isArch32Bit() const
Test whether the architecture is 32-bit.
StringRef getVendorName() const
Get the vendor (second) component of the triple.
bool isOSGlibc() const
Tests whether the OS uses glibc.
bool isSimulatorEnvironment() const
@ ImaginationTechnologies
bool isOSHurd() const
Tests whether the OS is Hurd.
bool isWindowsCoreCLREnvironment() const
bool isAMDGCN() const
Tests whether the target is AMDGCN.
void setArch(ArchType Kind, SubArchType SubArch=NoSubArch)
Set the architecture (first) component of the triple to a known type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool operator!=(const Triple &Other) const
bool isPPC() const
Tests whether the target is PowerPC (32- or 64-bit LE or BE).
bool isMusl() const
Tests whether the environment is musl-libc.
StringRef - Represent a constant reference to a string, i.e.
bool isX86() const
Tests whether the target is x86 (32- or 64-bit).
bool isiOS() const
Is this an iOS triple.
bool isWatchOS() const
Is this an Apple watchOS triple.
bool isSPARC64() const
Tests whether the target is 64-bit SPARC (big endian).
bool isOSWindows() const
Tests whether the OS is Windows.
void setOS(OSType Kind)
Set the operating system (third) component of the triple to a known type.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
bool isSPARC32() const
Tests whether the target is 32-bit SPARC (little and big endian).
StringRef getOSName() const
Get the operating system (third) component of the triple.
SubArchType getSubArch() const
get the parsed subarchitecture type for this triple.
bool isOSVersionLT(const Triple &Other) const
void setOSName(StringRef Str)
Set the operating system (third) component of the triple by name.
bool isWindowsGNUEnvironment() const
Triple()
Default constructor is the same as an empty string and leaves all triple fields unknown.
static StringRef getOSTypeName(OSType Kind)
Get the canonical name for the Kind operating system.
bool isArm64e() const
Tests whether the target is the Apple "arm64e" AArch64 subarch.
bool operator==(const Triple &Other) const
static StringRef getArchTypePrefix(ArchType Kind)
Get the "prefix" canonical name for the Kind architecture.
bool isOSWASI() const
Tests whether the OS is WASI.
bool isAndroidVersionLT(unsigned Major) const
static StringRef getVendorTypeName(VendorType Kind)
Get the canonical name for the Kind vendor.
bool isMacCatalystEnvironment() const
void setArchName(StringRef Str)
Set the architecture (first) component of the triple by name.
bool hasEnvironment() const
Does this triple have the optional environment (fourth) component?
bool isX32() const
Tests whether the target is X32.
static StringRef getArchTypeName(ArchType Kind)
Get the canonical name for the Kind architecture.
EnvironmentType getEnvironment() const
Get the parsed environment type of this triple.
bool isSystemZ() const
Tests whether the target is SystemZ.
bool isMIPS() const
Tests whether the target is MIPS (little and big endian, 32- or 64-bit).
VendorType getVendor() const
Get the parsed vendor type of this triple.
llvm::Triple getBigEndianArchVariant() const
Form a triple with a big endian variant of the current architecture.
bool isWasm() const
Tests whether the target is wasm (32- and 64-bit).
llvm::Triple getLittleEndianArchVariant() const
Form a triple with a little endian variant of the current architecture.
bool isPPC64() const
Tests whether the target is 64-bit PowerPC (little and big endian).
bool isOSKFreeBSD() const
Tests whether the OS is kFreeBSD.
bool isArmMClass() const
Tests whether the target is an M-class.
bool isWindowsCygwinEnvironment() const
void setObjectFormat(ObjectFormatType Kind)
Set the object file format.
bool isKnownWindowsMSVCEnvironment() const
Checks if the environment is MSVC.
Optional< std::vector< StOtherPiece > > Other
StringRef getEnvironmentName() const
Get the optional environment (fourth) component of the triple, or "" if empty.