LLVM  16.0.0git
Public Types | Static Public Member Functions | List of all members
llvm::Triple Class Reference

Triple - Helper class for working with autoconf configuration names. More...

#include "llvm/ADT/Triple.h"

Public Types

enum  ArchType {
  UnknownArch, arm, armeb, aarch64,
  aarch64_be, aarch64_32, arc, avr,
  bpfel, bpfeb, csky, dxil,
  hexagon, loongarch32, loongarch64, m68k,
  mips, mipsel, mips64, mips64el,
  msp430, ppc, ppcle, ppc64,
  ppc64le, r600, amdgcn, riscv32,
  riscv64, sparc, sparcv9, sparcel,
  systemz, tce, tcele, thumb,
  thumbeb, x86, x86_64, xcore,
  nvptx, nvptx64, le32, le64,
  amdil, amdil64, hsail, hsail64,
  spir, spir64, spirv32, spirv64,
  kalimba, shave, lanai, wasm32,
  wasm64, renderscript32, renderscript64, ve,
  LastArchType = ve
}
 
enum  SubArchType {
  NoSubArch, ARMSubArch_v9_3a, ARMSubArch_v9_2a, ARMSubArch_v9_1a,
  ARMSubArch_v9, ARMSubArch_v8_8a, ARMSubArch_v8_7a, ARMSubArch_v8_6a,
  ARMSubArch_v8_5a, ARMSubArch_v8_4a, ARMSubArch_v8_3a, ARMSubArch_v8_2a,
  ARMSubArch_v8_1a, ARMSubArch_v8, ARMSubArch_v8r, ARMSubArch_v8m_baseline,
  ARMSubArch_v8m_mainline, ARMSubArch_v8_1m_mainline, ARMSubArch_v7, ARMSubArch_v7em,
  ARMSubArch_v7m, ARMSubArch_v7s, ARMSubArch_v7k, ARMSubArch_v7ve,
  ARMSubArch_v6, ARMSubArch_v6m, ARMSubArch_v6k, ARMSubArch_v6t2,
  ARMSubArch_v5, ARMSubArch_v5te, ARMSubArch_v4t, AArch64SubArch_arm64e,
  AArch64SubArch_arm64ec, KalimbaSubArch_v3, KalimbaSubArch_v4, KalimbaSubArch_v5,
  MipsSubArch_r6, PPCSubArch_spe, SPIRVSubArch_v10, SPIRVSubArch_v11,
  SPIRVSubArch_v12, SPIRVSubArch_v13, SPIRVSubArch_v14, SPIRVSubArch_v15
}
 
enum  VendorType {
  UnknownVendor, Apple, PC, SCEI,
  Freescale, IBM, ImaginationTechnologies, MipsTechnologies,
  NVIDIA, CSR, Myriad, AMD,
  Mesa, SUSE, OpenEmbedded, LastVendorType = OpenEmbedded
}
 
enum  OSType {
  UnknownOS, Ananas, CloudABI, Darwin,
  DragonFly, FreeBSD, Fuchsia, IOS,
  KFreeBSD, Linux, Lv2, MacOSX,
  NetBSD, OpenBSD, Solaris, Win32,
  ZOS, Haiku, Minix, RTEMS,
  NaCl, AIX, CUDA, NVCL,
  AMDHSA, PS4, PS5, ELFIAMCU,
  TvOS, WatchOS, DriverKit, Mesa3D,
  Contiki, AMDPAL, HermitCore, Hurd,
  WASI, Emscripten, ShaderModel, LastOSType = ShaderModel
}
 
enum  EnvironmentType {
  UnknownEnvironment, GNU, GNUABIN32, GNUABI64,
  GNUEABI, GNUEABIHF, GNUX32, GNUILP32,
  CODE16, EABI, EABIHF, Android,
  Musl, MuslEABI, MuslEABIHF, MuslX32,
  MSVC, Itanium, Cygnus, CoreCLR,
  Simulator, MacABI, Pixel, Vertex,
  Geometry, Hull, Domain, Compute,
  Library, RayGeneration, Intersection, AnyHit,
  ClosestHit, Miss, Callable, Mesh,
  Amplification, LastEnvironmentType = Amplification
}
 
enum  ObjectFormatType {
  UnknownObjectFormat, COFF, DXContainer, ELF,
  GOFF, MachO, SPIRV, Wasm,
  XCOFF
}
 

Public Member Functions

Constructors
 Triple ()=default
 Default constructor is the same as an empty string and leaves all triple fields unknown. More...
 
 Triple (const Twine &Str)
 Construct a triple from the string representation provided. More...
 
 Triple (const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr)
 Construct a triple from string representations of the architecture, vendor, and OS. More...
 
 Triple (const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr, const Twine &EnvironmentStr)
 Construct a triple from string representations of the architecture, vendor, OS, and environment. More...
 
bool operator== (const Triple &Other) const
 
bool operator!= (const Triple &Other) const
 
Typed Component Access
ArchType getArch () const
 Get the parsed architecture type of this triple. More...
 
SubArchType getSubArch () const
 get the parsed subarchitecture type for this triple. More...
 
VendorType getVendor () const
 Get the parsed vendor type of this triple. More...
 
OSType getOS () const
 Get the parsed operating system type of this triple. More...
 
bool hasEnvironment () const
 Does this triple have the optional environment (fourth) component? More...
 
EnvironmentType getEnvironment () const
 Get the parsed environment type of this triple. More...
 
VersionTuple getEnvironmentVersion () const
 Parse the version number from the OS name component of the triple, if present. More...
 
ObjectFormatType getObjectFormat () const
 Get the object format for this triple. More...
 
VersionTuple getOSVersion () const
 Parse the version number from the OS name component of the triple, if present. More...
 
unsigned getOSMajorVersion () const
 Return just the major version number, this is specialized because it is a common query. More...
 
bool getMacOSXVersion (VersionTuple &Version) const
 Parse the version number as with getOSVersion and then translate generic "darwin" versions to the corresponding OS X versions. More...
 
VersionTuple getiOSVersion () const
 Parse the version number as with getOSVersion. More...
 
VersionTuple getWatchOSVersion () const
 Parse the version number as with getOSVersion. More...
 
VersionTuple getDriverKitVersion () const
 Parse the version number as with getOSVersion. More...
 
Direct Component Access
const std::string & str () const
 
const std::string & getTriple () const
 
StringRef getArchName () const
 Get the architecture (first) component of the triple. More...
 
StringRef getArchName (ArchType Kind, SubArchType SubArch=NoSubArch) const
 Get the architecture name based on Kind and SubArch. More...
 
StringRef getVendorName () const
 Get the vendor (second) component of the triple. More...
 
StringRef getOSName () const
 Get the operating system (third) component of the triple. More...
 
StringRef getEnvironmentName () const
 Get the optional environment (fourth) component of the triple, or "" if empty. More...
 
StringRef getOSAndEnvironmentName () const
 Get the operating system and optional environment components as a single string (separated by a '-' if the environment component is present). More...
 
Convenience Predicates
bool isArch64Bit () const
 Test whether the architecture is 64-bit. More...
 
bool isArch32Bit () const
 Test whether the architecture is 32-bit. More...
 
bool isArch16Bit () const
 Test whether the architecture is 16-bit. More...
 
bool isOSVersionLT (unsigned Major, unsigned Minor=0, unsigned Micro=0) const
 Helper function for doing comparisons against version numbers included in the target triple. More...
 
bool isOSVersionLT (const Triple &Other) const
 
bool isMacOSXVersionLT (unsigned Major, unsigned Minor=0, unsigned Micro=0) const
 Comparison function for checking OS X version compatibility, which handles supporting skewed version numbering schemes used by the "darwin" triples. More...
 
bool isMacOSX () const
 Is this a Mac OS X triple. More...
 
bool isiOS () const
 Is this an iOS triple. More...
 
bool isTvOS () const
 Is this an Apple tvOS triple. More...
 
bool isWatchOS () const
 Is this an Apple watchOS triple. More...
 
bool isWatchABI () const
 
bool isDriverKit () const
 Is this an Apple DriverKit triple. More...
 
bool isOSzOS () const
 
bool isOSDarwin () const
 Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, or DriverKit). More...
 
bool isSimulatorEnvironment () const
 
bool isMacCatalystEnvironment () const
 
bool isTargetMachineMac () const
 Returns true for targets that run on a macOS machine. More...
 
bool isOSNetBSD () const
 
bool isOSOpenBSD () const
 
bool isOSFreeBSD () const
 
bool isOSFuchsia () const
 
bool isOSDragonFly () const
 
bool isOSSolaris () const
 
bool isOSIAMCU () const
 
bool isOSUnknown () const
 
bool isGNUEnvironment () const
 
bool isOSContiki () const
 
bool isOSHaiku () const
 Tests whether the OS is Haiku. More...
 
bool isOSWindows () const
 Tests whether the OS is Windows. More...
 
bool isKnownWindowsMSVCEnvironment () const
 Checks if the environment is MSVC. More...
 
bool isWindowsMSVCEnvironment () const
 Checks if the environment could be MSVC. More...
 
bool isWindowsArm64EC () const
 
bool isWindowsCoreCLREnvironment () const
 
bool isWindowsItaniumEnvironment () const
 
bool isWindowsCygwinEnvironment () const
 
bool isWindowsGNUEnvironment () const
 
bool isOSCygMing () const
 Tests for either Cygwin or MinGW OS. More...
 
bool isOSMSVCRT () const
 Is this a "Windows" OS targeting a "MSVCRT.dll" environment. More...
 
bool isOSNaCl () const
 Tests whether the OS is NaCl (Native Client) More...
 
bool isOSLinux () const
 Tests whether the OS is Linux. More...
 
bool isOSKFreeBSD () const
 Tests whether the OS is kFreeBSD. More...
 
bool isOSHurd () const
 Tests whether the OS is Hurd. More...
 
bool isOSWASI () const
 Tests whether the OS is WASI. More...
 
bool isOSEmscripten () const
 Tests whether the OS is Emscripten. More...
 
bool isOSGlibc () const
 Tests whether the OS uses glibc. More...
 
bool isOSAIX () const
 Tests whether the OS is AIX. More...
 
bool isOSBinFormatELF () const
 Tests whether the OS uses the ELF binary format. More...
 
bool isOSBinFormatCOFF () const
 Tests whether the OS uses the COFF binary format. More...
 
bool isOSBinFormatGOFF () const
 Tests whether the OS uses the GOFF binary format. More...
 
bool isOSBinFormatMachO () const
 Tests whether the environment is MachO. More...
 
bool isOSBinFormatWasm () const
 Tests whether the OS uses the Wasm binary format. More...
 
bool isOSBinFormatXCOFF () const
 Tests whether the OS uses the XCOFF binary format. More...
 
bool isOSBinFormatDXContainer () const
 Tests whether the OS uses the DXContainer binary format. More...
 
bool isPS4 () const
 Tests whether the target is the PS4 platform. More...
 
bool isPS5 () const
 Tests whether the target is the PS5 platform. More...
 
bool isPS () const
 Tests whether the target is the PS4 or PS5 platform. More...
 
bool isAndroid () const
 Tests whether the target is Android. More...
 
bool isAndroidVersionLT (unsigned Major) const
 
bool isMusl () const
 Tests whether the environment is musl-libc. More...
 
bool isDXIL () const
 Tests whether the target is DXIL. More...
 
bool isSPIR () const
 Tests whether the target is SPIR (32- or 64-bit). More...
 
bool isSPIRV () const
 Tests whether the target is SPIR-V (32/64-bit). More...
 
bool isNVPTX () const
 Tests whether the target is NVPTX (32- or 64-bit). More...
 
bool isAMDGCN () const
 Tests whether the target is AMDGCN. More...
 
bool isAMDGPU () const
 
bool isThumb () const
 Tests whether the target is Thumb (little and big endian). More...
 
bool isARM () const
 Tests whether the target is ARM (little and big endian). More...
 
bool isTargetEHABICompatible () const
 Tests whether the target supports the EHABI exception handling standard. More...
 
bool isArmT32 () const
 Tests whether the target is T32. More...
 
bool isArmMClass () const
 Tests whether the target is an M-class. More...
 
bool isAArch64 () const
 Tests whether the target is AArch64 (little and big endian). More...
 
bool isAArch64 (int PointerWidth) const
 Tests whether the target is AArch64 and pointers are the size specified by PointerWidth. More...
 
bool isLoongArch () const
 Tests whether the target is LoongArch (32- and 64-bit). More...
 
bool isMIPS32 () const
 Tests whether the target is MIPS 32-bit (little and big endian). More...
 
bool isMIPS64 () const
 Tests whether the target is MIPS 64-bit (little and big endian). More...
 
bool isMIPS () const
 Tests whether the target is MIPS (little and big endian, 32- or 64-bit). More...
 
bool isPPC () const
 Tests whether the target is PowerPC (32- or 64-bit LE or BE). More...
 
bool isPPC32 () const
 Tests whether the target is 32-bit PowerPC (little and big endian). More...
 
bool isPPC64 () const
 Tests whether the target is 64-bit PowerPC (little and big endian). More...
 
bool isRISCV32 () const
 Tests whether the target is 32-bit RISC-V. More...
 
bool isRISCV64 () const
 Tests whether the target is 64-bit RISC-V. More...
 
bool isRISCV () const
 Tests whether the target is RISC-V (32- and 64-bit). More...
 
bool isSPARC32 () const
 Tests whether the target is 32-bit SPARC (little and big endian). More...
 
bool isSPARC64 () const
 Tests whether the target is 64-bit SPARC (big endian). More...
 
bool isSPARC () const
 Tests whether the target is SPARC. More...
 
bool isSystemZ () const
 Tests whether the target is SystemZ. More...
 
bool isX86 () const
 Tests whether the target is x86 (32- or 64-bit). More...
 
bool isVE () const
 Tests whether the target is VE. More...
 
bool isWasm () const
 Tests whether the target is wasm (32- and 64-bit). More...
 
bool isCSKY () const
 
bool isArm64e () const
 Tests whether the target is the Apple "arm64e" AArch64 subarch. More...
 
bool isX32 () const
 Tests whether the target is X32. More...
 
bool supportsCOMDAT () const
 Tests whether the target supports comdat. More...
 
bool hasDefaultEmulatedTLS () const
 Tests whether the target uses emulated TLS as default. More...
 
bool hasDefaultDataSections () const
 Tests whether the target uses -data-sections as default. More...
 
bool hasDLLImportExport () const
 Tests if the environment supports dllimport/export annotations. More...
 
Mutators
void setArch (ArchType Kind, SubArchType SubArch=NoSubArch)
 Set the architecture (first) component of the triple to a known type. More...
 
void setVendor (VendorType Kind)
 Set the vendor (second) component of the triple to a known type. More...
 
void setOS (OSType Kind)
 Set the operating system (third) component of the triple to a known type. More...
 
void setEnvironment (EnvironmentType Kind)
 Set the environment (fourth) component of the triple to a known type. More...
 
void setObjectFormat (ObjectFormatType Kind)
 Set the object file format. More...
 
void setTriple (const Twine &Str)
 Set all components to the new triple Str. More...
 
void setArchName (StringRef Str)
 Set the architecture (first) component of the triple by name. More...
 
void setVendorName (StringRef Str)
 Set the vendor (second) component of the triple by name. More...
 
void setOSName (StringRef Str)
 Set the operating system (third) component of the triple by name. More...
 
void setEnvironmentName (StringRef Str)
 Set the optional environment (fourth) component of the triple by name. More...
 
void setOSAndEnvironmentName (StringRef Str)
 Set the operating system and optional environment components with a single string. More...
 
Helpers to build variants of a particular triple.
llvm::Triple get32BitArchVariant () const
 Form a triple with a 32-bit variant of the current architecture. More...
 
llvm::Triple get64BitArchVariant () const
 Form a triple with a 64-bit variant of the current architecture. More...
 
llvm::Triple getBigEndianArchVariant () const
 Form a triple with a big endian variant of the current architecture. More...
 
llvm::Triple getLittleEndianArchVariant () const
 Form a triple with a little endian variant of the current architecture. More...
 
StringRef getARMCPUForArch (StringRef Arch=StringRef()) const
 Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting. More...
 
bool isLittleEndian () const
 Tests whether the target triple is little endian. More...
 
bool isCompatibleWith (const Triple &Other) const
 Test whether target triples are compatible. More...
 
std::string merge (const Triple &Other) const
 Merge target triples. More...
 
VersionTuple getMinimumSupportedOSVersion () const
 Some platforms have different minimum supported OS versions that varies by the architecture specified in the triple. More...
 

Static Public Member Functions

static VersionTuple getCanonicalVersionForOS (OSType OSKind, const VersionTuple &Version)
 Returns a canonicalized OS version number for the specified OS. More...
 
Static helpers for IDs.
static StringRef getArchTypeName (ArchType Kind)
 Get the canonical name for the Kind architecture. More...
 
static StringRef getArchTypePrefix (ArchType Kind)
 Get the "prefix" canonical name for the Kind architecture. More...
 
static StringRef getVendorTypeName (VendorType Kind)
 Get the canonical name for the Kind vendor. More...
 
static StringRef getOSTypeName (OSType Kind)
 Get the canonical name for the Kind operating system. More...
 
static StringRef getEnvironmentTypeName (EnvironmentType Kind)
 Get the canonical name for the Kind environment. More...
 
Static helpers for converting alternate architecture names.
static ArchType getArchTypeForLLVMName (StringRef Str)
 The canonical type for the given LLVM architecture name (e.g., "x86"). More...
 

Normalization

std::string normalize () const
 Return the normalized form of this triple's string. More...
 
static std::string normalize (StringRef Str)
 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). More...
 

Detailed 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.

Definition at line 44 of file Triple.h.

Member Enumeration Documentation

◆ ArchType

Enumerator
UnknownArch 
arm 
armeb 
aarch64 
aarch64_be 
aarch64_32 
arc 
avr 
bpfel 
bpfeb 
csky 
dxil 
hexagon 
loongarch32 
loongarch64 
m68k 
mips 
mipsel 
mips64 
mips64el 
msp430 
ppc 
ppcle 
ppc64 
ppc64le 
r600 
amdgcn 
riscv32 
riscv64 
sparc 
sparcv9 
sparcel 
systemz 
tce 
tcele 
thumb 
thumbeb 
x86 
x86_64 
xcore 
nvptx 
nvptx64 
le32 
le64 
amdil 
amdil64 
hsail 
hsail64 
spir 
spir64 
spirv32 
spirv64 
kalimba 
shave 
lanai 
wasm32 
wasm64 
renderscript32 
renderscript64 
ve 
LastArchType 

Definition at line 46 of file Triple.h.

◆ EnvironmentType

Enumerator
UnknownEnvironment 
GNU 
GNUABIN32 
GNUABI64 
GNUEABI 
GNUEABIHF 
GNUX32 
GNUILP32 
CODE16 
EABI 
EABIHF 
Android 
Musl 
MuslEABI 
MuslEABIHF 
MuslX32 
MSVC 
Itanium 
Cygnus 
CoreCLR 
Simulator 
MacABI 
Pixel 
Vertex 
Geometry 
Hull 
Domain 
Compute 
Library 
RayGeneration 
Intersection 
AnyHit 
ClosestHit 
Miss 
Callable 
Mesh 
Amplification 
LastEnvironmentType 

Definition at line 225 of file Triple.h.

◆ ObjectFormatType

Enumerator
UnknownObjectFormat 
COFF 
DXContainer 
ELF 
GOFF 
MachO 
SPIRV 
Wasm 
XCOFF 

Definition at line 270 of file Triple.h.

◆ OSType

Enumerator
UnknownOS 
Ananas 
CloudABI 
Darwin 
DragonFly 
FreeBSD 
Fuchsia 
IOS 
KFreeBSD 
Linux 
Lv2 
MacOSX 
NetBSD 
OpenBSD 
Solaris 
Win32 
ZOS 
Haiku 
Minix 
RTEMS 
NaCl 
AIX 
CUDA 
NVCL 
AMDHSA 
PS4 
PS5 
ELFIAMCU 
TvOS 
WatchOS 
DriverKit 
Mesa3D 
Contiki 
AMDPAL 
HermitCore 
Hurd 
WASI 
Emscripten 
ShaderModel 
LastOSType 

Definition at line 182 of file Triple.h.

◆ SubArchType

Enumerator
NoSubArch 
ARMSubArch_v9_3a 
ARMSubArch_v9_2a 
ARMSubArch_v9_1a 
ARMSubArch_v9 
ARMSubArch_v8_8a 
ARMSubArch_v8_7a 
ARMSubArch_v8_6a 
ARMSubArch_v8_5a 
ARMSubArch_v8_4a 
ARMSubArch_v8_3a 
ARMSubArch_v8_2a 
ARMSubArch_v8_1a 
ARMSubArch_v8 
ARMSubArch_v8r 
ARMSubArch_v8m_baseline 
ARMSubArch_v8m_mainline 
ARMSubArch_v8_1m_mainline 
ARMSubArch_v7 
ARMSubArch_v7em 
ARMSubArch_v7m 
ARMSubArch_v7s 
ARMSubArch_v7k 
ARMSubArch_v7ve 
ARMSubArch_v6 
ARMSubArch_v6m 
ARMSubArch_v6k 
ARMSubArch_v6t2 
ARMSubArch_v5 
ARMSubArch_v5te 
ARMSubArch_v4t 
AArch64SubArch_arm64e 
AArch64SubArch_arm64ec 
KalimbaSubArch_v3 
KalimbaSubArch_v4 
KalimbaSubArch_v5 
MipsSubArch_r6 
PPCSubArch_spe 
SPIRVSubArch_v10 
SPIRVSubArch_v11 
SPIRVSubArch_v12 
SPIRVSubArch_v13 
SPIRVSubArch_v14 
SPIRVSubArch_v15 

Definition at line 110 of file Triple.h.

◆ VendorType

Enumerator
UnknownVendor 
Apple 
PC 
SCEI 
Freescale 
IBM 
ImaginationTechnologies 
MipsTechnologies 
NVIDIA 
CSR 
Myriad 
AMD 
Mesa 
SUSE 
OpenEmbedded 
LastVendorType 

Definition at line 163 of file Triple.h.

Constructor & Destructor Documentation

◆ Triple() [1/4]

llvm::Triple::Triple ( )
default

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

Referenced by setArchName(), and setTriple().

◆ Triple() [2/4]

Triple::Triple ( const Twine Str)
explicit

Construct a triple from the string representation provided.

This stores the string representation and parses the various pieces into enum members.

Definition at line 872 of file Triple.cpp.

References llvm::StringSwitch< T, R >::Cases(), llvm::StringSwitch< T, R >::Default(), getDefaultFormat(), GNU, GNUABI64, GNUABIN32, parseArch(), parseEnvironment(), parseFormat(), parseOS(), parseSubArch(), parseVendor(), llvm::StringRef::split(), llvm::StringSwitch< T, R >::StartsWith(), UnknownEnvironment, and UnknownObjectFormat.

◆ Triple() [3/4]

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

Construct a triple from string representations of the architecture, vendor, and OS.

This joins each argument into a canonical string representation and parses them into enum members. It leaves the environment unknown and omits it from the string representation.

Definition at line 912 of file Triple.cpp.

References getDefaultFormat().

◆ Triple() [4/4]

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

Construct a triple from string representations of the architecture, vendor, OS, and environment.

This joins each argument into a canonical string representation and parses them into enum members.

Definition at line 927 of file Triple.cpp.

References getDefaultFormat(), and UnknownObjectFormat.

Member Function Documentation

◆ get32BitArchVariant()

Triple Triple::get32BitArchVariant ( ) const

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

This can be used to move across "families" of architectures where useful.

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

Definition at line 1459 of file Triple.cpp.

References aarch64, aarch64_32, aarch64_be, amdgcn, amdil, amdil64, arc, arm, armeb, avr, bpfeb, bpfel, csky, dxil, getArch(), getSubArch(), hexagon, hsail, hsail64, kalimba, lanai, le32, le64, loongarch32, loongarch64, m68k, mips, mips64, mips64el, mipsel, msp430, nvptx, nvptx64, ppc, ppc64, ppc64le, ppcle, r600, renderscript32, renderscript64, riscv32, riscv64, shave, sparc, sparcel, sparcv9, spir, spir64, spirv32, spirv64, systemz, tce, tcele, thumb, thumbeb, UnknownArch, ve, wasm32, wasm64, x86, x86_64, and xcore.

Referenced by llvm::sys::getProcessTriple().

◆ get64BitArchVariant()

Triple Triple::get64BitArchVariant ( ) const

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

This can be used to move across "families" of architectures where useful.

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

Definition at line 1538 of file Triple.cpp.

References aarch64, aarch64_32, aarch64_be, amdgcn, amdil, amdil64, arc, arm, armeb, avr, bpfeb, bpfel, csky, dxil, getArch(), getSubArch(), hexagon, hsail, hsail64, kalimba, lanai, le32, le64, loongarch32, loongarch64, m68k, mips, mips64, mips64el, mipsel, msp430, nvptx, nvptx64, ppc, ppc64, ppc64le, ppcle, r600, renderscript32, renderscript64, riscv32, riscv64, shave, sparc, sparcel, sparcv9, spir, spir64, spirv32, spirv64, systemz, tce, tcele, thumb, thumbeb, UnknownArch, ve, wasm32, wasm64, x86, x86_64, and xcore.

Referenced by llvm::sys::getProcessTriple().

◆ getArch()

ArchType llvm::Triple::getArch ( ) const
inline

Get the parsed architecture type of this triple.

Definition at line 346 of file Triple.h.

Referenced by llvm::AMDGPUPassConfig::addCodeGenPrepare(), llvm::AMDGPUPassConfig::addIRPasses(), adjustInlineAsm(), llvm::ARMELFMCAsmInfo::ARMELFMCAsmInfo(), llvm::ARMMCAsmInfoDarwin::ARMMCAsmInfoDarwin(), llvm::CodeViewDebug::beginModule(), createAArch64MCAsmInfo(), createPPCMCAsmInfo(), CreateVarArgHelper(), createX86MCAsmInfo(), llvm::X86_MC::X86MCInstrAnalysis::findPltEntries(), llvm::AMDGPUSubtarget::get(), get32BitArchVariant(), get64BitArchVariant(), getBigEndianArchVariant(), getBitcodeFileMachine(), llvm::SubtargetFeatures::getDefaultSubtargetFeatures(), getiOSVersion(), getLittleEndianArchVariant(), llvm::AMDGPUMCAsmInfo::getMaxInstLength(), llvm::AMDGPU::IsaInfo::getMaxWorkGroupsPerCU(), llvm::AMDGPU::getMCReg(), getMinimumSupportedOSVersion(), getShadowMapping(), llvm::getSubDirectoryPath(), llvm::TargetLoweringObjectFileELF::Initialize(), isAArch64(), isAMDGCN(), isAMDGPU(), isArch16Bit(), isArch32Bit(), isArch64Bit(), isARM(), isArm64e(), isCompatibleWith(), isCSKY(), isDXIL(), llvm::AMDGPUSubtarget::isGCN(), isLittleEndian(), isLoongArch(), isMIPS32(), isMIPS64(), isNVPTX(), isPPC(), isPPC32(), isPPC64(), isPS4(), isPS5(), isRISCV32(), isRISCV64(), isSPARC32(), isSPARC64(), isSPIR(), isSPIRV(), isSystemZ(), isThumb(), isVE(), isWasm(), isWindowsArm64EC(), isX86(), llvm::TargetRegistry::lookupTarget(), llvm::MipsTargetELFStreamer::MipsTargetELFStreamer(), llvm::NVPTXMCAsmInfo::NVPTXMCAsmInfo(), llvm::omp::OMPContext::OMPContext(), llvm::ifs::parseTriple(), llvm::orc::LLJITBuilderState::prepareForConstruction(), AMDGPUDAGToDAGISel::SelectBuildVector(), llvm::FastISel::selectXRayCustomEvent(), llvm::FastISel::selectXRayTypedEvent(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::shouldBuildRelLookupTables(), llvm::SparcELFMCAsmInfo::SparcELFMCAsmInfo(), llvm::DwarfCompileUnit::updateSubprogramScopeDIE(), llvm::X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(), and llvm::X86MCAsmInfoMicrosoft::X86MCAsmInfoMicrosoft().

◆ getArchName() [1/2]

StringRef Triple::getArchName ( ) const

Get the architecture (first) component of the triple.

Definition at line 1130 of file Triple.cpp.

References llvm::StringRef::split().

Referenced by getARMCPUForArch(), setArch(), setEnvironmentName(), setOSAndEnvironmentName(), setOSName(), setVendorName(), and llvm::ThinLTOCodeGenerator::writeGeneratedObject().

◆ getArchName() [2/2]

StringRef Triple::getArchName ( ArchType  Kind,
SubArchType  SubArch = NoSubArch 
) const

Get the architecture name based on Kind and SubArch.

Definition at line 1134 of file Triple.cpp.

References getArchTypeName(), mips, mips64, mips64el, mipsel, and MipsSubArch_r6.

◆ getArchTypeForLLVMName()

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

◆ getArchTypeName()

StringRef Triple::getArchTypeName ( ArchType  Kind)
static

◆ getArchTypePrefix()

StringRef Triple::getArchTypePrefix ( ArchType  Kind)
static

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

See also
Intrinsic::getIntrinsicForClangBuiltin().
Returns
- The architecture prefix, or 0 if none is defined.

Definition at line 90 of file Triple.cpp.

References aarch64, aarch64_32, aarch64_be, amdgcn, amdil, amdil64, arc, arm, armeb, avr, bpfeb, bpfel, csky, dxil, hexagon, hsail, hsail64, kalimba, lanai, le32, le64, loongarch32, loongarch64, m68k, mips, mips64, mips64el, mipsel, nvptx, nvptx64, ppc, ppc64, ppc64le, ppcle, r600, riscv32, riscv64, shave, sparc, sparcel, sparcv9, spir, spir64, spirv32, spirv64, systemz, thumb, thumbeb, ve, wasm32, wasm64, x86, x86_64, and xcore.

◆ getARMCPUForArch()

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

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

Parameters
Archthe architecture name (e.g., "armv7s"). If it is an empty string then the triple's arch name is used.

Definition at line 1856 of file Triple.cpp.

References DriverKit, EABI, EABIHF, llvm::StringRef::empty(), llvm::StringRef::equals(), FreeBSD, getArchName(), llvm::ARM::getCanonicalArchName(), llvm::ARM::getDefaultCPU(), getEnvironment(), getOS(), GNUEABI, GNUEABIHF, IOS, llvm_unreachable, MacOSX, MuslEABIHF, NaCl, NetBSD, OpenBSD, llvm::ARM::parseArchVersion(), TvOS, WatchOS, and Win32.

◆ getBigEndianArchVariant()

Triple Triple::getBigEndianArchVariant ( ) const

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

This can be used to move across "families" of architectures where useful.

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

Definition at line 1617 of file Triple.cpp.

References aarch64, aarch64_be, amdgcn, amdil, amdil64, arm, avr, bpfeb, bpfel, csky, dxil, getArch(), getSubArch(), hexagon, hsail, hsail64, isLittleEndian(), kalimba, le32, le64, llvm_unreachable, loongarch32, loongarch64, mips, mips64, mips64el, mipsel, msp430, nvptx, nvptx64, ppc, ppc64, ppc64le, ppcle, r600, renderscript32, renderscript64, riscv32, riscv64, shave, sparc, sparcel, spir, spir64, spirv32, spirv64, tce, tcele, thumb, UnknownArch, ve, wasm32, wasm64, x86, x86_64, and xcore.

◆ getCanonicalVersionForOS()

VersionTuple Triple::getCanonicalVersionForOS ( OSType  OSKind,
const VersionTuple Version 
)
static

Returns a canonicalized OS version number for the specified OS.

Definition at line 1925 of file Triple.cpp.

References MacOSX, and llvm::IndexedInstrProf::Version.

◆ getDriverKitVersion()

VersionTuple Triple::getDriverKitVersion ( ) const

Parse the version number as with getOSVersion.

Definition at line 1298 of file Triple.cpp.

References DriverKit, getOS(), getOSVersion(), llvm_unreachable, and llvm::IndexedInstrProf::Version.

◆ getEnvironment()

EnvironmentType llvm::Triple::getEnvironment ( ) const
inline

◆ getEnvironmentName()

StringRef Triple::getEnvironmentName ( ) const

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

Definition at line 1169 of file Triple.cpp.

References llvm::StringRef::split().

Referenced by getEnvironmentVersion(), hasEnvironment(), and setOSName().

◆ getEnvironmentTypeName()

StringRef Triple::getEnvironmentTypeName ( EnvironmentType  Kind)
static

◆ getEnvironmentVersion()

VersionTuple Triple::getEnvironmentVersion ( ) const

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

For example, "fooos1.2.3" would return (1, 2, 3).

Definition at line 1186 of file Triple.cpp.

References getEnvironment(), getEnvironmentName(), getEnvironmentTypeName(), parseVersionFromName(), llvm::StringRef::size(), llvm::StringRef::startswith(), and llvm::StringRef::substr().

Referenced by isAndroidVersionLT().

◆ getiOSVersion()

VersionTuple Triple::getiOSVersion ( ) const

Parse the version number as with getOSVersion.

This should only be called with IOS or generic triples.

Definition at line 1250 of file Triple.cpp.

References aarch64, Darwin, DriverKit, getArch(), getOS(), getOSVersion(), IOS, llvm_unreachable, MacOSX, TvOS, llvm::IndexedInstrProf::Version, and WatchOS.

Referenced by llvm::AArch64Subtarget::supportsAddressTopByteIgnored().

◆ getLittleEndianArchVariant()

Triple Triple::getLittleEndianArchVariant ( ) const

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

This can be used to move across "families" of architectures where useful.

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

Definition at line 1683 of file Triple.cpp.

References aarch64, aarch64_be, armeb, bpfeb, bpfel, getArch(), getSubArch(), isLittleEndian(), lanai, llvm_unreachable, m68k, mips, mips64, mips64el, mipsel, ppc, ppc64, ppc64le, ppcle, sparc, sparcel, sparcv9, systemz, tce, tcele, thumbeb, and UnknownArch.

◆ getMacOSXVersion()

bool Triple::getMacOSXVersion ( VersionTuple Version) const

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.

Definition at line 1207 of file Triple.cpp.

References Darwin, DriverKit, getOS(), getOSVersion(), IOS, llvm_unreachable, MacOSX, TvOS, llvm::IndexedInstrProf::Version, and WatchOS.

◆ getMinimumSupportedOSVersion()

VersionTuple Triple::getMinimumSupportedOSVersion ( ) const

Some platforms have different minimum supported OS versions that varies by the architecture specified in the triple.

This function returns the minimum supported OS version for this triple if one an exists, or an invalid version tuple if this triple doesn't have one.

Definition at line 1822 of file Triple.cpp.

References aarch64, Apple, DriverKit, getArch(), getOS(), getVendor(), IOS, isArm64e(), isMacCatalystEnvironment(), isSimulatorEnvironment(), MacOSX, TvOS, and WatchOS.

◆ getObjectFormat()

ObjectFormatType llvm::Triple::getObjectFormat ( ) const
inline

◆ getOS()

OSType llvm::Triple::getOS ( ) const
inline

Get the parsed operating system type of this triple.

Definition at line 355 of file Triple.h.

Referenced by llvm::AMDGPUAsmPrinter::AMDGPUAsmPrinter(), llvm::ARMELFMCAsmInfo::ARMELFMCAsmInfo(), llvm::createAArch64beAsmBackend(), llvm::createAArch64leAsmBackend(), createARMAsmBackend(), llvm::createAVRAsmBackend(), llvm::createM68kAsmBackend(), llvm::createSparcAsmBackend(), llvm::createSystemZMCAsmBackend(), llvm::createVEAsmBackend(), llvm::createX86_32AsmBackend(), llvm::createX86_64AsmBackend(), llvm::AMDGPUAsmPrinter::doFinalization(), llvm::AMDGPUAsmPrinter::emitEndOfAsmFile(), llvm::AMDGPUAsmPrinter::emitFunctionBodyEnd(), llvm::AMDGPUAsmPrinter::emitFunctionEntryLabel(), llvm::AMDGPUAsmPrinter::emitGlobalVariable(), getARMCPUForArch(), getDriverKitVersion(), llvm::AMDGPUSubtarget::getExplicitKernelArgOffset(), llvm::AMDGPU::getHsaAbiVersion(), getiOSVersion(), getMacOSXVersion(), getMinimumSupportedOSVersion(), getOSVersion(), getWatchOSVersion(), llvm::AMDGPUSubtarget::isAmdHsaOS(), llvm::AMDGPUSubtarget::isAmdPalOS(), isCompatibleWith(), isDriverKit(), isiOS(), isMacOSX(), isMacOSXVersionLT(), llvm::AMDGPUSubtarget::isMesa3DOS(), isOSAIX(), isOSContiki(), isOSDragonFly(), isOSEmscripten(), isOSFreeBSD(), isOSFuchsia(), isOSGlibc(), isOSHaiku(), isOSHurd(), isOSIAMCU(), isOSKFreeBSD(), isOSLinux(), isOSNaCl(), isOSNetBSD(), isOSOpenBSD(), isOSSolaris(), isOSUnknown(), isOSWASI(), isOSWindows(), isOSzOS(), isPS4(), isPS5(), isTvOS(), isWatchOS(), and llvm::SITargetLowering::shouldUseLDSConstAddress().

◆ getOSAndEnvironmentName()

StringRef Triple::getOSAndEnvironmentName ( ) const

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

Definition at line 1175 of file Triple.cpp.

References llvm::StringRef::split().

Referenced by setArchName(), and setVendorName().

◆ getOSMajorVersion()

unsigned llvm::Triple::getOSMajorVersion ( ) const
inline

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

Definition at line 382 of file Triple.h.

References llvm::VersionTuple::getMajor(), and getOSVersion().

◆ getOSName()

StringRef Triple::getOSName ( ) const

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

Definition at line 1163 of file Triple.cpp.

References llvm::StringRef::split().

Referenced by getOSVersion(), and setEnvironmentName().

◆ getOSTypeName()

StringRef Triple::getOSTypeName ( OSType  Kind)
static

Get the canonical name for the Kind operating system.

Definition at line 200 of file Triple.cpp.

References AIX, AMDHSA, AMDPAL, Ananas, CloudABI, Contiki, CUDA, Darwin, DragonFly, DriverKit, ELFIAMCU, Emscripten, FreeBSD, Fuchsia, Haiku, HermitCore, Hurd, IOS, KFreeBSD, Linux, llvm_unreachable, Lv2, MacOSX, Mesa3D, Minix, NaCl, NetBSD, NVCL, OpenBSD, PS4, PS5, RTEMS, ShaderModel, Solaris, TvOS, UnknownOS, WASI, WatchOS, Win32, and ZOS.

Referenced by getOSVersion(), and setOS().

◆ getOSVersion()

VersionTuple Triple::getOSVersion ( ) const

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

For example, "fooos1.2.3" would return (1, 2, 3).

Definition at line 1195 of file Triple.cpp.

References llvm::StringRef::consume_front(), getOS(), getOSName(), getOSTypeName(), MacOSX, parseVersionFromName(), llvm::StringRef::size(), llvm::StringRef::startswith(), and llvm::StringRef::substr().

Referenced by getDriverKitVersion(), getiOSVersion(), getMacOSXVersion(), getOSMajorVersion(), getWatchOSVersion(), and isOSVersionLT().

◆ getSubArch()

SubArchType llvm::Triple::getSubArch ( ) const
inline

◆ getTriple()

const std::string& llvm::Triple::getTriple ( ) const
inline

◆ getVendor()

VendorType llvm::Triple::getVendor ( ) const
inline

Get the parsed vendor type of this triple.

Definition at line 352 of file Triple.h.

Referenced by llvm::SubtargetFeatures::getDefaultSubtargetFeatures(), getMinimumSupportedOSVersion(), isCompatibleWith(), isPS4(), isPS5(), and merge().

◆ getVendorName()

StringRef Triple::getVendorName ( ) const

Get the vendor (second) component of the triple.

Definition at line 1158 of file Triple.cpp.

References llvm::StringRef::split().

Referenced by setArchName(), setEnvironmentName(), setOSAndEnvironmentName(), and setOSName().

◆ getVendorTypeName()

StringRef Triple::getVendorTypeName ( VendorType  Kind)
static

Get the canonical name for the Kind vendor.

Definition at line 177 of file Triple.cpp.

References AMD, Apple, CSR, Freescale, IBM, ImaginationTechnologies, llvm_unreachable, Mesa, MipsTechnologies, Myriad, NVIDIA, OpenEmbedded, PC, SCEI, SUSE, and UnknownVendor.

Referenced by setVendor().

◆ getWatchOSVersion()

VersionTuple Triple::getWatchOSVersion ( ) const

Parse the version number as with getOSVersion.

This should only be called with WatchOS or generic triples.

Definition at line 1275 of file Triple.cpp.

References Darwin, DriverKit, getOS(), getOSVersion(), IOS, llvm_unreachable, MacOSX, llvm::IndexedInstrProf::Version, and WatchOS.

◆ hasDefaultDataSections()

bool llvm::Triple::hasDefaultDataSections ( ) const
inline

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

Definition at line 943 of file Triple.h.

References isOSBinFormatXCOFF(), and isWasm().

Referenced by llvm::codegen::InitTargetOptionsFromCodeGenFlags().

◆ hasDefaultEmulatedTLS()

bool llvm::Triple::hasDefaultEmulatedTLS ( ) const
inline

Tests whether the target uses emulated TLS as default.

Definition at line 938 of file Triple.h.

References isAndroid(), isOSOpenBSD(), and isWindowsCygwinEnvironment().

Referenced by llvm::TargetMachine::useEmulatedTLS().

◆ hasDLLImportExport()

bool llvm::Triple::hasDLLImportExport ( ) const
inline

Tests if the environment supports dllimport/export annotations.

Definition at line 948 of file Triple.h.

References isOSWindows(), and isPS().

◆ hasEnvironment()

bool llvm::Triple::hasEnvironment ( ) const
inline

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

Definition at line 358 of file Triple.h.

References getEnvironmentName().

Referenced by setOSName().

◆ isAArch64() [1/2]

bool llvm::Triple::isAArch64 ( ) const
inline

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

Definition at line 821 of file Triple.h.

References aarch64, aarch64_32, aarch64_be, and getArch().

Referenced by isAArch64(), and llvm::WinException::WinException().

◆ isAArch64() [2/2]

bool llvm::Triple::isAArch64 ( int  PointerWidth) const
inline

Tests whether the target is AArch64 and pointers are the size specified by PointerWidth.

Definition at line 828 of file Triple.h.

References aarch64_32, assert(), getArch(), getEnvironment(), GNUILP32, and isAArch64().

◆ isAMDGCN()

bool llvm::Triple::isAMDGCN ( ) const
inline

Tests whether the target is AMDGCN.

Definition at line 756 of file Triple.h.

References amdgcn, and getArch().

◆ isAMDGPU()

bool llvm::Triple::isAMDGPU ( ) const
inline

Definition at line 758 of file Triple.h.

References amdgcn, getArch(), and r600.

Referenced by getShadowMapping(), and llvm::InformationCache::targetIsGPU().

◆ isAndroid()

bool llvm::Triple::isAndroid ( ) const
inline

◆ isAndroidVersionLT()

bool llvm::Triple::isAndroidVersionLT ( unsigned  Major) const
inline

◆ isArch16Bit()

bool Triple::isArch16Bit ( ) const

Test whether the architecture is 16-bit.

Note that this tests for 16-bit pointer width, and nothing else.

Definition at line 1455 of file Triple.cpp.

References getArch(), and getArchPointerBitWidth().

◆ isArch32Bit()

bool Triple::isArch32Bit ( ) const

Test whether the architecture is 32-bit.

Note that this tests for 32-bit pointer width, and nothing else.

Definition at line 1451 of file Triple.cpp.

References getArch(), and getArchPointerBitWidth().

Referenced by llvm::sys::getProcessTriple(), llvm::TargetLoweringObjectFileXCOFF::Initialize(), llvm::AArch64Subtarget::isTargetILP32(), and loadObj().

◆ isArch64Bit()

bool Triple::isArch64Bit ( ) const

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.

Definition at line 1447 of file Triple.cpp.

References getArch(), and getArchPointerBitWidth().

Referenced by calculateCXXStateNumbers(), llvm::WebAssemblyRegisterInfo::getFrameRegister(), llvm::sys::getProcessTriple(), llvm::WebAssemblySubtarget::hasAddr64(), isAndroidVersionLT(), llvm::LoongArchTargetELFStreamer::LoongArchTargetELFStreamer(), llvm::ifs::parseTriple(), and llvm::BasicTTIImplBase< AMDGPUTTIImpl >::shouldBuildRelLookupTables().

◆ isARM()

bool llvm::Triple::isARM ( ) const
inline

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

Definition at line 768 of file Triple.h.

References arm, armeb, and getArch().

Referenced by getShadowMapping(), and isTargetEHABICompatible().

◆ isArm64e()

bool llvm::Triple::isArm64e ( ) const
inline

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

Definition at line 920 of file Triple.h.

References aarch64, AArch64SubArch_arm64e, getArch(), and getSubArch().

Referenced by getMinimumSupportedOSVersion().

◆ isArmMClass()

bool llvm::Triple::isArmMClass ( ) const
inline

Tests whether the target is an M-class.

Definition at line 806 of file Triple.h.

References ARMSubArch_v6m, ARMSubArch_v7em, ARMSubArch_v7m, ARMSubArch_v8_1m_mainline, ARMSubArch_v8m_baseline, ARMSubArch_v8m_mainline, and getSubArch().

◆ isArmT32()

bool llvm::Triple::isArmT32 ( ) const
inline

◆ isCompatibleWith()

bool Triple::isCompatibleWith ( const Triple Other) const

Test whether target triples are compatible.

Definition at line 1772 of file Triple.cpp.

References Apple, arm, armeb, getArch(), getEnvironment(), getObjectFormat(), getOS(), getSubArch(), getVendor(), Other, thumb, and thumbeb.

Referenced by llvm::ThinLTOCodeGenerator::addModule().

◆ isCSKY()

bool llvm::Triple::isCSKY ( ) const
inline

Definition at line 915 of file Triple.h.

References csky, and getArch().

◆ isDriverKit()

bool llvm::Triple::isDriverKit ( ) const
inline

Is this an Apple DriverKit triple.

Definition at line 504 of file Triple.h.

References DriverKit, and getOS().

Referenced by getShadowMapping(), isOSDarwin(), llvm::ARMSubtarget::isTargetDriverKit(), and llvm::AArch64Subtarget::supportsAddressTopByteIgnored().

◆ isDXIL()

bool llvm::Triple::isDXIL ( ) const
inline

Tests whether the target is DXIL.

Definition at line 736 of file Triple.h.

References dxil, and getArch().

◆ isGNUEnvironment()

bool llvm::Triple::isGNUEnvironment ( ) const
inline

Definition at line 555 of file Triple.h.

References getEnvironment(), GNU, GNUABI64, GNUABIN32, GNUEABI, GNUEABIHF, and GNUX32.

◆ isiOS()

bool llvm::Triple::isiOS ( ) const
inline

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.

Definition at line 485 of file Triple.h.

References getOS(), IOS, and isTvOS().

Referenced by getShadowMapping(), isOSDarwin(), llvm::AArch64Subtarget::isTargetIOS(), llvm::ARMSubtarget::isTargetIOS(), and llvm::AArch64Subtarget::supportsAddressTopByteIgnored().

◆ isKnownWindowsMSVCEnvironment()

bool llvm::Triple::isKnownWindowsMSVCEnvironment ( ) const
inline

Checks if the environment is MSVC.

Definition at line 577 of file Triple.h.

References getEnvironment(), isOSWindows(), and MSVC.

Referenced by isWindowsMSVCEnvironment().

◆ isLittleEndian()

bool Triple::isLittleEndian ( ) const

◆ isLoongArch()

bool llvm::Triple::isLoongArch ( ) const
inline

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

Definition at line 839 of file Triple.h.

References getArch(), loongarch32, and loongarch64.

◆ isMacCatalystEnvironment()

bool llvm::Triple::isMacCatalystEnvironment ( ) const
inline

Definition at line 517 of file Triple.h.

References getEnvironment(), and MacABI.

Referenced by getMinimumSupportedOSVersion(), and isTargetMachineMac().

◆ isMacOSX()

bool llvm::Triple::isMacOSX ( ) const
inline

Is this a Mac OS X triple.

For legacy reasons, we support both "darwin" and "osx" as OS X triples.

Definition at line 476 of file Triple.h.

References Darwin, getOS(), and MacOSX.

Referenced by llvm::MCStreamer::emitVersionForTarget(), getShadowMapping(), isMacOSXVersionLT(), isOSDarwin(), and isTargetMachineMac().

◆ isMacOSXVersionLT()

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

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

Definition at line 1805 of file Triple.cpp.

References assert(), getOS(), isMacOSX(), isOSVersionLT(), and MacOSX.

◆ isMIPS()

bool llvm::Triple::isMIPS ( ) const
inline

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

Definition at line 854 of file Triple.h.

References isMIPS32(), and isMIPS64().

◆ isMIPS32()

bool llvm::Triple::isMIPS32 ( ) const
inline

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

Definition at line 844 of file Triple.h.

References getArch(), mips, and mipsel.

Referenced by getShadowMapping(), and isMIPS().

◆ isMIPS64()

bool llvm::Triple::isMIPS64 ( ) const
inline

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

Definition at line 849 of file Triple.h.

References getArch(), mips64, and mips64el.

Referenced by CreateVarArgHelper(), getShadowMapping(), isMIPS(), and llvm::MipsMCAsmInfo::MipsMCAsmInfo().

◆ isMusl()

bool llvm::Triple::isMusl ( ) const
inline

Tests whether the environment is musl-libc.

Definition at line 728 of file Triple.h.

References getEnvironment(), Musl, MuslEABI, MuslEABIHF, and MuslX32.

◆ isNVPTX()

bool llvm::Triple::isNVPTX ( ) const
inline

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

Definition at line 751 of file Triple.h.

References getArch(), nvptx, and nvptx64.

Referenced by llvm::DwarfCompileUnit::addLocationAttribute(), and llvm::InformationCache::targetIsGPU().

◆ isOSAIX()

bool llvm::Triple::isOSAIX ( ) const
inline

◆ isOSBinFormatCOFF()

bool llvm::Triple::isOSBinFormatCOFF ( ) const
inline

◆ isOSBinFormatDXContainer()

bool llvm::Triple::isOSBinFormatDXContainer ( ) const
inline

Tests whether the OS uses the DXContainer binary format.

Definition at line 691 of file Triple.h.

References DXContainer, and getObjectFormat().

Referenced by supportsCOMDAT().

◆ isOSBinFormatELF()

bool llvm::Triple::isOSBinFormatELF ( ) const
inline

◆ isOSBinFormatGOFF()

bool llvm::Triple::isOSBinFormatGOFF ( ) const
inline

Tests whether the OS uses the GOFF binary format.

Definition at line 673 of file Triple.h.

References getObjectFormat(), and GOFF.

Referenced by llvm::SystemZSubtarget::isTargetGOFF().

◆ isOSBinFormatMachO()

bool llvm::Triple::isOSBinFormatMachO ( ) const
inline

◆ isOSBinFormatWasm()

bool llvm::Triple::isOSBinFormatWasm ( ) const
inline

Tests whether the OS uses the Wasm binary format.

Definition at line 681 of file Triple.h.

References getObjectFormat(), and Wasm.

Referenced by llvm::InternalizePass::internalizeModule().

◆ isOSBinFormatXCOFF()

bool llvm::Triple::isOSBinFormatXCOFF ( ) const
inline

Tests whether the OS uses the XCOFF binary format.

Definition at line 686 of file Triple.h.

References getObjectFormat(), and XCOFF.

Referenced by createPPCMCAsmInfo(), llvm::AsmPrinter::doFinalization(), hasDefaultDataSections(), and supportsCOMDAT().

◆ isOSContiki()

bool llvm::Triple::isOSContiki ( ) const
inline

Definition at line 562 of file Triple.h.

References Contiki, and getOS().

Referenced by llvm::X86TargetLowering::getSafeStackPointerLocation().

◆ isOSCygMing()

bool llvm::Triple::isOSCygMing ( ) const
inline

Tests for either Cygwin or MinGW OS.

Definition at line 610 of file Triple.h.

References isWindowsCygwinEnvironment(), and isWindowsGNUEnvironment().

Referenced by createX86MCAsmInfo(), and llvm::X86Subtarget::isTargetCygMing().

◆ isOSDarwin()

bool llvm::Triple::isOSDarwin ( ) const
inline

◆ isOSDragonFly()

bool llvm::Triple::isOSDragonFly ( ) const
inline

Definition at line 543 of file Triple.h.

References DragonFly, and getOS().

Referenced by llvm::X86Subtarget::isTargetDragonFly().

◆ isOSEmscripten()

bool llvm::Triple::isOSEmscripten ( ) const
inline

Tests whether the OS is Emscripten.

Definition at line 646 of file Triple.h.

References Emscripten, and getOS().

Referenced by GetCtorAndDtorPriority(), and getShadowMapping().

◆ isOSFreeBSD()

bool llvm::Triple::isOSFreeBSD ( ) const
inline

◆ isOSFuchsia()

bool llvm::Triple::isOSFuchsia ( ) const
inline

◆ isOSGlibc()

bool llvm::Triple::isOSGlibc ( ) const
inline

Tests whether the OS uses glibc.

Definition at line 651 of file Triple.h.

References getOS(), Hurd, isAndroid(), KFreeBSD, and Linux.

Referenced by hasStackGuardSlotTLS(), and llvm::X86Subtarget::isTargetGlibc().

◆ isOSHaiku()

bool llvm::Triple::isOSHaiku ( ) const
inline

Tests whether the OS is Haiku.

Definition at line 567 of file Triple.h.

References getOS(), and Haiku.

◆ isOSHurd()

bool llvm::Triple::isOSHurd ( ) const
inline

Tests whether the OS is Hurd.

Definition at line 636 of file Triple.h.

References getOS(), and Hurd.

◆ isOSIAMCU()

bool llvm::Triple::isOSIAMCU ( ) const
inline

Definition at line 549 of file Triple.h.

References ELFIAMCU, and getOS().

Referenced by llvm::createX86_32AsmBackend(), and llvm::X86Subtarget::isTargetMCU().

◆ isOSKFreeBSD()

bool llvm::Triple::isOSKFreeBSD ( ) const
inline

Tests whether the OS is kFreeBSD.

Definition at line 631 of file Triple.h.

References getOS(), and KFreeBSD.

Referenced by llvm::X86Subtarget::isTargetKFreeBSD().

◆ isOSLinux()

bool llvm::Triple::isOSLinux ( ) const
inline

◆ isOSMSVCRT()

bool llvm::Triple::isOSMSVCRT ( ) const
inline

◆ isOSNaCl()

bool llvm::Triple::isOSNaCl ( ) const
inline

◆ isOSNetBSD()

bool llvm::Triple::isOSNetBSD ( ) const
inline

Definition at line 527 of file Triple.h.

References getOS(), and NetBSD.

Referenced by getShadowMapping(), and llvm::ARMSubtarget::isTargetNetBSD().

◆ isOSOpenBSD()

bool llvm::Triple::isOSOpenBSD ( ) const
inline

Definition at line 531 of file Triple.h.

References getOS(), and OpenBSD.

Referenced by hasDefaultEmulatedTLS().

◆ isOSSolaris()

bool llvm::Triple::isOSSolaris ( ) const
inline

Definition at line 545 of file Triple.h.

References getOS(), and Solaris.

Referenced by llvm::X86Subtarget::isTargetSolaris().

◆ isOSUnknown()

bool llvm::Triple::isOSUnknown ( ) const
inline

Definition at line 553 of file Triple.h.

References getOS(), and UnknownOS.

◆ isOSVersionLT() [1/2]

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

Definition at line 465 of file Triple.h.

References getOSVersion(), and Other.

◆ isOSVersionLT() [2/2]

bool llvm::Triple::isOSVersionLT ( unsigned  Major,
unsigned  Minor = 0,
unsigned  Micro = 0 
) const
inline

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

Definition at line 454 of file Triple.h.

References getOSVersion().

Referenced by llvm::ARMTargetLowering::ARMTargetLowering(), and isMacOSXVersionLT().

◆ isOSWASI()

bool llvm::Triple::isOSWASI ( ) const
inline

Tests whether the OS is WASI.

Definition at line 641 of file Triple.h.

References getOS(), and WASI.

◆ isOSWindows()

bool llvm::Triple::isOSWindows ( ) const
inline

◆ isOSzOS()

bool llvm::Triple::isOSzOS ( ) const
inline

Definition at line 506 of file Triple.h.

References getOS(), and ZOS.

Referenced by llvm::SystemZAsmPrinter::emitFunctionBodyEnd(), and llvm::SystemZSubtarget::isTargetzOS().

◆ isPPC()

bool llvm::Triple::isPPC ( ) const
inline

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

Definition at line 859 of file Triple.h.

References getArch(), ppc, ppc64, ppc64le, and ppcle.

◆ isPPC32()

bool llvm::Triple::isPPC32 ( ) const
inline

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

Definition at line 865 of file Triple.h.

References getArch(), ppc, and ppcle.

◆ isPPC64()

bool llvm::Triple::isPPC64 ( ) const
inline

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

Definition at line 870 of file Triple.h.

References getArch(), ppc64, and ppc64le.

Referenced by llvm::PPCInstPrinter::printBranchOperand().

◆ isPS()

bool llvm::Triple::isPS ( ) const
inline

Tests whether the target is the PS4 or PS5 platform.

Definition at line 710 of file Triple.h.

References isPS4(), and isPS5().

Referenced by getShadowMapping(), hasDLLImportExport(), llvm::X86Subtarget::isTargetPS(), and llvm::SelectionDAGBuilder::visitSPDescriptorFailure().

◆ isPS4()

bool llvm::Triple::isPS4 ( ) const
inline

Tests whether the target is the PS4 platform.

Definition at line 696 of file Triple.h.

References getArch(), getOS(), getVendor(), PS4, SCEI, and x86_64.

Referenced by llvm::MCObjectFileInfo::getStackSizesSection(), and isPS().

◆ isPS5()

bool llvm::Triple::isPS5 ( ) const
inline

Tests whether the target is the PS5 platform.

Definition at line 703 of file Triple.h.

References getArch(), getOS(), getVendor(), PS5, SCEI, and x86_64.

Referenced by isPS().

◆ isRISCV()

bool llvm::Triple::isRISCV ( ) const
inline

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

Definition at line 881 of file Triple.h.

References isRISCV32(), and isRISCV64().

◆ isRISCV32()

bool llvm::Triple::isRISCV32 ( ) const
inline

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

Definition at line 875 of file Triple.h.

References getArch(), and riscv32.

Referenced by isRISCV().

◆ isRISCV64()

bool llvm::Triple::isRISCV64 ( ) const
inline

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

Definition at line 878 of file Triple.h.

References getArch(), and riscv64.

Referenced by isRISCV().

◆ isSimulatorEnvironment()

bool llvm::Triple::isSimulatorEnvironment ( ) const
inline

Definition at line 513 of file Triple.h.

References getEnvironment(), and Simulator.

Referenced by getMinimumSupportedOSVersion(), and isTargetMachineMac().

◆ isSPARC()

bool llvm::Triple::isSPARC ( ) const
inline

Tests whether the target is SPARC.

Definition at line 892 of file Triple.h.

References isSPARC32(), and isSPARC64().

◆ isSPARC32()

bool llvm::Triple::isSPARC32 ( ) const
inline

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

Definition at line 884 of file Triple.h.

References getArch(), sparc, and sparcel.

Referenced by isSPARC().

◆ isSPARC64()

bool llvm::Triple::isSPARC64 ( ) const
inline

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

Definition at line 889 of file Triple.h.

References getArch(), and sparcv9.

Referenced by isSPARC().

◆ isSPIR()

bool llvm::Triple::isSPIR ( ) const
inline

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

Definition at line 741 of file Triple.h.

References getArch(), spir, and spir64.

◆ isSPIRV()

bool llvm::Triple::isSPIRV ( ) const
inline

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

Definition at line 746 of file Triple.h.

References getArch(), spirv32, and spirv64.

◆ isSystemZ()

bool llvm::Triple::isSystemZ ( ) const
inline

Tests whether the target is SystemZ.

Definition at line 895 of file Triple.h.

References getArch(), and systemz.

◆ isTargetEHABICompatible()

bool llvm::Triple::isTargetEHABICompatible ( ) const
inline

Tests whether the target supports the EHABI exception handling standard.

Definition at line 774 of file Triple.h.

References EABI, EABIHF, getEnvironment(), GNUEABI, GNUEABIHF, isAndroid(), isARM(), isOSBinFormatELF(), isThumb(), MuslEABI, and MuslEABIHF.

Referenced by llvm::ARMSubtarget::isTargetEHABICompatible().

◆ isTargetMachineMac()

bool llvm::Triple::isTargetMachineMac ( ) const
inline

Returns true for targets that run on a macOS machine.

Definition at line 522 of file Triple.h.

References isMacCatalystEnvironment(), isMacOSX(), isOSDarwin(), and isSimulatorEnvironment().

◆ isThumb()

bool llvm::Triple::isThumb ( ) const
inline

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

Definition at line 763 of file Triple.h.

References getArch(), thumb, and thumbeb.

Referenced by createARMAsmBackend(), getShadowMapping(), isTargetEHABICompatible(), llvm::object::ELFObjectFileBase::setARMSubArch(), and llvm::WinException::WinException().

◆ isTvOS()

bool llvm::Triple::isTvOS ( ) const
inline

Is this an Apple tvOS triple.

Definition at line 490 of file Triple.h.

References getOS(), and TvOS.

Referenced by isiOS().

◆ isVE()

bool llvm::Triple::isVE ( ) const
inline

Tests whether the target is VE.

Definition at line 905 of file Triple.h.

References getArch(), and ve.

◆ isWasm()

bool llvm::Triple::isWasm ( ) const
inline

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

Definition at line 910 of file Triple.h.

References getArch(), wasm32, and wasm64.

Referenced by hasDefaultDataSections(), and llvm::SelectionDAGBuilder::visitSPDescriptorFailure().

◆ isWatchABI()

bool llvm::Triple::isWatchABI ( ) const
inline

◆ isWatchOS()

bool llvm::Triple::isWatchOS ( ) const
inline

Is this an Apple watchOS triple.

Definition at line 495 of file Triple.h.

References getOS(), and WatchOS.

Referenced by getShadowMapping(), isOSDarwin(), and llvm::ARMSubtarget::isTargetWatchOS().

◆ isWindowsArm64EC()

bool llvm::Triple::isWindowsArm64EC ( ) const
inline

Definition at line 588 of file Triple.h.

References aarch64, AArch64SubArch_arm64ec, getArch(), and getSubArch().

Referenced by llvm::AArch64Subtarget::isWindowsArm64EC().

◆ isWindowsCoreCLREnvironment()

bool llvm::Triple::isWindowsCoreCLREnvironment ( ) const
inline

Definition at line 593 of file Triple.h.

References CoreCLR, getEnvironment(), and isOSWindows().

Referenced by createX86MCAsmInfo(), and llvm::X86Subtarget::isTargetWindowsCoreCLR().

◆ isWindowsCygwinEnvironment()

bool llvm::Triple::isWindowsCygwinEnvironment ( ) const
inline

◆ isWindowsGNUEnvironment()

bool llvm::Triple::isWindowsGNUEnvironment ( ) const
inline

◆ isWindowsItaniumEnvironment()

bool llvm::Triple::isWindowsItaniumEnvironment ( ) const
inline

◆ isWindowsMSVCEnvironment()

bool llvm::Triple::isWindowsMSVCEnvironment ( ) const
inline

◆ isX32()

bool llvm::Triple::isX32 ( ) const
inline

Tests whether the target is X32.

Definition at line 926 of file Triple.h.

References getEnvironment(), GNUX32, and MuslX32.

Referenced by llvm::createX86_64AsmBackend(), llvm::X86Subtarget::isTarget64BitILP32(), and llvm::X86Subtarget::isTarget64BitLP64().

◆ isX86()

bool llvm::Triple::isX86 ( ) const
inline

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

Definition at line 900 of file Triple.h.

References getArch(), x86, and x86_64.

◆ merge()

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

Merge target triples.

Definition at line 1796 of file Triple.cpp.

References Apple, getVendor(), Other, and str().

Referenced by llvm::ThinLTOCodeGenerator::addModule().

◆ normalize() [1/2]

std::string llvm::Triple::normalize ( ) const
inline

Return the normalized form of this triple's string.

Definition at line 339 of file Triple.h.

References llvm::Data, and normalize().

Referenced by llvm::sys::getProcessTriple(), LLVMNormalizeTargetTriple(), and normalize().

◆ normalize() [2/2]

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

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.

Definition at line 941 of file Triple.cpp.

References Android, assert(), COFF, llvm::StringRef::drop_front(), llvm::StringRef::empty(), getObjectFormatTypeName(), GNUEABI, i, llvm_unreachable, parseArch(), parseEnvironment(), parseFormat(), parseOS(), parseVendor(), size, startswith(), llvm::StringRef::startswith(), llvm::Twine::str(), SUSE, std::swap(), UnknownArch, UnknownEnvironment, UnknownObjectFormat, UnknownOS, UnknownVendor, and Win32.

◆ operator!=()

bool llvm::Triple::operator!= ( const Triple Other) const
inline

Definition at line 324 of file Triple.h.

References Other.

◆ operator==()

bool llvm::Triple::operator== ( const Triple Other) const
inline

Definition at line 317 of file Triple.h.

References Other.

◆ setArch()

void Triple::setArch ( ArchType  Kind,
SubArchType  SubArch = NoSubArch 
)

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

Definition at line 1314 of file Triple.cpp.

References getArchName(), and setArchName().

Referenced by llvm::TargetRegistry::lookupTarget(), llvm::object::ObjectFile::makeTriple(), and llvm::EngineBuilder::selectTarget().

◆ setArchName()

void Triple::setArchName ( StringRef  Str)

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

Definition at line 1342 of file Triple.cpp.

References getOSAndEnvironmentName(), getVendorName(), setTriple(), and Triple().

Referenced by setArch(), and llvm::object::ELFObjectFileBase::setARMSubArch().

◆ setEnvironment()

void Triple::setEnvironment ( EnvironmentType  Kind)

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

Definition at line 1326 of file Triple.cpp.

References getDefaultFormat(), getEnvironmentTypeName(), getObjectFormatTypeName(), setEnvironmentName(), and str().

◆ setEnvironmentName()

void Triple::setEnvironmentName ( StringRef  Str)

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

Definition at line 1365 of file Triple.cpp.

References getArchName(), getOSName(), getVendorName(), and setTriple().

Referenced by setEnvironment(), and setObjectFormat().

◆ setObjectFormat()

void Triple::setObjectFormat ( ObjectFormatType  Kind)

Set the object file format.

Definition at line 1334 of file Triple.cpp.

References getEnvironmentTypeName(), getObjectFormatTypeName(), setEnvironmentName(), str(), and UnknownEnvironment.

Referenced by llvm::object::ObjectFile::makeTriple().

◆ setOS()

void Triple::setOS ( OSType  Kind)

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

Definition at line 1322 of file Triple.cpp.

References getOSTypeName(), and setOSName().

Referenced by llvm::object::ObjectFile::makeTriple().

◆ setOSAndEnvironmentName()

void Triple::setOSAndEnvironmentName ( StringRef  Str)

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

Definition at line 1370 of file Triple.cpp.

References getArchName(), getVendorName(), and setTriple().

◆ setOSName()

void Triple::setOSName ( StringRef  Str)

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

Definition at line 1357 of file Triple.cpp.

References getArchName(), getEnvironmentName(), getVendorName(), hasEnvironment(), and setTriple().

Referenced by setOS().

◆ setTriple()

void Triple::setTriple ( const Twine Str)

◆ setVendor()

void Triple::setVendor ( VendorType  Kind)

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

Definition at line 1318 of file Triple.cpp.

References getVendorTypeName(), and setVendorName().

◆ setVendorName()

void Triple::setVendorName ( StringRef  Str)

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

Definition at line 1353 of file Triple.cpp.

References getArchName(), getOSAndEnvironmentName(), and setTriple().

Referenced by setVendor().

◆ str()

const std::string& llvm::Triple::str ( ) const
inline

◆ supportsCOMDAT()

bool llvm::Triple::supportsCOMDAT ( ) const
inline

The documentation for this class was generated from the following files: