LLVM  10.0.0svn
Public Member Functions | Static Public Member Functions | 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...
 
JITTargetMachineBuildersetCodeModel (Optional< CodeModel::Model > CM)
 Set the code model. More...
 
JITTargetMachineBuildersetCodeGenOptLevel (CodeGenOpt::Level OptLevel)
 Set the LLVM CodeGen optimization level. More...
 
JITTargetMachineBuilderaddFeatures (const std::vector< std::string > &FeatureVec)
 Add subtarget features. More...
 
SubtargetFeaturesgetFeatures ()
 Access subtarget features. More...
 
const SubtargetFeaturesgetFeatures () const
 Access subtarget features. 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...
 

Detailed Description

A utility class for building TargetMachines for JITs.

Definition at line 31 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 16 of file JITTargetMachineBuilder.cpp.

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

Referenced by detectHost().

Member Function Documentation

◆ addFeatures()

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

Add subtarget features.

Definition at line 46 of file JITTargetMachineBuilder.cpp.

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

Referenced by setCodeGenOptLevel().

◆ 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 29 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 22 of file JITTargetMachineBuilder.cpp.

References llvm::sys::getProcessTriple(), and JITTargetMachineBuilder().

Referenced by llvm::orc::LLJITBuilderState::prepareForConstruction().

◆ 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 63 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 99 of file JITTargetMachineBuilder.h.

◆ getFeatures() [2/2]

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

Access subtarget features.

Definition at line 102 of file JITTargetMachineBuilder.h.

◆ getOptions() [1/2]

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

Access TargetOptions.

Definition at line 105 of file JITTargetMachineBuilder.h.

◆ getOptions() [2/2]

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

Access TargetOptions.

Definition at line 108 of file JITTargetMachineBuilder.h.

◆ getTargetTriple() [1/2]

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

Access Triple.

Definition at line 111 of file JITTargetMachineBuilder.h.

◆ getTargetTriple() [2/2]

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

Access Triple.

Definition at line 114 of file JITTargetMachineBuilder.h.

References llvm::CodeGenOpt::None.

◆ setCodeGenOptLevel()

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

Set the LLVM CodeGen optimization level.

Definition at line 89 of file JITTargetMachineBuilder.h.

References addFeatures().

◆ setCodeModel()

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

Set the code model.

Definition at line 83 of file JITTargetMachineBuilder.h.

◆ setCPU()

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

Set the CPU string.

Definition at line 71 of file JITTargetMachineBuilder.h.

◆ setRelocationModel()

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

Set the relocation model.

Definition at line 77 of file JITTargetMachineBuilder.h.


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