Helper class for working with autoconf‐style target configuration names.

Synopsis

Declared in <llvm/TargetParser/Triple.h>

class Triple;

Description

For historical reasons, we also call these 'triples' (they used to contain exactly three fields).

Configuration names are strings in the canonical form: ARCHITECTURE‐VENDOR‐OPERATING_SYSTEM or ARCHITECTURE‐VENDOR‐OPERATING_SYSTEM‐ENVIRONMENT

This class is used for clients which want to support arbitrary configuration names, but also want to implement certain special behavior for particular configurations. This class isolates the mapping from the components of the configuration name to well known IDs.

At its core the Triple class is designed to be a wrapper for a triple string; the constructor does not change or normalize the triple string. Clients that need to handle the non‐canonical triples that users often specify should use the normalize method.

See autoconf/config.guess for a glimpse into what configuration names look like in practice.

Enums

Name

Description

ArchType

Architecture type of a target triple.

CanonicalForm

Canonical form

EnvironmentType

Environment / ABI component of a target triple.

OSType

Operating system type of a target triple.

ObjectFormatType

Object file format component of a target triple.

SubArchType

Sub‐architecture type of a target triple.

VendorType

Hardware/OS vendor component of a target triple.

Member Functions

Name

Description

Triple [constructor]

Constructors

computeDataLayout

Compute the LLVM IR data layout string based on the triple. Some targets customize the layout based on the ABIName string.

empty

Whether the triple is empty / default constructed.

get32BitArchVariant

Form a triple with a 32‐bit variant of the current architecture.

get64BitArchVariant

Form a triple with a 64‐bit variant of the current architecture.

getArch

Get the parsed architecture type of this triple.

getArchName

Get the architecture (first) component of the triple.

getArchPointerBitWidth

Returns the pointer width of this architecture.

getBigEndianArchVariant

Form a triple with a big endian variant of the current architecture.

getDXILVersion

Parse the DXIL version number from the OSVersion and DXIL version (SubArch). This should only be called with DXIL triples.

getDefaultExceptionHandling

Returns the default exception‐handling model for this triple.

getDefaultFloatABI

Returns the default floating‐point ABI for this target triple, i.e. the ABI the code generator will resolve FloatABI::Default to

getDefaultLongDoubleFormat

Returns the default floating‐point format for the "long double" type. A particular module may override this default.

getDefaultWCharSize

Returns the default wchar_t size (in bytes) for this target triple.

getDriverKitVersion

Parse the version number as with getOSVersion.

getEnvironment

Get the parsed environment type of this triple.

getEnvironmentName

Get the optional environment (fourth) component of the triple, or "" if empty.

getEnvironmentVersion

Parse the version number from the OS name component of the triple, if present.

getEnvironmentVersionString

Get the version component of the environment component as a single string (the version after the environment).

getLittleEndianArchVariant

Form a triple with a little endian variant of the current architecture.

getMacOSXVersion

Parse the OS version and translate generic Darwin versions to macOS versions.

getMinimumSupportedOSVersion

Return the minimum supported OS version for this triple, if any.

getOS

Get the parsed operating system type of this triple.

getOSAndEnvironmentName

Get the operating system and optional environment components as a single string (separated by a '‐' if the environment component is present).

getOSMajorVersion

Return just the major version number, this is specialized because it is a common query.

getOSName

Get the operating system (third) component of the triple.

getOSVersion

Parse the version number from the OS name component of the triple, if present.

getObjectFormat

Get the object format for this triple.

getSubArch

get the parsed subarchitecture type for this triple.

getTrampolineSize

Returns the trampoline size in bytes for this configuration.

getTriple

Get the full triple string.

getVendor

Get the parsed vendor type of this triple.

getVendorName

Get the vendor (second) component of the triple.

getVulkanVersion

Parse the Vulkan version number from the OSVersion and SPIR‐V version (SubArch). This should only be called with Vulkan SPIR‐V triples.

getWatchOSVersion

Parse the version number as with getOSVersion. This should only be called with WatchOS or generic triples.

getiOSVersion

Parse the version number as with getOSVersion. This should only be called with IOS or generic triples.

hasDLLImportExport

Tests if the environment supports dllimport/export annotations.

hasDefaultDataSections

Tests whether the target uses ‐data‐sections as default.

hasDefaultEmulatedTLS

Tests whether the target uses emulated TLS as default.

hasDefaultTLSDESC

True if the target uses TLSDESC by default.

hasEnvironment

Does this triple have the optional environment (fourth) component?

isAArch64

isAArch64 overloads

isABIN32

True if the environment is an N32 ABI (GNU or musl).

isAMDGCN

Tests whether the target is AMDGCN True if the architecture is AMDGCN (amdgpu).

isAMDGPU

True if the architecture is AMDGPU (AMDGCN or R600).

isARM

Tests whether the target is ARM (little and big endian).

isAVR

Whether the triple is for the AVR architecture.

isAndroid

Tests whether the target is Android

isAndroidVersionLT

True if this Android target's API level is less than Major.

isAppleFirmware

Is this an Apple firmware triple.

isAppleMachO

Is this an Apple MachO triple.

isArch16Bit

Test whether the architecture is 16‐bit

isArch32Bit

Test whether the architecture is 32‐bit

isArch64Bit

Test whether the architecture is 64‐bit

isArm64e

Tests whether the target is the Apple "arm64e" AArch64 subarch.

isArmMClass

Tests whether the target is an M‐class.

isArmT32

Tests whether the target is T32.

isBPF

Tests whether the target is eBPF.

isBridgeOS

Is this an Apple BridgeOS triple.

isCSKY

Tests whether the target is CSKY.

isCompatibleWith

Test whether target triples are compatible.

isDXIL

Tests whether the target is DXIL.

isDefaultIncrementalLinkerCompatibleByDefault

Tests whether MSVC linker or UEFI targets. Used to default to ‐mincremental‐linker‐compatible if we are targeting the MSVC linker or *‐uefi triples.

isDriverKit

Is this an Apple DriverKit triple.

isGNUEnvironment

Tests whether the environment is a GNU environment.

isGPU

Test whether the target triple is for a GPU.

isHardFloatABI

Tests if the target's default floating‐point ABI is hard float.

isKnownWindowsMSVCEnvironment

Checks if the environment is MSVC.

isLFI

Tests whether the target is LFI.

isLittleEndian

Tests whether the target triple is little endian.

isLoongArch

Tests whether the target is LoongArch (32‐ and 64‐bit).

isLoongArch32

Tests whether the target is 32‐bit LoongArch.

isLoongArch64

Tests whether the target is 64‐bit LoongArch.

isMIPS

Tests whether the target is MIPS (little and big endian, 32‐ or 64‐bit).

isMIPS32

Tests whether the target is MIPS 32‐bit (little and big endian).

isMIPS64

Tests whether the target is MIPS 64‐bit (little and big endian).

isMacCatalystEnvironment

True if this is the Mac Catalyst (MacABI) environment.

isMacOSX

Is this a Mac OS X triple. For legacy reasons, we support both "darwin" and "osx" as OS X triples.

isMacOSXVersionGE

True if this Mac OS X triple's version is greater than or equal to the given version.

isMacOSXVersionLT

True if this Mac OS X triple's version is less than the given version.

isMusl

Tests whether the environment is musl‐libc

isNVPTX

Tests whether the target is NVPTX (32‐ or 64‐bit).

isOHOSFamily

Tests whether the target is OHOS LiteOS default enviroment is also OHOS, but omited on triple.

isOSAIX

Tests whether the OS is AIX.

isOSBinFormatCOFF

Tests whether the OS uses the COFF binary format.

isOSBinFormatDXContainer

Tests whether the OS uses the DXContainer binary format.

isOSBinFormatELF

Tests whether the OS uses the ELF binary format.

isOSBinFormatGOFF

Tests whether the OS uses the GOFF binary format.

isOSBinFormatMachO

Tests whether the environment is MachO.

isOSBinFormatWasm

Tests whether the OS uses the Wasm binary format.

isOSBinFormatXCOFF

Tests whether the OS uses the XCOFF binary format.

isOSCygMing

Tests for either Cygwin or MinGW OS

isOSDarwin

Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, DriverKit, XROS, or bridgeOS).

isOSDragonFly

Tests whether the OS is DragonFly BSD.

isOSEmscripten

Tests whether the OS is Emscripten.

isOSFirmware

True if this is a bare‐metal firmware OS triple.

isOSFreeBSD

Tests whether the OS is FreeBSD.

isOSFuchsia

Tests whether the OS is Fuchsia.

isOSGlibc

Tests whether the OS uses glibc.

isOSH2

Tests whether the OS is H2.

isOSHaiku

Tests whether the OS is Haiku.

isOSHurd

Tests whether the OS is Hurd.

isOSIAMCU

True if this is the Intel MCU (ELFIAMCU) OS.

isOSKFreeBSD

Tests whether the OS is kFreeBSD.

isOSLinux

Tests whether the OS is Linux.

isOSLiteOS

Tests whether the OS is LiteOS.

isOSMSVCRT

Is this a "Windows" OS targeting a "MSVCRT.dll" environment.

isOSManagarm

Tests whether the OS is Managarm.

isOSNetBSD

Tests whether the OS is NetBSD.

isOSOpenBSD

Tests whether the OS is OpenBSD.

isOSQurt

Tests whether the OS is QURT.

isOSSerenity

True if this is a Serenity OS triple.

isOSSolaris

Tests whether the OS is Solaris.

isOSUnknown

Tests whether the OS is unknown/unspecified.

isOSVersionGE

isOSVersionGE overloads

isOSVersionLT

isOSVersionLT overloads

isOSWASI

Tests whether the OS is WASI.

isOSWindows

Tests whether the OS is Windows.

isOSWindowsOrUEFI

Tests whether the OS is Windows or UEFI.

isOSzOS

True if this is a z/OS triple.

isOpenHOS

True if the environment is OpenHarmony OS (OpenHOS).

isPPC

Tests whether the target is PowerPC (32‐ or 64‐bit LE or BE).

isPPC32

Tests whether the target is 32‐bit PowerPC (little and big endian).

isPPC32SecurePlt

Tests whether the target 32‐bit PowerPC uses Secure PLT.

isPPC64

Tests whether the target is 64‐bit PowerPC (little and big endian).

isPPC64ELFv2ABI

Tests whether the target 64‐bit PowerPC big endian ABI is ELFv2.

isPS

Tests whether the target is the PS4 or PS5 platform.

isPS4

Tests whether the target is the PS4 platform.

isPS5

Tests whether the target is the PS5 platform.

isRISCV

Tests whether the target is RISC‐V (32‐ and 64‐bit).

isRISCV32

Tests whether the target is 32‐bit RISC‐V.

isRISCV64

Tests whether the target is 64‐bit RISC‐V.

isSPARC

Tests whether the target is SPARC.

isSPARC32

Tests whether the target is 32‐bit SPARC (little and big endian).

isSPARC64

Tests whether the target is 64‐bit SPARC (big endian).

isSPIR

Tests whether the target is SPIR (32‐ or 64‐bit).

isSPIROrSPIRV

Tests whether the target is SPIR‐V or SPIR.

isSPIRV

Tests whether the target is SPIR‐V (32/64‐bit/Logical).

isSPIRVLogical

Tests whether the target is SPIR‐V Logical

isShaderModelOS

True if this is a DirectX ShaderModel OS triple.

isShaderStageEnvironment

True if the environment names a DirectX/Vulkan shader stage.

isSimulatorEnvironment

True if the environment is a simulator variant (e.g. Apple Simulator).

isSystemZ

Tests whether the target is SystemZ.

isTargetAEABI

True for bare‐metal ARM EABI/EABIHF (not Darwin or Windows).

isTargetEHABICompatible

Tests whether the target supports the EHABI exception handling standard.

isTargetGNUAEABI

True if the environment is a GNU EABI variant (non‐Darwin/Windows).

isTargetMachineMac

Returns true for targets that run on a macOS machine.

isTargetMuslAEABI

True if the environment is a musl EABI or OpenHOS variant (non‐Darwin/Windows).

isThumb

Tests whether the target is Thumb (little and big endian).

isTime64ABI

Tests if the target forces 64‐bit time_t on a 32‐bit architecture.

isTvOS

Is this an Apple tvOS triple.

isUEFI

Tests whether the OS is UEFI.

isVE

Tests whether the target is VE

isVulkanOS

True if this is a Vulkan OS triple.

isWALI

Tests whether the target uses WALI Wasm

isWasm

Tests whether the target is wasm (32‐ and 64‐bit).

isWatchABI

True if this uses the Apple watchOS ABI (ARM v7k sub‐architecture).

isWatchOS

Is this an Apple watchOS triple.

isWindowsArm64EC

True if this is a Windows target using the Arm64EC ABI.

isWindowsCoreCLREnvironment

True if this is Windows targeting the CoreCLR environment.

isWindowsCygwinEnvironment

Tests whether the environment is Cygwin on Windows.

isWindowsGNUEnvironment

True if this is Windows targeting the GNU (MinGW) environment.

isWindowsItaniumEnvironment

True if this is Windows targeting the Itanium C++ ABI environment.

isWindowsMSVCEnvironment

Checks if the environment could be MSVC.

isX32

Tests whether the target is X32.

isX86

Tests whether the target is x86 (32‐ or 64‐bit).

isX86_32

Tests whether the target is x86 (32‐bit).

isX86_64

Tests whether the target is x86 (64‐bit).

isXROS

Is this an Apple XROS triple.

isiOS

True if this is an iOS (or tvOS) triple.

merge

Merge target triples.

normalize

Return the normalized form of this triple's string.

setArch

Set the architecture (first) component of the triple to a known type.

setArchName

Set the architecture (first) component of the triple by name.

setEnvironment

Set the environment (fourth) component of the triple to a known type.

setEnvironmentName

Set the optional environment (fourth) component of the triple by name.

setOS

Set the operating system (third) component of the triple to a known type.

setOSAndEnvironmentName

Set the operating system and optional environment components with a single string.

setOSName

Set the operating system (third) component of the triple by name.

setObjectFormat

Set the object file format.

setTriple

Set all components to the new triple Str.

setVendor

Set the vendor (second) component of the triple to a known type.

setVendorName

Set the vendor (second) component of the triple by name.

str

Return the full triple string.

supportsCOMDAT

Tests whether the target supports comdat

operator==

True if this triple equals Other in all typed components.

operator!=

True if this triple is not equal to Other.

operator<

Lexicographical compare of the normalized triple string against Other.

Static Member Functions

Name

Description

getArchName

Get the architecture name based on Kind and SubArch.

getArchPointerBitWidth

Returns the pointer width of this architecture.

getArchTypeForLLVMName

The canonical type for the given LLVM architecture name (e.g., "x86").

getArchTypeName

Get the canonical name for the Kind architecture.

getArchTypePrefix

Get the "prefix" canonical name for the Kind architecture. This is the prefix used by the architecture specific builtins, and is suitable for passing to

getCanonicalVersionForOS

Returns a canonicalized OS version number for the specified OS.

getEnvironmentTypeName

Get the canonical name for the Kind environment.

getOSTypeName

Get the canonical name for the Kind operating system.

getObjectFormatTypeName

Get the name for the Object format.

getVendorTypeName

Get the canonical name for the Kind vendor.

isValidVersionForOS

Returns whether an OS version is invalid and would not map to an Apple OS.

normalize

Normalize an arbitrary machine specification into a canonical triple string.

parseArch

Parse anything recognized as an architecture for the first field of the triple.

parseSubArch

Parse a sub‐architecture from the architecture field of a triple.

Non-Member Functions

Name

Description

createMCRelocationInfo

Create a default MCRelocationInfo for the given triple.

createMCSymbolizer

Create a default MCSymbolizer for the given triple.

getAddressSanitizerParams

Fill AddressSanitizer shadow‐mapping parameters for a target.

getAtomicScopeIRString

Returns the LLVM IR syncscope string that T uses to spell S.

getDefaultEHPersonality

Return the default exception‐handling personality for target T.

parseAtomicScopeIRString

Parses a target syncscope string into its abstract scope.

setGlobalVariableLargeSection

Place GV in a large section on x86‐64 ELF to ease relocation pressure.

AArch64::isX18ReservedByDefault

Return true if register X18 is reserved by default for triple TT.

AMDGPU::getCanonicalArchName

Returns the canonical architecture name for Arch under triple T.

AMDGPU::isSubArchCompatible

Return true if the subarches of triples A and B are compatible.

AMDGPU::mergeSubArch

Returns the effective triple appropriate to use when linking B into A by merging the subarches in case of inexact match.

ARM::computeDefaultTargetABI

Return the default ABI name string for triple TT.

ARM::computeTargetABI

Return the ARMABI enumerator for triple TT and optional name ABIName.

ARM::getARMCPUForArch

Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.

MachO::getCPUSubType

Map a target triple to a Mach‐O CPU subtype value.

MachO::getCPUSubType

Map a target triple to a Mach‐O CPU subtype, including arm64e ptrauth ABI bits.

MachO::getCPUType

Map a target triple to a Mach‐O CPUType value.

MachO::mapToArchitecture

Convert a target to an architecture slice.

MachO::mapToPlatformType

Map a target triple to a Mach‐O platform type.

MachO::mapToSupportedOSVersion

Map a triple to a supported OS version for TextAPI.

PPC::getNormalizedPPCTargetCPU

Return the normalized PowerPC target CPU name for T.

PPC::getNormalizedPPCTuneCPU

Return the normalized PowerPC tune CPU name for T.

PPC::getPPCDefaultTargetFeatures

Return the default target features for PowerPC CPU CPUName on triple T.

codegen::InitTargetOptionsFromCodeGenFlags

Initialize a TargetOptions object from the registered CodeGen flags.

codegen::createTargetMachineForTriple

Create a TargetMachine using the options defined on the command line.

driver::createTLII

Create a TargetLibraryInfoImpl for a target triple and vector library.

jitlink::absoluteSymbolsLinkGraph

Create a LinkGraph defining the given absolute symbols.

jitlink::getAnonymousPointerCreator

Get target‐specific AnonymousPointerCreator

jitlink::getPointerJumpStubCreator

Get target‐specific PointerJumpStubCreator

lto::getThinLTODefaultCPU

Return the default ThinLTO CPU name for the given triple.

memtag::getPC

Return the program counter value for the current insertion point.

orc::createLocalCompileCallbackManager

Create a local compile callback manager.

orc::createLocalIndirectStubsManagerBuilder

Create a local indirect stubs manager builder.

orc::createLocalLazyCallThroughManager

Create a LocalLazyCallThroughManager from the given triple and execution session.

orc::getMachOHeaderInfoFromTriple

Return MachO header info appropriate for the given target triple.

Created with MrDocs