LLVM 22.0.0git
llvm::TargetMachine Class Reference

Primary interface to the complete machine description for the target machine. More...

#include "llvm/Target/TargetMachine.h"

Inheritance diagram for llvm::TargetMachine:
[legend]

Public Member Functions

 TargetMachine (const TargetMachine &)=delete
void operator= (const TargetMachine &)=delete
virtual ~TargetMachine ()
const TargetgetTarget () const
const TriplegetTargetTriple () const
StringRef getTargetCPU () const
StringRef getTargetFeatureString () const
void setTargetFeatureString (StringRef FS)
virtual const TargetSubtargetInfogetSubtargetImpl (const Function &) const
 Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInfo-derived member variable.
virtual TargetLoweringObjectFilegetObjFileLowering () const
virtual MachineFunctionInfocreateMachineFunctionInfo (BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const
 Create the target's instance of MachineFunctionInfo.
virtual ScheduleDAGInstrscreateMachineScheduler (MachineSchedContext *C) const
 Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this function and target at the current optimization level.
virtual ScheduleDAGInstrscreatePostMachineScheduler (MachineSchedContext *C) const
 Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
virtual yaml::MachineFunctionInfocreateDefaultFuncInfoYAML () const
 Allocate and return a default initialized instance of the YAML representation for the MachineFunctionInfo.
virtual yaml::MachineFunctionInfoconvertFuncInfoToYAML (const MachineFunction &MF) const
 Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
virtual bool parseMachineFunctionInfo (const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const
 Parse out the target's MachineFunctionInfo from the YAML reprsentation.
template<typename STC>
const STC & getSubtarget (const Function &F) const
 This method returns a pointer to the specified type of TargetSubtargetInfo.
const DataLayout createDataLayout () const
 Create a DataLayout.
bool isCompatibleDataLayout (const DataLayout &Candidate) const
 Test if a DataLayout if compatible with the CodeGen for this target.
unsigned getPointerSize (unsigned AS) const
 Get the pointer size for this target.
unsigned getPointerSizeInBits (unsigned AS) const
unsigned getProgramPointerSize () const
unsigned getAllocaPointerSize () const
void resetTargetOptions (const Function &F) const
 Reset the target options based on the function's attributes.
const MCAsmInfogetMCAsmInfo () const
 Return target specific asm information.
const MCRegisterInfogetMCRegisterInfo () const
const MCInstrInfogetMCInstrInfo () const
const MCSubtargetInfogetMCSubtargetInfo () const
ExceptionHandling getExceptionModel () const
 Return the ExceptionHandling to use, considering TargetOptions and the Triple's default.
bool requiresStructuredCFG () const
void setRequiresStructuredCFG (bool Value)
Reloc::Model getRelocationModel () const
 Returns the code generation relocation model.
CodeModel::Model getCodeModel () const
 Returns the code model.
uint64_t getMaxCodeSize () const
 Returns the maximum code size possible under the code model.
void setCodeModel (CodeModel::Model CM)
 Set the code model.
void setLargeDataThreshold (uint64_t LDT)
bool isLargeGlobalValue (const GlobalValue *GV) const
bool isPositionIndependent () const
bool shouldAssumeDSOLocal (const GlobalValue *GV) const
bool useEmulatedTLS () const
 Returns true if this target uses emulated TLS.
bool useTLSDESC () const
 Returns true if this target uses TLS Descriptors.
TLSModel::Model getTLSModel (const GlobalValue *GV) const
 Returns the TLS model which should be used for the given global variable.
CodeGenOptLevel getOptLevel () const
 Returns the optimization level: None, Less, Default, or Aggressive.
void setOptLevel (CodeGenOptLevel Level)
 Overrides the optimization level.
void setFastISel (bool Enable)
bool getO0WantsFastISel ()
void setO0WantsFastISel (bool Enable)
void setGlobalISel (bool Enable)
void setGlobalISelAbort (GlobalISelAbortMode Mode)
void setMachineOutliner (bool Enable)
void setSupportsDefaultOutlining (bool Enable)
void setSupportsDebugEntryValues (bool Enable)
void setCFIFixup (bool Enable)
bool getAIXExtendedAltivecABI () const
bool getUniqueSectionNames () const
bool getUniqueBasicBlockSectionNames () const
 Return true if unique basic block section names must be generated.
bool getSeparateNamedSections () const
bool getDataSections () const
 Return true if data objects should be emitted into their own section, corresponds to -fdata-sections.
bool getFunctionSections () const
 Return true if functions should be emitted into their own section, corresponding to -ffunction-sections.
bool getEnableStaticDataPartitioning () const
bool getIgnoreXCOFFVisibility () const
 Return true if visibility attribute should not be emitted in XCOFF, corresponding to -mignore-xcoff-visibility.
bool getXCOFFTracebackTable () const
 Return true if XCOFF traceback table should be emitted, corresponding to -xcoff-traceback-table.
llvm::BasicBlockSection getBBSectionsType () const
 If basic blocks should be emitted into their own section, corresponding to -fbasic-block-sections.
const MemoryBuffergetBBSectionsFuncListBuf () const
 Get the list of functions and basic block ids that need unique sections.
virtual bool isNoopAddrSpaceCast (unsigned SrcAS, unsigned DestAS) const
 Returns true if a cast between SrcAS and DestAS is a noop.
void setPGOOption (std::optional< PGOOptions > PGOOpt)
const std::optional< PGOOptions > & getPGOOption () const
virtual unsigned getAssumedAddrSpace (const Value *V) const
 If the specified generic pointer could be assumed as a pointer to a specific address space, return that address space.
virtual std::pair< const Value *, unsignedgetPredicatedAddrSpace (const Value *V) const
 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.
TargetIRAnalysis getTargetIRAnalysis () const
 Get a TargetIRAnalysis appropriate for the target.
virtual TargetTransformInfo getTargetTransformInfo (const Function &F) const
 Return a TargetTransformInfo for a given function.
virtual void registerPassBuilderCallbacks (PassBuilder &)
 Allow the target to modify the pass pipeline.
virtual void registerEarlyDefaultAliasAnalyses (AAManager &)
 Allow the target to register early alias analyses (AA before BasicAA) with the AAManager for use with the new pass manager.
virtual void registerDefaultAliasAnalyses (AAManager &)
 Allow the target to register alias analyses with the AAManager for use with the new pass manager.
virtual bool addPassesToEmitFile (PassManagerBase &, raw_pwrite_stream &, raw_pwrite_stream *, CodeGenFileType, bool=true, MachineModuleInfoWrapperPass *MMIWP=nullptr)
 Add passes to the specified pass manager to get the specified file emitted.
virtual bool addPassesToEmitMC (PassManagerBase &, MCContext *&, raw_pwrite_stream &, bool=true)
 Add passes to the specified pass manager to get machine code emitted with the MCJIT.
virtual bool targetSchedulesPostRAScheduling () const
 True if subtarget inserts the final scheduling pass on its own.
void getNameWithPrefix (SmallVectorImpl< char > &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate=false) const
MCSymbolgetSymbol (const GlobalValue *GV) const
virtual unsigned getSjLjDataSize () const
virtual unsigned getAddressSpaceForPseudoSourceKind (unsigned Kind) const
 getAddressSpaceForPseudoSourceKind - Given the kind of memory (e.g.
virtual bool splitModule (Module &M, unsigned NumParts, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback)
 Entry point for module splitting.
virtual TargetPassConfigcreatePassConfig (PassManagerBase &PM)
 Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of CodeGen passes.
virtual Error buildCodeGenPipeline (ModulePassManager &, raw_pwrite_stream &, raw_pwrite_stream *, CodeGenFileType, const CGPassBuilderOption &, PassInstrumentationCallbacks *)
virtual bool isMachineVerifierClean () const
 Returns true if the target is expected to pass all machine verifier checks.
virtual bool addAsmPrinter (PassManagerBase &PM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Context)
 Adds an AsmPrinter pass to the pipeline that prints assembly or machine code from the MI representation.
virtual Expected< std::unique_ptr< MCStreamer > > createMCStreamer (raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, MCContext &Ctx)
virtual bool usesPhysRegsForValues () const
 True if the target uses physical regs (as nearly all targets do).
virtual bool useIPRA () const
 True if the target wants to use interprocedural register allocation by default.
virtual int unqualifiedInlineAsmVariant () const
 The default variant to use in unqualified asm instructions.
virtual void registerMachineRegisterInfoCallback (MachineFunction &MF) const
virtual size_t clearLinkerOptimizationHints (const SmallPtrSetImpl< MachineInstr * > &MIs) const
 Remove all Linker Optimization Hints (LOH) associated with instructions in MIs and.

Static Public Member Functions

static std::pair< int, int > parseBinutilsVersion (StringRef Version)

Public Attributes

TargetOptions Options

Static Public Attributes

static constexpr unsigned DefaultSjLjDataSize = 32
 The integer bit size to use for SjLj based exception handling.

Protected Member Functions

 TargetMachine (const Target &T, StringRef DataLayoutString, const Triple &TargetTriple, StringRef CPU, StringRef FS, const TargetOptions &Options)

Protected Attributes

const TargetTheTarget
 The Target that this machine was created for.
const DataLayout DL
 DataLayout for the target: keep ABI type size and alignment.
Triple TargetTriple
 Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
std::string TargetCPU
std::string TargetFS
Reloc::Model RM = Reloc::Static
CodeModel::Model CMModel = CodeModel::Small
uint64_t LargeDataThreshold = 0
CodeGenOptLevel OptLevel = CodeGenOptLevel::Default
std::unique_ptr< const MCAsmInfoAsmInfo
 Contains target specific asm information.
std::unique_ptr< const MCRegisterInfoMRI
std::unique_ptr< const MCInstrInfoMII
std::unique_ptr< const MCSubtargetInfoSTI
unsigned RequireStructuredCFG: 1
unsigned O0WantsFastISel: 1
std::optional< PGOOptionsPGOOption

Detailed Description

Primary interface to the complete machine description for the target machine.

All target-specific information should be accessible through this interface.

Definition at line 83 of file TargetMachine.h.

Constructor & Destructor Documentation

◆ TargetMachine() [1/2]

TargetMachine::TargetMachine ( const Target & T,
StringRef DataLayoutString,
const Triple & TargetTriple,
StringRef CPU,
StringRef FS,
const TargetOptions & Options )
protected

◆ TargetMachine() [2/2]

llvm::TargetMachine::TargetMachine ( const TargetMachine & )
delete

References TargetMachine().

◆ ~TargetMachine()

TargetMachine::~TargetMachine ( )
virtualdefault

Member Function Documentation

◆ addAsmPrinter()

virtual bool llvm::TargetMachine::addAsmPrinter ( PassManagerBase & PM,
raw_pwrite_stream & Out,
raw_pwrite_stream * DwoOut,
CodeGenFileType FileType,
MCContext & Context )
inlinevirtual

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

Reimplemented in llvm::CodeGenTargetMachineImpl.

Definition at line 504 of file TargetMachine.h.

◆ addPassesToEmitFile()

virtual bool llvm::TargetMachine::addPassesToEmitFile ( PassManagerBase & ,
raw_pwrite_stream & ,
raw_pwrite_stream * ,
CodeGenFileType ,
bool = true,
MachineModuleInfoWrapperPass * MMIWP = nullptr )
inlinevirtual

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.

Reimplemented in llvm::CodeGenTargetMachineImpl, and llvm::DirectXTargetMachine.

Definition at line 426 of file TargetMachine.h.

◆ addPassesToEmitMC()

virtual bool llvm::TargetMachine::addPassesToEmitMC ( PassManagerBase & ,
MCContext *& ,
raw_pwrite_stream & ,
bool = true )
inlinevirtual

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.

Reimplemented in llvm::CodeGenTargetMachineImpl, llvm::DirectXTargetMachine, and llvm::NVPTXTargetMachine.

Definition at line 438 of file TargetMachine.h.

◆ buildCodeGenPipeline()

virtual Error llvm::TargetMachine::buildCodeGenPipeline ( ModulePassManager & ,
raw_pwrite_stream & ,
raw_pwrite_stream * ,
CodeGenFileType ,
const CGPassBuilderOption & ,
PassInstrumentationCallbacks *  )
inlinevirtual

◆ clearLinkerOptimizationHints()

virtual size_t llvm::TargetMachine::clearLinkerOptimizationHints ( const SmallPtrSetImpl< MachineInstr * > & MIs) const
inlinevirtual

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

Returns
the number of hints removed. This is useful in transformations that cause these hints to be illegal, like in the machine outliner.

Reimplemented in llvm::AArch64TargetMachine.

Definition at line 537 of file TargetMachine.h.

◆ convertFuncInfoToYAML()

virtual yaml::MachineFunctionInfo * llvm::TargetMachine::convertFuncInfoToYAML ( const MachineFunction & MF) const
inlinevirtual

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

Reimplemented in llvm::AArch64TargetMachine, llvm::ARMBaseTargetMachine, llvm::GCNTargetMachine, llvm::RISCVTargetMachine, llvm::WebAssemblyTargetMachine, and llvm::X86TargetMachine.

Definition at line 184 of file TargetMachine.h.

◆ createDataLayout()

const DataLayout llvm::TargetMachine::createDataLayout ( ) const
inline

Create a DataLayout.

Definition at line 204 of file TargetMachine.h.

References DL.

◆ createDefaultFuncInfoYAML()

virtual yaml::MachineFunctionInfo * llvm::TargetMachine::createDefaultFuncInfoYAML ( ) const
inlinevirtual

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

Reimplemented in llvm::AArch64TargetMachine, llvm::ARMBaseTargetMachine, llvm::GCNTargetMachine, llvm::RISCVTargetMachine, llvm::WebAssemblyTargetMachine, and llvm::X86TargetMachine.

Definition at line 177 of file TargetMachine.h.

◆ createMachineFunctionInfo()

◆ createMachineScheduler()

virtual ScheduleDAGInstrs * llvm::TargetMachine::createMachineScheduler ( MachineSchedContext * C) const
inlinevirtual

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

This can also be used to plug a new MachineSchedStrategy into an instance of the standard ScheduleDAGMI: return new ScheduleDAGMI(C, std::make_unique<MyStrategy>(C), /*RemoveKillFlags=*‍/false)

Return NULL to select the default (generic) machine scheduler.

Reimplemented in llvm::AArch64TargetMachine, llvm::AMDGPUTargetMachine, llvm::ARMBaseTargetMachine, llvm::GCNTargetMachine, llvm::HexagonTargetMachine, llvm::PPCTargetMachine, llvm::R600TargetMachine, llvm::RISCVTargetMachine, and llvm::X86TargetMachine.

Definition at line 164 of file TargetMachine.h.

References llvm::CallingConv::C.

◆ createMCStreamer()

Expected< std::unique_ptr< MCStreamer > > TargetMachine::createMCStreamer ( raw_pwrite_stream & Out,
raw_pwrite_stream * DwoOut,
CodeGenFileType FileType,
MCContext & Ctx )
virtual

Reimplemented in llvm::CodeGenTargetMachineImpl.

Definition at line 50 of file TargetMachine.cpp.

◆ createPassConfig()

◆ createPostMachineScheduler()

virtual ScheduleDAGInstrs * llvm::TargetMachine::createPostMachineScheduler ( MachineSchedContext * C) const
inlinevirtual

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

Reimplemented in llvm::AArch64TargetMachine, llvm::ARMBaseTargetMachine, llvm::GCNTargetMachine, llvm::PPCTargetMachine, llvm::RISCVTargetMachine, llvm::SystemZTargetMachine, and llvm::X86TargetMachine.

Definition at line 171 of file TargetMachine.h.

References llvm::CallingConv::C.

◆ getAddressSpaceForPseudoSourceKind()

virtual unsigned llvm::TargetMachine::getAddressSpaceForPseudoSourceKind ( unsigned Kind) const
inlinevirtual

getAddressSpaceForPseudoSourceKind - Given the kind of memory (e.g.

stack) the target returns the corresponding address space.

Reimplemented in llvm::AMDGPUTargetMachine.

Definition at line 463 of file TargetMachine.h.

◆ getAIXExtendedAltivecABI()

bool llvm::TargetMachine::getAIXExtendedAltivecABI ( ) const
inline

Definition at line 313 of file TargetMachine.h.

References Options.

◆ getAllocaPointerSize()

unsigned llvm::TargetMachine::getAllocaPointerSize ( ) const
inline

Definition at line 230 of file TargetMachine.h.

References DL.

◆ getAssumedAddrSpace()

virtual unsigned llvm::TargetMachine::getAssumedAddrSpace ( const Value * V) const
inlinevirtual

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

Under offloading programming, the offloading target may be passed with values only prepared on the host side and could assume certain properties.

Reimplemented in llvm::AMDGPUTargetMachine.

Definition at line 379 of file TargetMachine.h.

◆ getBBSectionsFuncListBuf()

const MemoryBuffer * llvm::TargetMachine::getBBSectionsFuncListBuf ( ) const
inline

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

Definition at line 361 of file TargetMachine.h.

References Options.

◆ getBBSectionsType()

llvm::BasicBlockSection llvm::TargetMachine::getBBSectionsType ( ) const
inline

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

Definition at line 356 of file TargetMachine.h.

References Options.

Referenced by assignSections().

◆ getCodeModel()

◆ getDataSections()

bool llvm::TargetMachine::getDataSections ( ) const
inline

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

Definition at line 330 of file TargetMachine.h.

References Options.

◆ getEnableStaticDataPartitioning()

bool llvm::TargetMachine::getEnableStaticDataPartitioning ( ) const
inline

Definition at line 340 of file TargetMachine.h.

References Options.

◆ getExceptionModel()

ExceptionHandling llvm::TargetMachine::getExceptionModel ( ) const
inline

◆ getFunctionSections()

bool llvm::TargetMachine::getFunctionSections ( ) const
inline

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

Definition at line 336 of file TargetMachine.h.

References Options.

◆ getIgnoreXCOFFVisibility()

bool llvm::TargetMachine::getIgnoreXCOFFVisibility ( ) const
inline

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

Definition at line 346 of file TargetMachine.h.

References Options.

◆ getMaxCodeSize()

uint64_t TargetMachine::getMaxCodeSize ( ) const

Returns the maximum code size possible under the code model.

Definition at line 171 of file TargetMachine.cpp.

References getCodeModel(), llvm::CodeModel::Kernel, llvm::CodeModel::Large, llvm_unreachable, llvm::maxUIntN(), llvm::CodeModel::Medium, llvm::CodeModel::Small, and llvm::CodeModel::Tiny.

◆ getMCAsmInfo()

const MCAsmInfo * llvm::TargetMachine::getMCAsmInfo ( ) const
inline

◆ getMCInstrInfo()

const MCInstrInfo * llvm::TargetMachine::getMCInstrInfo ( ) const
inline

◆ getMCRegisterInfo()

const MCRegisterInfo * llvm::TargetMachine::getMCRegisterInfo ( ) const
inline

◆ getMCSubtargetInfo()

◆ getNameWithPrefix()

void TargetMachine::getNameWithPrefix ( SmallVectorImpl< char > & Name,
const GlobalValue * GV,
Mangler & Mang,
bool MayAlwaysUsePrivate = false ) const

◆ getO0WantsFastISel()

bool llvm::TargetMachine::getO0WantsFastISel ( )
inline

Definition at line 295 of file TargetMachine.h.

References O0WantsFastISel.

◆ getObjFileLowering()

◆ getOptLevel()

◆ getPGOOption()

const std::optional< PGOOptions > & llvm::TargetMachine::getPGOOption ( ) const
inline

Definition at line 371 of file TargetMachine.h.

References PGOOption.

◆ getPointerSize()

unsigned llvm::TargetMachine::getPointerSize ( unsigned AS) const
inline

◆ getPointerSizeInBits()

unsigned llvm::TargetMachine::getPointerSizeInBits ( unsigned AS) const
inline

Definition at line 222 of file TargetMachine.h.

References DL.

◆ getPredicatedAddrSpace()

virtual std::pair< const Value *, unsigned > llvm::TargetMachine::getPredicatedAddrSpace ( const Value * V) const
inlinevirtual

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.

Such predicates could be specified in @llvm.assume intrinsics for the optimizer to assume that the given generic pointer always falls within the address space based on that predicate.

Reimplemented in llvm::AMDGPUTargetMachine, and llvm::NVPTXTargetMachine.

Definition at line 389 of file TargetMachine.h.

◆ getProgramPointerSize()

unsigned llvm::TargetMachine::getProgramPointerSize ( ) const
inline

Definition at line 226 of file TargetMachine.h.

References DL.

◆ getRelocationModel()

Reloc::Model TargetMachine::getRelocationModel ( ) const

Returns the code generation relocation model.

The choices are static, PIC, and dynamic-no-pic, and target default.

The choices are static, PIC, and dynamic-no-pic.

Definition at line 169 of file TargetMachine.cpp.

References RM.

Referenced by getTLSModel(), isPositionIndependent(), shouldAssumeDSOLocal(), and transformCallee().

◆ getSeparateNamedSections()

bool llvm::TargetMachine::getSeparateNamedSections ( ) const
inline

Definition at line 324 of file TargetMachine.h.

References Options.

◆ getSjLjDataSize()

virtual unsigned llvm::TargetMachine::getSjLjDataSize ( ) const
inlinevirtual

Reimplemented in llvm::VETargetMachine.

Definition at line 457 of file TargetMachine.h.

References DefaultSjLjDataSize.

◆ getSubtarget()

template<typename STC>
const STC & llvm::TargetMachine::getSubtarget ( const Function & F) const
inline

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.

Definition at line 199 of file TargetMachine.h.

References F, and getSubtargetImpl().

◆ getSubtargetImpl()

◆ getSymbol()

◆ getTarget()

◆ getTargetCPU()

StringRef llvm::TargetMachine::getTargetCPU ( ) const
inline

◆ getTargetFeatureString()

StringRef llvm::TargetMachine::getTargetFeatureString ( ) const
inline

◆ getTargetIRAnalysis()

TargetIRAnalysis TargetMachine::getTargetIRAnalysis ( ) const

Get a TargetIRAnalysis appropriate for the target.

This is used to construct the new pass manager's target IR analysis pass, set up appropriately for this target machine. Even the old pass manager uses this to answer queries about the IR.

Definition at line 319 of file TargetMachine.cpp.

References F, and getTargetTransformInfo().

◆ getTargetTransformInfo()

◆ getTargetTriple()

const Triple & llvm::TargetMachine::getTargetTriple ( ) const
inline

◆ getTLSModel()

◆ getUniqueBasicBlockSectionNames()

bool llvm::TargetMachine::getUniqueBasicBlockSectionNames ( ) const
inline

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

Definition at line 320 of file TargetMachine.h.

References Options.

◆ getUniqueSectionNames()

bool llvm::TargetMachine::getUniqueSectionNames ( ) const
inline

Definition at line 317 of file TargetMachine.h.

References Options.

◆ getXCOFFTracebackTable()

bool llvm::TargetMachine::getXCOFFTracebackTable ( ) const
inline

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

Definition at line 352 of file TargetMachine.h.

References Options.

◆ isCompatibleDataLayout()

bool llvm::TargetMachine::isCompatibleDataLayout ( const DataLayout & Candidate) const
inline

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

The LLVM Module owns a DataLayout that is used for the target independent optimizations and code generation. This hook provides a target specific check on the validity of this DataLayout.

Definition at line 211 of file TargetMachine.h.

References DL.

◆ isLargeGlobalValue()

◆ isMachineVerifierClean()

virtual bool llvm::TargetMachine::isMachineVerifierClean ( ) const
inlinevirtual

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.

Reimplemented in llvm::LanaiTargetMachine, llvm::NVPTXTargetMachine, llvm::R600TargetMachine, and llvm::VETargetMachine.

Definition at line 500 of file TargetMachine.h.

◆ isNoopAddrSpaceCast()

virtual bool llvm::TargetMachine::isNoopAddrSpaceCast ( unsigned SrcAS,
unsigned DestAS ) const
inlinevirtual

◆ isPositionIndependent()

◆ operator=()

void llvm::TargetMachine::operator= ( const TargetMachine & )
delete

References TargetMachine().

◆ parseBinutilsVersion()

std::pair< int, int > TargetMachine::parseBinutilsVersion ( StringRef Version)
static

Definition at line 326 of file TargetMachine.cpp.

References llvm::Version.

◆ parseMachineFunctionInfo()

virtual bool llvm::TargetMachine::parseMachineFunctionInfo ( const yaml::MachineFunctionInfo & ,
PerFunctionMIParsingState & PFS,
SMDiagnostic & Error,
SMRange & SourceRange ) const
inlinevirtual

◆ registerDefaultAliasAnalyses()

virtual void llvm::TargetMachine::registerDefaultAliasAnalyses ( AAManager & )
inlinevirtual

Allow the target to register alias analyses with the AAManager for use with the new pass manager.

Only affects the "default" AAManager.

Reimplemented in llvm::AMDGPUTargetMachine.

Definition at line 417 of file TargetMachine.h.

◆ registerEarlyDefaultAliasAnalyses()

virtual void llvm::TargetMachine::registerEarlyDefaultAliasAnalyses ( AAManager & )
inlinevirtual

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.

Reimplemented in llvm::NVPTXTargetMachine.

Definition at line 413 of file TargetMachine.h.

◆ registerMachineRegisterInfoCallback()

virtual void llvm::TargetMachine::registerMachineRegisterInfoCallback ( MachineFunction & MF) const
inlinevirtual

Reimplemented in llvm::GCNTargetMachine.

Definition at line 531 of file TargetMachine.h.

◆ registerPassBuilderCallbacks()

virtual void llvm::TargetMachine::registerPassBuilderCallbacks ( PassBuilder & )
inlinevirtual

◆ requiresStructuredCFG()

bool llvm::TargetMachine::requiresStructuredCFG ( ) const
inline

Definition at line 255 of file TargetMachine.h.

References RequireStructuredCFG.

Referenced by llvm::MachineBasicBlock::canSplitCriticalEdge().

◆ resetTargetOptions()

◆ setCFIFixup()

void llvm::TargetMachine::setCFIFixup ( bool Enable)
inline

◆ setCodeModel()

void llvm::TargetMachine::setCodeModel ( CodeModel::Model CM)
inline

Set the code model.

Definition at line 270 of file TargetMachine.h.

References CMModel.

◆ setFastISel()

void llvm::TargetMachine::setFastISel ( bool Enable)
inline

Definition at line 294 of file TargetMachine.h.

References llvm::Enable, and Options.

Referenced by llvm::SPIRVTargetMachine::SPIRVTargetMachine().

◆ setGlobalISel()

void llvm::TargetMachine::setGlobalISel ( bool Enable)
inline

◆ setGlobalISelAbort()

void llvm::TargetMachine::setGlobalISelAbort ( GlobalISelAbortMode Mode)
inline

Definition at line 298 of file TargetMachine.h.

References Mode, and Options.

Referenced by llvm::AArch64TargetMachine::AArch64TargetMachine().

◆ setLargeDataThreshold()

void llvm::TargetMachine::setLargeDataThreshold ( uint64_t LDT)
inline

Definition at line 272 of file TargetMachine.h.

References LargeDataThreshold.

◆ setMachineOutliner()

◆ setO0WantsFastISel()

void llvm::TargetMachine::setO0WantsFastISel ( bool Enable)
inline

Definition at line 296 of file TargetMachine.h.

References llvm::Enable, and O0WantsFastISel.

Referenced by llvm::SPIRVTargetMachine::SPIRVTargetMachine().

◆ setOptLevel()

void llvm::TargetMachine::setOptLevel ( CodeGenOptLevel Level)
inline

Overrides the optimization level.

Definition at line 292 of file TargetMachine.h.

References OptLevel.

◆ setPGOOption()

void llvm::TargetMachine::setPGOOption ( std::optional< PGOOptions > PGOOpt)
inline

Definition at line 370 of file TargetMachine.h.

References PGOOption.

◆ setRequiresStructuredCFG()

void llvm::TargetMachine::setRequiresStructuredCFG ( bool Value)
inline

◆ setSupportsDebugEntryValues()

◆ setSupportsDefaultOutlining()

void llvm::TargetMachine::setSupportsDefaultOutlining ( bool Enable)
inline

◆ setTargetFeatureString()

void llvm::TargetMachine::setTargetFeatureString ( StringRef FS)
inline

Definition at line 135 of file TargetMachine.h.

References TargetFS.

◆ shouldAssumeDSOLocal()

◆ splitModule()

virtual bool llvm::TargetMachine::splitModule ( Module & M,
unsigned NumParts,
function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback )
inlinevirtual

Entry point for module splitting.

Targets can implement custom module splitting logic, mainly used by LTO for –lto-partitions.

On success, this guarantees that between 1 and NumParts modules were created and passed to ModuleCallBack.

Returns
true if the module was split, false otherwise. When false is returned, it is assumed that ModuleCallback has never been called and M has not been modified.

Reimplemented in llvm::AMDGPUTargetMachine.

Definition at line 476 of file TargetMachine.h.

◆ targetSchedulesPostRAScheduling()

virtual bool llvm::TargetMachine::targetSchedulesPostRAScheduling ( ) const
inlinevirtual

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

Branch relaxation, which must happen after block placement, can on some targets (e.g. SystemZ) expose additional post-RA scheduling opportunities.

Reimplemented in llvm::ARMBaseTargetMachine, and llvm::SystemZTargetMachine.

Definition at line 449 of file TargetMachine.h.

◆ unqualifiedInlineAsmVariant()

virtual int llvm::TargetMachine::unqualifiedInlineAsmVariant ( ) const
inlinevirtual

The default variant to use in unqualified asm instructions.

If this returns 0, asm "$(foo$|bar$)" will evaluate to asm "foo".

Reimplemented in llvm::PPCTargetMachine.

Definition at line 528 of file TargetMachine.h.

Referenced by EmitInlineAsmStr().

◆ useEmulatedTLS()

bool TargetMachine::useEmulatedTLS ( ) const

Returns true if this target uses emulated TLS.

Definition at line 260 of file TargetMachine.cpp.

References Options.

Referenced by llvm::SparcTargetLowering::LowerGlobalTLSAddress().

◆ useIPRA()

virtual bool llvm::TargetMachine::useIPRA ( ) const
inlinevirtual

True if the target wants to use interprocedural register allocation by default.

The -enable-ipra flag can be used to override this.

Reimplemented in llvm::GCNTargetMachine.

Definition at line 524 of file TargetMachine.h.

◆ usesPhysRegsForValues()

virtual bool llvm::TargetMachine::usesPhysRegsForValues ( ) const
inlinevirtual

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.

Reimplemented in llvm::SPIRVTargetMachine, and llvm::WebAssemblyTargetMachine.

Definition at line 520 of file TargetMachine.h.

◆ useTLSDESC()

bool TargetMachine::useTLSDESC ( ) const

Returns true if this target uses TLS Descriptors.

Definition at line 261 of file TargetMachine.cpp.

References Options.

Referenced by GetTLSADDR().

Member Data Documentation

◆ AsmInfo

std::unique_ptr<const MCAsmInfo> llvm::TargetMachine::AsmInfo
protected

Contains target specific asm information.

Definition at line 112 of file TargetMachine.h.

Referenced by llvm::BPFTargetMachine::BPFTargetMachine(), getMCAsmInfo(), llvm::CodeGenTargetMachineImpl::initAsmInfo(), and TargetMachine().

◆ CMModel

CodeModel::Model llvm::TargetMachine::CMModel = CodeModel::Small
protected

◆ DefaultSjLjDataSize

unsigned llvm::TargetMachine::DefaultSjLjDataSize = 32
staticconstexpr

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

Definition at line 456 of file TargetMachine.h.

Referenced by getSjLjDataSize().

◆ DL

const DataLayout llvm::TargetMachine::DL
protected

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

The DataLayout is created based on the string representation provided during construction. It is kept here only to avoid reparsing the string but should not really be used during compilation, because it has an internal cache that is context specific.

Definition at line 98 of file TargetMachine.h.

Referenced by createDataLayout(), getAllocaPointerSize(), getPointerSize(), getPointerSizeInBits(), getProgramPointerSize(), isCompatibleDataLayout(), isLargeGlobalValue(), and TargetMachine().

◆ LargeDataThreshold

uint64_t llvm::TargetMachine::LargeDataThreshold = 0
protected

Definition at line 108 of file TargetMachine.h.

Referenced by isLargeGlobalValue(), and setLargeDataThreshold().

◆ MII

std::unique_ptr<const MCInstrInfo> llvm::TargetMachine::MII
protected

◆ MRI

◆ O0WantsFastISel

unsigned llvm::TargetMachine::O0WantsFastISel
protected

Definition at line 118 of file TargetMachine.h.

Referenced by getO0WantsFastISel(), setO0WantsFastISel(), and TargetMachine().

◆ Options

TargetOptions llvm::TargetMachine::Options
mutable

Definition at line 124 of file TargetMachine.h.

Referenced by llvm::AArch64beTargetMachine::AArch64beTargetMachine(), llvm::AArch64leTargetMachine::AArch64leTargetMachine(), llvm::AArch64TargetMachine::AArch64TargetMachine(), llvm::CodeGenTargetMachineImpl::addPassesToEmitMC(), llvm::NVPTXTargetLowering::allowFMA(), llvm::AMDGPUTargetMachine::AMDGPUTargetMachine(), llvm::ARCTargetMachine::ARCTargetMachine(), llvm::ARMBaseTargetMachine::ARMBaseTargetMachine(), llvm::ARMBETargetMachine::ARMBETargetMachine(), llvm::ARMLETargetMachine::ARMLETargetMachine(), llvm::ARMFrameLowering::assignCalleeSavedSpillSlots(), llvm::AVRTargetMachine::AVRTargetMachine(), llvm::BPFTargetMachine::BPFTargetMachine(), llvm::SelectionDAG::canCreateUndefOrPoison(), llvm::AArch64RegisterInfo::cannotEliminateFrame(), llvm::ARMBaseRegisterInfo::cannotEliminateFrame(), llvm::CodeGenTargetMachineImpl::CodeGenTargetMachineImpl(), combineFaddCFmul(), combineFMinFMax(), combineFMinNumFMaxNum(), combineSelect(), llvm::MipsTargetLowering::createFastISel(), llvm::CodeGenTargetMachineImpl::createMCStreamer(), llvm::CSKYTargetMachine::CSKYTargetMachine(), llvm::ARMFrameLowering::determineCalleeSaves(), llvm::PPCFrameLowering::determineCalleeSaves(), llvm::TargetFrameLowering::determineCalleeSaves(), llvm::DirectXTargetMachine::DirectXTargetMachine(), llvm::PPCFrameLowering::eliminateCallFramePseudoInstr(), llvm::PPCFrameLowering::emitEpilogue(), llvm::X86FrameLowering::emitPrologue(), llvm::TargetLowering::expandFMINIMUMNUM_FMAXIMUMNUM(), foldFPToIntToFP(), llvm::GCNTargetMachine::GCNTargetMachine(), getAIXExtendedAltivecABI(), getBBSectionsFuncListBuf(), getBBSectionsType(), getDataSections(), getEnableStaticDataPartitioning(), getExceptionModel(), getFunctionSections(), getIgnoreXCOFFVisibility(), llvm::PPCTargetLowering::getNegatedExpression(), llvm::TargetLowering::getNegatedExpression(), llvm::RISCVMachineFunctionInfo::getPushPopKind(), llvm::ARMSubtarget::getPushPopSplitVariation(), llvm::X86RegisterInfo::getReservedRegs(), getSeparateNamedSections(), llvm::LoongArchTargetMachine::getSubtargetImpl(), llvm::RISCVTargetMachine::getSubtargetImpl(), getUniqueBasicBlockSectionNames(), getUniqueSectionNames(), getXCOFFTracebackTable(), llvm::AArch64FrameLowering::hasFPImpl(), llvm::ARCFrameLowering::hasFPImpl(), llvm::ARMFrameLowering::hasFPImpl(), llvm::CSKYFrameLowering::hasFPImpl(), llvm::LoongArchFrameLowering::hasFPImpl(), llvm::M68kFrameLowering::hasFPImpl(), llvm::MipsFrameLowering::hasFPImpl(), llvm::MSP430FrameLowering::hasFPImpl(), llvm::RISCVFrameLowering::hasFPImpl(), llvm::SIFrameLowering::hasFPImpl(), llvm::SparcFrameLowering::hasFPImpl(), llvm::SystemZELFFrameLowering::hasFPImpl(), llvm::VEFrameLowering::hasFPImpl(), llvm::X86FrameLowering::hasFPImpl(), llvm::XCoreFrameLowering::hasFPImpl(), llvm::XtensaFrameLowering::hasFPImpl(), llvm::HexagonTargetMachine::HexagonTargetMachine(), llvm::CodeGenTargetMachineImpl::initAsmInfo(), llvm::TargetLoweringObjectFileELF::Initialize(), isCombineInstrCandidateFP(), llvm::AArch64CallLowering::isEligibleForTailCallOptimization(), llvm::AMDGPUCallLowering::isEligibleForTailCallOptimization(), llvm::SITargetLowering::isEligibleForTailCallOptimization(), isFMAddSubOrFMSubAdd(), llvm::ARMFrameLowering::isFPReserved(), isLegalToCombineMinNumMaxNum(), llvm::AArch64TargetLowering::isProfitableToHoist(), llvm::PPCTargetLowering::isProfitableToHoist(), llvm::LanaiTargetMachine::LanaiTargetMachine(), llvm::AMDGPULegalizerInfo::legalizeFExp(), llvm::LoongArchTargetMachine::LoongArchTargetMachine(), llvm::RISCVTargetLowering::LowerCall(), llvm::SITargetLowering::LowerCall(), llvm::AArch64CallLowering::lowerCall(), llvm::AMDGPUTargetLowering::lowerFEXP(), llvm::AMDGPUTargetLowering::LowerFLOGCommon(), LowerFMINIMUM_FMAXIMUM(), llvm::AArch64CallLowering::lowerFormalArguments(), llvm::AMDGPUCallLowering::lowerTailCall(), llvm::M68kTargetMachine::M68kTargetMachine(), llvm::MipsebTargetMachine::MipsebTargetMachine(), llvm::MipselTargetMachine::MipselTargetMachine(), llvm::MipsTargetMachine::MipsTargetMachine(), llvm::MSP430TargetMachine::MSP430TargetMachine(), llvm::PPCFrameLowering::needsFP(), llvm::MachineFunction::needsFrameMoves(), llvm::NVPTXTargetMachine::NVPTXTargetMachine(), llvm::NVPTXTargetMachine32::NVPTXTargetMachine32(), llvm::NVPTXTargetMachine64::NVPTXTargetMachine64(), llvm::PPCTargetMachine::PPCTargetMachine(), llvm::PPCFrameLowering::processFunctionBeforeFrameFinalized(), promoteToConstantPool(), llvm::R600TargetMachine::R600TargetMachine(), llvm::RISCVTargetMachine::RISCVTargetMachine(), setCFIFixup(), setFastISel(), setGlobalISel(), setGlobalISelAbort(), setMachineOutliner(), setSupportsDebugEntryValues(), setSupportsDefaultOutlining(), llvm::SparcelTargetMachine::SparcelTargetMachine(), llvm::SparcTargetMachine::SparcTargetMachine(), llvm::SparcV8TargetMachine::SparcV8TargetMachine(), llvm::SparcV9TargetMachine::SparcV9TargetMachine(), llvm::SPIRVTargetMachine::SPIRVTargetMachine(), llvm::SystemZTargetMachine::SystemZTargetMachine(), TargetMachine(), useEmulatedTLS(), llvm::CSKYSubtarget::useHardFloatABI(), useTLSDESC(), llvm::VETargetMachine::VETargetMachine(), llvm::WebAssemblyTargetMachine::WebAssemblyTargetMachine(), llvm::X86TargetMachine::X86TargetMachine(), llvm::XCoreTargetMachine::XCoreTargetMachine(), llvm::XtensaTargetMachine::XtensaTargetMachine(), and llvm::XtensaTargetMachine::XtensaTargetMachine().

◆ OptLevel

◆ PGOOption

std::optional<PGOOptions> llvm::TargetMachine::PGOOption
protected

Definition at line 121 of file TargetMachine.h.

Referenced by getPGOOption(), and setPGOOption().

◆ RequireStructuredCFG

unsigned llvm::TargetMachine::RequireStructuredCFG
protected

Definition at line 117 of file TargetMachine.h.

Referenced by requiresStructuredCFG(), setRequiresStructuredCFG(), and TargetMachine().

◆ RM

Reloc::Model llvm::TargetMachine::RM = Reloc::Static
protected

Definition at line 106 of file TargetMachine.h.

Referenced by llvm::AArch64beTargetMachine::AArch64beTargetMachine(), llvm::AArch64leTargetMachine::AArch64leTargetMachine(), llvm::AArch64TargetMachine::AArch64TargetMachine(), llvm::AMDGPUTargetMachine::AMDGPUTargetMachine(), llvm::ARCTargetMachine::ARCTargetMachine(), llvm::ARMBaseTargetMachine::ARMBaseTargetMachine(), llvm::ARMBETargetMachine::ARMBETargetMachine(), llvm::ARMLETargetMachine::ARMLETargetMachine(), llvm::AVRTargetMachine::AVRTargetMachine(), llvm::BPFTargetMachine::BPFTargetMachine(), llvm::CodeGenTargetMachineImpl::CodeGenTargetMachineImpl(), llvm::CSKYTargetMachine::CSKYTargetMachine(), llvm::DirectXTargetMachine::DirectXTargetMachine(), llvm::GCNTargetMachine::GCNTargetMachine(), getRelocationModel(), getTLSModel(), llvm::HexagonTargetMachine::HexagonTargetMachine(), llvm::LanaiTargetMachine::LanaiTargetMachine(), llvm::LoongArchTargetMachine::LoongArchTargetMachine(), llvm::M68kTargetMachine::M68kTargetMachine(), llvm::MipsebTargetMachine::MipsebTargetMachine(), llvm::MipselTargetMachine::MipselTargetMachine(), llvm::MipsTargetMachine::MipsTargetMachine(), llvm::MSP430TargetMachine::MSP430TargetMachine(), llvm::NVPTXTargetMachine::NVPTXTargetMachine(), llvm::NVPTXTargetMachine32::NVPTXTargetMachine32(), llvm::NVPTXTargetMachine64::NVPTXTargetMachine64(), llvm::PPCTargetMachine::PPCTargetMachine(), llvm::R600TargetMachine::R600TargetMachine(), llvm::RISCVTargetMachine::RISCVTargetMachine(), shouldAssumeDSOLocal(), llvm::SparcelTargetMachine::SparcelTargetMachine(), llvm::SparcTargetMachine::SparcTargetMachine(), llvm::SparcV8TargetMachine::SparcV8TargetMachine(), llvm::SparcV9TargetMachine::SparcV9TargetMachine(), llvm::SPIRVTargetMachine::SPIRVTargetMachine(), llvm::SystemZTargetMachine::SystemZTargetMachine(), llvm::VETargetMachine::VETargetMachine(), llvm::WebAssemblyTargetMachine::WebAssemblyTargetMachine(), llvm::X86TargetMachine::X86TargetMachine(), llvm::XCoreTargetMachine::XCoreTargetMachine(), llvm::XtensaTargetMachine::XtensaTargetMachine(), and llvm::XtensaTargetMachine::XtensaTargetMachine().

◆ STI

std::unique_ptr<const MCSubtargetInfo> llvm::TargetMachine::STI
protected

Definition at line 115 of file TargetMachine.h.

Referenced by llvm::CodeGenTargetMachineImpl::addPassesToEmitMC(), llvm::AArch64TargetMachine::createMachineFunctionInfo(), llvm::ARCTargetMachine::createMachineFunctionInfo(), llvm::ARMBaseTargetMachine::createMachineFunctionInfo(), llvm::AVRTargetMachine::createMachineFunctionInfo(), llvm::CSKYTargetMachine::createMachineFunctionInfo(), llvm::GCNTargetMachine::createMachineFunctionInfo(), llvm::HexagonTargetMachine::createMachineFunctionInfo(), llvm::LanaiTargetMachine::createMachineFunctionInfo(), llvm::LoongArchTargetMachine::createMachineFunctionInfo(), llvm::M68kTargetMachine::createMachineFunctionInfo(), llvm::MipsTargetMachine::createMachineFunctionInfo(), llvm::MSP430TargetMachine::createMachineFunctionInfo(), llvm::NVPTXTargetMachine::createMachineFunctionInfo(), llvm::PPCTargetMachine::createMachineFunctionInfo(), llvm::R600TargetMachine::createMachineFunctionInfo(), llvm::RISCVTargetMachine::createMachineFunctionInfo(), llvm::SparcTargetMachine::createMachineFunctionInfo(), llvm::SystemZTargetMachine::createMachineFunctionInfo(), createMachineFunctionInfo(), llvm::VETargetMachine::createMachineFunctionInfo(), llvm::WebAssemblyTargetMachine::createMachineFunctionInfo(), llvm::X86TargetMachine::createMachineFunctionInfo(), llvm::XCoreTargetMachine::createMachineFunctionInfo(), llvm::XtensaTargetMachine::createMachineFunctionInfo(), llvm::CodeGenTargetMachineImpl::createMCStreamer(), getMCSubtargetInfo(), llvm::CodeGenTargetMachineImpl::initAsmInfo(), and TargetMachine().

◆ TargetCPU

◆ TargetFS

◆ TargetTriple

◆ TheTarget

const Target& llvm::TargetMachine::TheTarget
protected

The Target that this machine was created for.

Definition at line 90 of file TargetMachine.h.

Referenced by getTarget(), llvm::CodeGenTargetMachineImpl::initAsmInfo(), and TargetMachine().


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