Primary interface to the complete machine description for the target machine. All target‐specific information should be accessible through this interface.

Synopsis

Declared in <llvm/Target/TargetMachine.h>

class TargetMachine;

Member Functions

Name

Description

TargetMachine [constructor] [deleted]

Copy constructor

~TargetMachine [destructor] [virtual]

Destructor

operator= [deleted]

addAsmPrinter [virtual]

Adds an AsmPrinter pass to the pipeline that prints assembly or machine code from the MI representation.

addPassesToEmitFile [virtual]

Add passes to the specified pass manager to get the specified file emitted. Typically this will involve several steps of code generation. This method should return true if emission of this file type is not supported, or false on success. MMIWP is an optional parameter that, if set to non‐nullptr, will be used to set the MachineModuloInfo for this PM.

addPassesToEmitMC [virtual]

Add passes to the specified pass manager to get machine code emitted with the MCJIT. This method returns true if machine code is not supported. It fills the MCContext Ctx pointer which can be used to build custom MCStreamer.

buildCodeGenPipeline [virtual]

canLowerCondLoop [virtual]

Returns whether the backend can lower the llvm.cond.loop intrinsic. If this function returns false, the intrinsic will be supported generically but without loop detection support.

clearLinkerOptimizationHints [virtual]

Remove all Linker Optimization Hints (LOH) associated with instructions in MIs and

convertFuncInfoToYAML [virtual]

Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.

createDataLayout

Create a DataLayout.

createDefaultFuncInfoYAML [virtual]

Allocate and return a default initialized instance of the YAML representation for the MachineFunctionInfo.

createMCStreamer [virtual]

createMachineFunctionInfo [virtual]

Create the target's instance of MachineFunctionInfo

createMachineScheduler [virtual]

Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this function and target at the current optimization level.

createPassConfig [virtual]

Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of CodeGen passes.

createPostMachineScheduler [virtual]

Similar to createMachineScheduler but used when postRA machine scheduling is enabled.

getAIXExtendedAltivecABI

getAddressSpaceForPseudoSourceKind [virtual]

getAddressSpaceForPseudoSourceKind ‐ Given the kind of memory (e.g. stack) the target returns the corresponding address space.

getAllocaPointerSize

getAssumedAddrSpace [virtual]

If the specified generic pointer could be assumed as a pointer to a specific address space, return that address space.

getBBSectionsFuncListBuf

Get the list of functions and basic block ids that need unique sections.

getBBSectionsType

If basic blocks should be emitted into their own section, corresponding to ‐fbasic‐block‐sections.

getCodeModel

Returns the code model. The choices are small, kernel, medium, large, and target default.

getDataSections

Return true if data objects should be emitted into their own section, corresponds to ‐fdata‐sections.

getEnableStaticDataPartitioning

getExceptionModel

Return the ExceptionHandling to use, considering TargetOptions and the Triple's default.

getFunctionSections

Return true if functions should be emitted into their own section, corresponding to ‐ffunction‐sections.

getIgnoreXCOFFVisibility

Return true if visibility attribute should not be emitted in XCOFF, corresponding to ‐mignore‐xcoff‐visibility.

getMCAsmInfo

Return target specific asm information.

getMCInstrInfo

getMCRegisterInfo

getMCSubtargetInfo

Get the MCSubtargetInfo for the given target CPU and target features. For use in contexts where a feature‐specific MC subtarget is needed, but no MachineFunctionis available, such as for module‐level inline assembly.

getMaxCodeSize

Returns the maximum code size possible under the code model.

getNameWithPrefix

getO0WantsFastISel

getObjFileLowering [virtual]

getOptLevel

Returns the optimization level: None, Less, Default, or Aggressive.

getPGOOption

getPointerSize

Get the pointer size for this target.

getPointerSizeInBits

getPredicatedAddrSpace [virtual]

If the specified predicate checks whether a generic pointer falls within a specified address space, return that generic pointer and the address space being queried.

getProgramPointerSize

getRelocationModel

Returns the code generation relocation model. The choices are static, PIC, and dynamic‐no‐pic, and target default.

getSeparateNamedSections

getSjLjDataSize [virtual]

getSubtarget

This method returns a pointer to the specified type of TargetSubtargetInfo. In debug builds, it verifies that the object being returned is of the correct type.

getSubtargetImpl [virtual]

Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInfo‐derived member variable.

getSymbol

getTLSModel

Returns the TLS model which should be used for the given global variable.

getTarget

getTargetABIName

Returns the effective target ABI name: the "target‐abi" module flag if present, otherwise the ‐target‐abi option. This is a pure query; call verifyOptionsConsistency once per module to diagnose a conflict.

getTargetCPU

getTargetFeatureString

getTargetIRAnalysis

Get a TargetIRAnalysis appropriate for the target.

getTargetTransformInfo [virtual]

Return a TargetTransformInfo for a given function.

getTargetTriple

getUniqueBasicBlockSectionNames

Return true if unique basic block section names must be generated.

getUniqueSectionNames

getXCOFFTracebackTable

Return true if XCOFF traceback table should be emitted, corresponding to ‐xcoff‐traceback‐table.

isCompatibleDataLayout

Test if a DataLayout if compatible with the CodeGen for this target.

isLargeDataSize

isLargeGlobalValue

isMachineVerifierClean [virtual]

Returns true if the target is expected to pass all machine verifier checks. This is a stopgap measure to fix targets one by one. We will remove this at some point and always enable the verifier when EXPENSIVE_CHECKS is enabled.

isNoopAddrSpaceCast [virtual]

Returns true if a cast between SrcAS and DestAS is a noop.

isPositionIndependent

parseMachineFunctionInfo [virtual]

Parse out the target's MachineFunctionInfo from the YAML reprsentation.

registerDefaultAliasAnalyses [virtual]

Allow the target to register alias analyses with the AAManager for use with the new pass manager. Only affects the "default" AAManager.

registerEarlyDefaultAliasAnalyses [virtual]

Allow the target to register early alias analyses (AA before BasicAA) with the AAManager for use with the new pass manager. Only affects the "default" AAManager.

registerMachineRegisterInfoCallback [virtual]

registerPassBuilderCallbacks [virtual]

Allow the target to modify the pass pipeline.

requiresStructuredCFG

setCFIFixup

setCodeModel

Set the code model.

setEnableDefaultMachineVerifier

setFastISel

setGlobalISel

setGlobalISelAbort

setLargeDataThreshold

setMachineOutliner

setO0WantsFastISel

setOptLevel

Overrides the optimization level.

setPGOOption

setRequiresStructuredCFG

setSupportsDebugEntryValues

setSupportsDefaultOutlining

setTargetFeatureString

shouldAssumeDSOLocal

shouldDefaultToNewPM [virtual]

Returns true if frontends should default to using the NewPM for this specific target.

splitModule [virtual]

Entry point for module splitting. Targets can implement custom module splitting logic, mainly used by LTO for ‐‐lto‐partitions.

targetSchedulesPostRAScheduling [virtual]

True if subtarget inserts the final scheduling pass on its own.

unqualifiedInlineAsmVariant [virtual]

The default variant to use in unqualified asm instructions. If this returns 0, asm "\$(foo\$|bar$)" will evaluate to asm "foo".

useEmulatedTLS

Returns true if this target uses emulated TLS.

useIPRA [virtual]

True if the target wants to use interprocedural register allocation by default. The ‐enable‐ipra flag can be used to override this.

useTLSDESC

Returns true if this target uses TLS Descriptors.

usesPhysRegsForValues [virtual]

True if the target uses physical regs (as nearly all targets do). False for stack machines such as WebAssembly and other virtual‐register machines. If true, all vregs must be allocated before PEI. If false, then callee‐save register spilling and scavenging are not needed or used. If false, implicitly defined registers will still be assumed to be physical registers, except that variadic defs will be allocated vregs.

verifyOptionsConsistency

Diagnoses command‐line codegen options that conflict with the corresponding module flags (e.g. ‐target‐abi vs the "target‐abi" module flag). Intended to be called once per module.

Static Member Functions

Data Members

Name

Options

Static Data Members

Name

Description

DefaultSjLjDataSize

The integer bit size to use for SjLj based exception handling.

Protected Member Functions

Name

TargetMachine [constructor]

Protected Data Members

Name

Description

AsmInfo

Contains target specific asm information.

CMModel

DL

DataLayout for the target: keep ABI type size and alignment.

LargeDataThreshold

MCSubtargetMap

MC subtarget keyed by target features and target CPU.

MII

MRI

O0WantsFastISel

OptLevel

PGOOption

RM

RequireStructuredCFG

STI

TargetCPU

TargetFS

TargetTriple

Triple string, CPU name, and target feature strings the TargetMachine instance is created with.

TheTarget

The Target that this machine was created for.

Non-Member Functions

Name

Description

createComplexDeinterleavingPass

This pass implements generation of target‐specific intrinsics to support handling of complex number arithmetic

createGlobalMergePass

GlobalMerge ‐ This pass merges internal (by default) globals into structs to enable reuse of a base pointer by indexed addressing modes. It can also be configured to focus on size optimizations only.

createSjLjEHPreparePass

createSjLjEHPreparePass ‐ This pass adapts exception handling code to use the GCC‐style builtin setjmp/longjmp (sjlj) to handling EH control flow.

Derived Classes

Name

Description

CodeGenTargetMachineImpl

implements a set of functionality in the TargetMachine class for targets that make use of the independent code generator (CodeGen) library. Must not be used directly in code unless to inherit its implementation.

Created with MrDocs