class Triple

Declaration

class Triple { /* full declaration omitted */ };

Description

Triple - Helper class for working with autoconf configuration names. 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.

Declared at: llvm/include/llvm/ADT/Triple.h:43

Method Overview

Methods

Triple(const llvm::Twine& Str)

Declared at: llvm/include/llvm/ADT/Triple.h:263

Parameters

const llvm::Twine& Str

Triple(const llvm::Twine& ArchStr,
       const llvm::Twine& VendorStr,
       const llvm::Twine& OSStr)

Declared at: llvm/include/llvm/ADT/Triple.h:264

Parameters

const llvm::Twine& ArchStr
const llvm::Twine& VendorStr
const llvm::Twine& OSStr

Triple(const llvm::Twine& ArchStr,
       const llvm::Twine& VendorStr,
       const llvm::Twine& OSStr,
       const llvm::Twine& EnvironmentStr)

Declared at: llvm/include/llvm/ADT/Triple.h:265

Parameters

const llvm::Twine& ArchStr
const llvm::Twine& VendorStr
const llvm::Twine& OSStr
const llvm::Twine& EnvironmentStr

Triple()

Description

Default constructor is the same as an empty string and leaves all triple fields unknown.

Declared at: llvm/include/llvm/ADT/Triple.h:259

llvm::Triple get32BitArchVariant() const

Description

Form a triple with a 32-bit variant of the current architecture. This can be used to move across "families" of architectures where useful.

Declared at: llvm/include/llvm/ADT/Triple.h:810

Returns

A new triple with a 32-bit architecture or an unknown architecture if no such variant can be found.

llvm::Triple get64BitArchVariant() const

Description

Form a triple with a 64-bit variant of the current architecture. This can be used to move across "families" of architectures where useful.

Declared at: llvm/include/llvm/ADT/Triple.h:818

Returns

A new triple with a 64-bit architecture or an unknown architecture if no such variant can be found.

llvm::StringRef getARMCPUForArch(
    llvm::StringRef Arch =
        llvm::StringRef()) const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:840

Parameters

llvm::StringRef Arch = llvm::StringRef()
the architecture name (e.g., "armv7s"). If it is an empty string then the triple's arch name is used.

llvm::Triple::ArchType getArch() const

Description

getArch - Get the parsed architecture type of this triple.

Declared at: llvm/include/llvm/ADT/Triple.h:297

llvm::StringRef getArchName() const

Description

getArchName - Get the architecture (first) component of the triple.

Declared at: llvm/include/llvm/ADT/Triple.h:372

static llvm::Triple::ArchType
getArchTypeForLLVMName(llvm::StringRef Str)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:884

Parameters

llvm::StringRef Str

static llvm::StringRef getArchTypeName(
    llvm::Triple::ArchType Kind)

Description

getArchTypeName - Get the canonical name for the \p Kind architecture.

Declared at: llvm/include/llvm/ADT/Triple.h:858

Parameters

llvm::Triple::ArchType Kind

static llvm::StringRef getArchTypePrefix(
    llvm::Triple::ArchType Kind)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:866

Parameters

llvm::Triple::ArchType Kind

Returns

- The architecture prefix, or 0 if none is defined.

llvm::Triple getBigEndianArchVariant() const

Description

Form a triple with a big endian variant of the current architecture. This can be used to move across "families" of architectures where useful.

Declared at: llvm/include/llvm/ADT/Triple.h:826

Returns

A new triple with a big endian architecture or an unknown architecture if no such variant can be found.

llvm::Triple::EnvironmentType getEnvironment()
    const

Description

getEnvironment - Get the parsed environment type of this triple.

Declared at: llvm/include/llvm/ADT/Triple.h:315

llvm::StringRef getEnvironmentName() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:383

static llvm::StringRef getEnvironmentTypeName(
    llvm::Triple::EnvironmentType Kind)

Description

getEnvironmentTypeName - Get the canonical name for the \p Kind environment.

Declared at: llvm/include/llvm/ADT/Triple.h:876

Parameters

llvm::Triple::EnvironmentType Kind

void getEnvironmentVersion(
    unsigned int& Major,
    unsigned int& Minor,
    unsigned int& Micro) const

Description

Parse the version number from the OS name component of the triple, if present. For example, "fooos1.2.3" would return (1, 2, 3). If an entry is not defined, it will be returned as 0.

Declared at: llvm/include/llvm/ADT/Triple.h:323

Parameters

unsigned int& Major
unsigned int& Minor
unsigned int& Micro

llvm::Triple getLittleEndianArchVariant() const

Description

Form a triple with a little endian variant of the current architecture. This can be used to move across "families" of architectures where useful.

Declared at: llvm/include/llvm/ADT/Triple.h:834

Returns

A new triple with a little endian architecture or an unknown architecture if no such variant can be found.

bool getMacOSXVersion(unsigned int& Major,
                      unsigned int& Minor,
                      unsigned int& Micro) const

Description

getMacOSXVersion - Parse the version number as with getOSVersion and then translate generic "darwin" versions to the corresponding OS X versions. This may also be called with IOS triples but the OS X version number is just set to a constant 10.4.0 in that case. Returns true if successful.

Declared at: llvm/include/llvm/ADT/Triple.h:349

Parameters

unsigned int& Major
unsigned int& Minor
unsigned int& Micro

llvm::Triple::OSType getOS() const

Description

getOS - Get the parsed operating system type of this triple.

Declared at: llvm/include/llvm/ADT/Triple.h:306

llvm::StringRef getOSAndEnvironmentName() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:388

unsigned int getOSMajorVersion() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:339

llvm::StringRef getOSName() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:379

static llvm::StringRef getOSTypeName(
    llvm::Triple::OSType Kind)

Description

getOSTypeName - Get the canonical name for the \p Kind operating system.

Declared at: llvm/include/llvm/ADT/Triple.h:872

Parameters

llvm::Triple::OSType Kind

void getOSVersion(unsigned int& Major,
                  unsigned int& Minor,
                  unsigned int& Micro) const

Description

getOSVersion - Parse the version number from the OS name component of the triple, if present. For example, "fooos1.2.3" would return (1, 2, 3). If an entry is not defined, it will be returned as 0.

Declared at: llvm/include/llvm/ADT/Triple.h:335

Parameters

unsigned int& Major
unsigned int& Minor
unsigned int& Micro

llvm::Triple::ObjectFormatType getObjectFormat()
    const

Description

getFormat - Get the object format for this triple.

Declared at: llvm/include/llvm/ADT/Triple.h:327

llvm::Triple::SubArchType getSubArch() const

Description

getSubArch - get the parsed subarchitecture type for this triple.

Declared at: llvm/include/llvm/ADT/Triple.h:300

const std::string& getTriple() const

Declared at: llvm/include/llvm/ADT/Triple.h:368

llvm::Triple::VendorType getVendor() const

Description

getVendor - Get the parsed vendor type of this triple.

Declared at: llvm/include/llvm/ADT/Triple.h:303

llvm::StringRef getVendorName() const

Description

getVendorName - Get the vendor (second) component of the triple.

Declared at: llvm/include/llvm/ADT/Triple.h:375

static llvm::StringRef getVendorTypeName(
    llvm::Triple::VendorType Kind)

Description

getVendorTypeName - Get the canonical name for the \p Kind vendor.

Declared at: llvm/include/llvm/ADT/Triple.h:869

Parameters

llvm::Triple::VendorType Kind

void getWatchOSVersion(unsigned int& Major,
                       unsigned int& Minor,
                       unsigned int& Micro) const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:359

Parameters

unsigned int& Major
unsigned int& Minor
unsigned int& Micro

void getiOSVersion(unsigned int& Major,
                   unsigned int& Minor,
                   unsigned int& Micro) const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:354

Parameters

unsigned int& Major
unsigned int& Minor
unsigned int& Micro

bool hasDefaultEmulatedTLS() const

Description

Tests whether the target uses emulated TLS as default.

Declared at: llvm/include/llvm/ADT/Triple.h:750

bool hasEnvironment() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:310

bool isAArch64() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:705

bool isARM() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:700

bool isAndroid() const

Description

Tests whether the target is Android

Declared at: llvm/include/llvm/ADT/Triple.h:662

bool isAndroidVersionLT(unsigned int Major) const

Declared at: llvm/include/llvm/ADT/Triple.h:664

Parameters

unsigned int Major

bool isArch16Bit() const

Description

Test whether the architecture is 16-bit Note that this tests for 16-bit pointer width, and nothing else.

Declared at: llvm/include/llvm/ADT/Triple.h:411

bool isArch32Bit() const

Description

Test whether the architecture is 32-bit Note that this tests for 32-bit pointer width, and nothing else.

Declared at: llvm/include/llvm/ADT/Triple.h:406

bool isArch64Bit() const

Description

Test whether the architecture is 64-bit Note that this tests for 64-bit pointer width, and nothing else. Note that we intentionally expose only three predicates, 64-bit, 32-bit, and 16-bit. The inner details of pointer width for particular architectures is not summed up in the triple, and so only a coarse grained predicate system is provided.

Declared at: llvm/include/llvm/ADT/Triple.h:401

bool isCompatibleWith(
    const llvm::Triple& Other) const

Description

Test whether target triples are compatible.

Declared at: llvm/include/llvm/ADT/Triple.h:848

Parameters

const llvm::Triple& Other

bool isGNUEnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:522

bool isKnownWindowsMSVCEnvironment() const

Description

Checks if the environment is MSVC.

Declared at: llvm/include/llvm/ADT/Triple.h:544

bool isLittleEndian() const

Description

Tests whether the target triple is little endian.

Declared at: llvm/include/llvm/ADT/Triple.h:845

Returns

true if the triple is little endian, false otherwise.

bool isMIPS() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:720

bool isMIPS32() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:710

bool isMIPS64() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:715

bool isMacCatalystEnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:490

bool isMacOSX() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:454

bool isMacOSXVersionLT(
    unsigned int Major,
    unsigned int Minor = 0,
    unsigned int Micro = 0) const

Description

isMacOSXVersionLT - Comparison function for checking OS X version compatibility, which handles supporting skewed version numbering schemes used by the "darwin" triples.

Declared at: llvm/include/llvm/ADT/Triple.h:439

Parameters

unsigned int Major
unsigned int Minor = 0
unsigned int Micro = 0

bool isMusl() const

Description

Tests whether the environment is musl-libc

Declared at: llvm/include/llvm/ADT/Triple.h:678

bool isNVPTX() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:690

bool isOSAIX() const

Description

Tests whether the OS is AIX.

Declared at: llvm/include/llvm/ADT/Triple.h:619

bool isOSBinFormatCOFF() const

Description

Tests whether the OS uses the COFF binary format.

Declared at: llvm/include/llvm/ADT/Triple.h:629

bool isOSBinFormatELF() const

Description

Tests whether the OS uses the ELF binary format.

Declared at: llvm/include/llvm/ADT/Triple.h:624

bool isOSBinFormatMachO() const

Description

Tests whether the environment is MachO.

Declared at: llvm/include/llvm/ADT/Triple.h:634

bool isOSBinFormatWasm() const

Description

Tests whether the OS uses the Wasm binary format.

Declared at: llvm/include/llvm/ADT/Triple.h:639

bool isOSBinFormatXCOFF() const

Description

Tests whether the OS uses the XCOFF binary format.

Declared at: llvm/include/llvm/ADT/Triple.h:644

bool isOSContiki() const

Declared at: llvm/include/llvm/ADT/Triple.h:529

bool isOSCygMing() const

Description

Tests for either Cygwin or MinGW OS

Declared at: llvm/include/llvm/ADT/Triple.h:571

bool isOSDarwin() const

Description

isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).

Declared at: llvm/include/llvm/ADT/Triple.h:482

bool isOSDragonFly() const

Declared at: llvm/include/llvm/ADT/Triple.h:510

bool isOSEmscripten() const

Description

Tests whether the OS is Emscripten.

Declared at: llvm/include/llvm/ADT/Triple.h:607

bool isOSFreeBSD() const

Declared at: llvm/include/llvm/ADT/Triple.h:502

bool isOSFuchsia() const

Declared at: llvm/include/llvm/ADT/Triple.h:506

bool isOSGlibc() const

Description

Tests whether the OS uses glibc.

Declared at: llvm/include/llvm/ADT/Triple.h:612

bool isOSHaiku() const

Description

Tests whether the OS is Haiku.

Declared at: llvm/include/llvm/ADT/Triple.h:534

bool isOSHurd() const

Description

Tests whether the OS is Hurd.

Declared at: llvm/include/llvm/ADT/Triple.h:597

bool isOSIAMCU() const

Declared at: llvm/include/llvm/ADT/Triple.h:516

bool isOSKFreeBSD() const

Description

Tests whether the OS is kFreeBSD.

Declared at: llvm/include/llvm/ADT/Triple.h:592

bool isOSLinux() const

Description

Tests whether the OS is Linux.

Declared at: llvm/include/llvm/ADT/Triple.h:587

bool isOSMSVCRT() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:576

bool isOSNaCl() const

Description

Tests whether the OS is NaCl (Native Client)

Declared at: llvm/include/llvm/ADT/Triple.h:582

bool isOSNetBSD() const

Declared at: llvm/include/llvm/ADT/Triple.h:494

bool isOSOpenBSD() const

Declared at: llvm/include/llvm/ADT/Triple.h:498

bool isOSSolaris() const

Declared at: llvm/include/llvm/ADT/Triple.h:512

bool isOSUnknown() const

Declared at: llvm/include/llvm/ADT/Triple.h:520

bool isOSVersionLT(unsigned int Major,
                   unsigned int Minor = 0,
                   unsigned int Micro = 0) const

Description

isOSVersionLT - Helper function for doing comparisons against version numbers included in the target triple.

Declared at: llvm/include/llvm/ADT/Triple.h:415

Parameters

unsigned int Major
unsigned int Minor = 0
unsigned int Micro = 0

bool isOSVersionLT(
    const llvm::Triple& Other) const

Declared at: llvm/include/llvm/ADT/Triple.h:430

Parameters

const llvm::Triple& Other

bool isOSWASI() const

Description

Tests whether the OS is WASI.

Declared at: llvm/include/llvm/ADT/Triple.h:602

bool isOSWindows() const

Description

Tests whether the OS is Windows.

Declared at: llvm/include/llvm/ADT/Triple.h:539

bool isPPC64() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:725

bool isPS4() const

Description

Tests whether the target is the PS4 platform

Declared at: llvm/include/llvm/ADT/Triple.h:656

bool isPS4CPU() const

Description

Tests whether the target is the PS4 CPU

Declared at: llvm/include/llvm/ADT/Triple.h:649

bool isRISCV() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:730

bool isSPIR() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:685

bool isSimulatorEnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:486

bool isThumb() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:695

bool isTvOS() const

Description

Is this an Apple tvOS triple.

Declared at: llvm/include/llvm/ADT/Triple.h:468

bool isVE() const

Description

Tests whether the target is VE

Declared at: llvm/include/llvm/ADT/Triple.h:740

bool isWatchABI() const

Declared at: llvm/include/llvm/ADT/Triple.h:477

bool isWatchOS() const

Description

Is this an Apple watchOS triple.

Declared at: llvm/include/llvm/ADT/Triple.h:473

bool isWindowsCoreCLREnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:554

bool isWindowsCygwinEnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:562

bool isWindowsGNUEnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:566

bool isWindowsItaniumEnvironment() const

Declared at: llvm/include/llvm/ADT/Triple.h:558

bool isWindowsMSVCEnvironment() const

Description

Checks if the environment could be MSVC.

Declared at: llvm/include/llvm/ADT/Triple.h:549

bool isX86() const

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:735

bool isiOS() const

Description

Is this an iOS triple. Note: This identifies tvOS as a variant of iOS. If that ever changes, i.e., if the two operating systems diverge or their version numbers get out of sync, that will need to be changed. watchOS has completely different version numbers so it is not included.

Declared at: llvm/include/llvm/ADT/Triple.h:463

std::string merge(const llvm::Triple& Other) const

Description

Merge target triples.

Declared at: llvm/include/llvm/ADT/Triple.h:851

Parameters

const llvm::Triple& Other

std::string normalize() const

Description

Return the normalized form of this triple's string.

Declared at: llvm/include/llvm/ADT/Triple.h:290

static std::string normalize(llvm::StringRef Str)

Description

normalize - Turn an arbitrary machine specification into the canonical triple form (or something sensible that the Triple class understands if nothing better can reasonably be done). In particular, it handles the common case in which otherwise valid components are in the wrong order.

Declared at: llvm/include/llvm/ADT/Triple.h:287

Parameters

llvm::StringRef Str

void setArch(llvm::Triple::ArchType Kind)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:760

Parameters

llvm::Triple::ArchType Kind

void setArchName(llvm::StringRef Str)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:782

Parameters

llvm::StringRef Str

void setEnvironment(
    llvm::Triple::EnvironmentType Kind)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:772

Parameters

llvm::Triple::EnvironmentType Kind

void setEnvironmentName(llvm::StringRef Str)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:794

Parameters

llvm::StringRef Str

void setOS(llvm::Triple::OSType Kind)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:768

Parameters

llvm::Triple::OSType Kind

void setOSAndEnvironmentName(llvm::StringRef Str)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:798

Parameters

llvm::StringRef Str

void setOSName(llvm::StringRef Str)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:790

Parameters

llvm::StringRef Str

void setObjectFormat(
    llvm::Triple::ObjectFormatType Kind)

Description

setObjectFormat - Set the object file format

Declared at: llvm/include/llvm/ADT/Triple.h:775

Parameters

llvm::Triple::ObjectFormatType Kind

void setTriple(const llvm::Twine& Str)

Description

setTriple - Set all components to the new triple \p Str.

Declared at: llvm/include/llvm/ADT/Triple.h:778

Parameters

const llvm::Twine& Str

void setVendor(llvm::Triple::VendorType Kind)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:764

Parameters

llvm::Triple::VendorType Kind

void setVendorName(llvm::StringRef Str)

Description

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

Declared at: llvm/include/llvm/ADT/Triple.h:786

Parameters

llvm::StringRef Str

const std::string& str() const

Description

@ } @ {

Declared at: llvm/include/llvm/ADT/Triple.h:366

bool supportsCOMDAT() const

Description

Tests whether the target supports comdat

Declared at: llvm/include/llvm/ADT/Triple.h:745