LLVM  11.0.0git
Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::orc::JITTargetMachineBuilder Class Reference

A utility class for building TargetMachines for JITs. More...

#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"

Public Member Functions

 JITTargetMachineBuilder (Triple TT)
 Create a JITTargetMachineBuilder based on the given triple. More...
 
Expected< std::unique_ptr< TargetMachine > > createTargetMachine ()
 Create a TargetMachine. More...
 
Expected< DataLayoutgetDefaultDataLayoutForTarget ()
 Get the default DataLayout for the target. More...
 
JITTargetMachineBuildersetCPU (std::string CPU)
 Set the CPU string. More...
 
JITTargetMachineBuildersetRelocationModel (Optional< Reloc::Model > RM)
 Set the relocation model. More...
 
const Optional< Reloc::Model > & getRelocationModel () const
 Get the relocation model. More...
 
JITTargetMachineBuildersetCodeModel (Optional< CodeModel::Model > CM)
 Set the code model. More...
 
const Optional< CodeModel::Model > & getCodeModel () const
 Get the code model. More...
 
JITTargetMachineBuildersetCodeGenOptLevel (CodeGenOpt::Level OptLevel)
 Set the LLVM CodeGen optimization level. More...
 
JITTargetMachineBuildersetFeatures (StringRef FeatureString)
 Set subtarget features. More...
 
JITTargetMachineBuilderaddFeatures (const std::vector< std::string > &FeatureVec)
 Add subtarget features. More...
 
SubtargetFeaturesgetFeatures ()
 Access subtarget features. More...
 
const SubtargetFeaturesgetFeatures () const
 Access subtarget features. More...
 
JITTargetMachineBuildersetOptions (TargetOptions Options)
 Set TargetOptions. More...
 
TargetOptionsgetOptions ()
 Access TargetOptions. More...
 
const TargetOptionsgetOptions () const
 Access TargetOptions. More...
 
TriplegetTargetTriple ()
 Access Triple. More...
 
const TriplegetTargetTriple () const
 Access Triple. More...
 

Static Public Member Functions

static Expected< JITTargetMachineBuilderdetectHost ()
 Create a JITTargetMachineBuilder for the host system. More...
 

Friends

raw_ostreamoperator<< (raw_ostream &OS, const JITTargetMachineBuilder &JTMB)
 Debug-dump a JITTargetMachineBuilder. More...
 

Detailed Description

A utility class for building TargetMachines for JITs.

Definition at line 34 of file JITTargetMachineBuilder.h.

Constructor & Destructor Documentation

◆ JITTargetMachineBuilder()

llvm::orc::JITTargetMachineBuilder::JITTargetMachineBuilder ( Triple  TT)

Create a JITTargetMachineBuilder based on the given triple.

Note: TargetOptions is default-constructed, then EmulatedTLS and ExplicitEmulatedTLS are set to true. If EmulatedTLS is not required, these values should be reset before calling createTargetMachine.

Definition at line 18 of file JITTargetMachineBuilder.cpp.

References llvm::TargetOptions::EmulatedTLS, and llvm::TargetOptions::ExplicitEmulatedTLS.

Member Function Documentation

◆ addFeatures()

JITTargetMachineBuilder & llvm::orc::JITTargetMachineBuilder::addFeatures ( const std::vector< std::string > &  FeatureVec)

Add subtarget features.

Definition at line 60 of file JITTargetMachineBuilder.cpp.

References llvm::SubtargetFeatures::AddFeature(), and F().

Referenced by setFeatures().

◆ createTargetMachine()

Expected< std::unique_ptr< TargetMachine > > llvm::orc::JITTargetMachineBuilder::createTargetMachine ( )

Create a TargetMachine.

This operation will fail if the requested target is not registered, in which case see llvm/Support/TargetSelect.h. To JIT IR the Target and the target's AsmPrinter must both be registered. To JIT assembly (including inline and module level assembly) the target's AsmParser must also be registered.

Definition at line 43 of file JITTargetMachineBuilder.cpp.

References llvm::SubtargetFeatures::getString(), llvm::Triple::getTriple(), llvm::inconvertibleErrorCode(), llvm::TargetRegistry::lookupTarget(), and llvm::SystemZISD::TM.

Referenced by llvm::orc::LLJIT::createCompileFunction(), getDefaultDataLayoutForTarget(), and llvm::orc::ConcurrentIRCompiler::operator()().

◆ detectHost()

Expected< JITTargetMachineBuilder > llvm::orc::JITTargetMachineBuilder::detectHost ( )
static

Create a JITTargetMachineBuilder for the host system.

Note: TargetOptions is default-constructed, then EmulatedTLS and ExplicitEmulatedTLS are set to true. If EmulatedTLS is not required, these values should be reset before calling createTargetMachine.

Definition at line 24 of file JITTargetMachineBuilder.cpp.

References llvm::SubtargetFeatures::AddFeature(), getFeatures(), llvm::sys::getHostCPUFeatures(), llvm::sys::getHostCPUName(), llvm::sys::getProcessTriple(), and setCPU().

Referenced by LLVMOrcJITTargetMachineBuilderDetectHost(), and llvm::orc::LLJITBuilderState::prepareForConstruction().

◆ getCodeModel()

const Optional<CodeModel::Model>& llvm::orc::JITTargetMachineBuilder::getCodeModel ( ) const
inline

Get the code model.

Definition at line 95 of file JITTargetMachineBuilder.h.

◆ getDefaultDataLayoutForTarget()

Expected<DataLayout> llvm::orc::JITTargetMachineBuilder::getDefaultDataLayoutForTarget ( )
inline

Get the default DataLayout for the target.

Note: This is reasonably expensive, as it creates a temporary TargetMachine instance under the hood. It is only suitable for use during JIT setup.

Definition at line 66 of file JITTargetMachineBuilder.h.

References createTargetMachine(), and llvm::SystemZISD::TM.

◆ getFeatures() [1/2]

SubtargetFeatures& llvm::orc::JITTargetMachineBuilder::getFeatures ( )
inline

Access subtarget features.

Definition at line 114 of file JITTargetMachineBuilder.h.

Referenced by detectHost().

◆ getFeatures() [2/2]

const SubtargetFeatures& llvm::orc::JITTargetMachineBuilder::getFeatures ( ) const
inline

Access subtarget features.

Definition at line 117 of file JITTargetMachineBuilder.h.

◆ getOptions() [1/2]

TargetOptions& llvm::orc::JITTargetMachineBuilder::getOptions ( )
inline

Access TargetOptions.

Definition at line 131 of file JITTargetMachineBuilder.h.

◆ getOptions() [2/2]

const TargetOptions& llvm::orc::JITTargetMachineBuilder::getOptions ( ) const
inline

Access TargetOptions.

Definition at line 134 of file JITTargetMachineBuilder.h.

◆ getRelocationModel()

const Optional<Reloc::Model>& llvm::orc::JITTargetMachineBuilder::getRelocationModel ( ) const
inline

Get the relocation model.

Definition at line 86 of file JITTargetMachineBuilder.h.

◆ getTargetTriple() [1/2]

Triple& llvm::orc::JITTargetMachineBuilder::getTargetTriple ( )
inline

Access Triple.

Definition at line 137 of file JITTargetMachineBuilder.h.

◆ getTargetTriple() [2/2]

const Triple& llvm::orc::JITTargetMachineBuilder::getTargetTriple ( ) const
inline

Access Triple.

Definition at line 140 of file JITTargetMachineBuilder.h.

References llvm::CodeGenOpt::Default, and operator<<.

◆ setCodeGenOptLevel()

JITTargetMachineBuilder& llvm::orc::JITTargetMachineBuilder::setCodeGenOptLevel ( CodeGenOpt::Level  OptLevel)
inline

Set the LLVM CodeGen optimization level.

Definition at line 98 of file JITTargetMachineBuilder.h.

◆ setCodeModel()

JITTargetMachineBuilder& llvm::orc::JITTargetMachineBuilder::setCodeModel ( Optional< CodeModel::Model CM)
inline

Set the code model.

Definition at line 89 of file JITTargetMachineBuilder.h.

◆ setCPU()

JITTargetMachineBuilder& llvm::orc::JITTargetMachineBuilder::setCPU ( std::string  CPU)
inline

Set the CPU string.

Definition at line 74 of file JITTargetMachineBuilder.h.

Referenced by detectHost().

◆ setFeatures()

JITTargetMachineBuilder& llvm::orc::JITTargetMachineBuilder::setFeatures ( StringRef  FeatureString)
inline

Set subtarget features.

Definition at line 104 of file JITTargetMachineBuilder.h.

References addFeatures().

◆ setOptions()

JITTargetMachineBuilder& llvm::orc::JITTargetMachineBuilder::setOptions ( TargetOptions  Options)
inline

Set TargetOptions.

Note: This operation will overwrite any previously configured options, including EmulatedTLS and ExplicitEmulatedTLS which the JITTargetMachineBuilder sets by default. Clients are responsible for re-enabling these overwritten options.

Definition at line 125 of file JITTargetMachineBuilder.h.

◆ setRelocationModel()

JITTargetMachineBuilder& llvm::orc::JITTargetMachineBuilder::setRelocationModel ( Optional< Reloc::Model RM)
inline

Set the relocation model.

Definition at line 80 of file JITTargetMachineBuilder.h.

Friends And Related Function Documentation

◆ operator<<

raw_ostream& operator<< ( raw_ostream OS,
const JITTargetMachineBuilder JTMB 
)
friend

Debug-dump a JITTargetMachineBuilder.

Definition at line 68 of file JITTargetMachineBuilder.cpp.

Referenced by getTargetTriple().


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