LLVM  6.0.0svn
Classes | Public Types | Public Member Functions | List of all members
llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT > Class Template Reference

Compile-on-demand layer. More...

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

Inheritance diagram for llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >:
Inheritance graph
[legend]

Public Types

using ModuleHandleT = typename LogicalDylibList::iterator
 Handle to loaded module. More...
 
using PartitioningFtor = std::function< std::set< Function * >(Function &)>
 Module partitioning functor. More...
 
using IndirectStubsManagerBuilderT = std::function< std::unique_ptr< IndirectStubsMgrT >()>
 Builder for IndirectStubsManagers. More...
 

Public Member Functions

 CompileOnDemandLayer (BaseLayerT &BaseLayer, PartitioningFtor Partition, CompileCallbackMgrT &CallbackMgr, IndirectStubsManagerBuilderT CreateIndirectStubsManager, bool CloneStubsIntoPartitions=true)
 Construct a compile-on-demand layer instance. More...
 
 ~CompileOnDemandLayer ()
 
Expected< ModuleHandleTaddModule (std::shared_ptr< Module > M, std::shared_ptr< JITSymbolResolver > Resolver)
 Add a module to the compile-on-demand layer. More...
 
Error addExtraModule (ModuleHandleT H, std::shared_ptr< Module > M)
 Add extra modules to an existing logical module. More...
 
Error removeModule (ModuleHandleT H)
 Remove the module represented by the given handle. More...
 
JITSymbol findSymbol (StringRef Name, bool ExportedSymbolsOnly)
 Search for the given named symbol. More...
 
JITSymbol findSymbolIn (ModuleHandleT H, const std::string &Name, bool ExportedSymbolsOnly)
 Get the address of a symbol provided by this layer, or some layer below this one. More...
 
Error updatePointer (std::string FuncName, JITTargetAddress FnBodyAddr)
 Update the stub for the given function to point at FnBodyAddr. More...
 

Detailed Description

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
class llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >

Compile-on-demand layer.

When a module is added to this layer a stub is created for each of its function definitions. The stubs and other global values are immediately added to the layer below. When a stub is called it triggers the extraction of the function body from the original module. The extracted body is then compiled and executed.

Definition at line 69 of file CompileOnDemandLayer.h.

Member Typedef Documentation

◆ IndirectStubsManagerBuilderT

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
using llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::IndirectStubsManagerBuilderT = std::function<std::unique_ptr<IndirectStubsMgrT>()>

Builder for IndirectStubsManagers.

Definition at line 205 of file CompileOnDemandLayer.h.

◆ ModuleHandleT

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
using llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::ModuleHandleT = typename LogicalDylibList::iterator

Handle to loaded module.

Definition at line 198 of file CompileOnDemandLayer.h.

◆ PartitioningFtor

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
using llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::PartitioningFtor = std::function<std::set<Function*>(Function&)>

Module partitioning functor.

Definition at line 201 of file CompileOnDemandLayer.h.

Constructor & Destructor Documentation

◆ CompileOnDemandLayer()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::CompileOnDemandLayer ( BaseLayerT &  BaseLayer,
PartitioningFtor  Partition,
CompileCallbackMgrT &  CallbackMgr,
IndirectStubsManagerBuilderT  CreateIndirectStubsManager,
bool  CloneStubsIntoPartitions = true 
)
inline

Construct a compile-on-demand layer instance.

Definition at line 208 of file CompileOnDemandLayer.h.

◆ ~CompileOnDemandLayer()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::~CompileOnDemandLayer ( )
inline

Definition at line 217 of file CompileOnDemandLayer.h.

Member Function Documentation

◆ addExtraModule()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
Error llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::addExtraModule ( ModuleHandleT  H,
std::shared_ptr< Module M 
)
inline

Add extra modules to an existing logical module.

Definition at line 241 of file CompileOnDemandLayer.h.

◆ addModule()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
Expected<ModuleHandleT> llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::addModule ( std::shared_ptr< Module M,
std::shared_ptr< JITSymbolResolver Resolver 
)
inline

Add a module to the compile-on-demand layer.

Definition at line 225 of file CompileOnDemandLayer.h.

◆ findSymbol()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
JITSymbol llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::findSymbol ( StringRef  Name,
bool  ExportedSymbolsOnly 
)
inline

Search for the given named symbol.

Parameters
NameThe name of the symbol to search for.
ExportedSymbolsOnlyIf true, search only for exported symbols.
Returns
A handle for the given named symbol, if it exists.

Definition at line 259 of file CompileOnDemandLayer.h.

◆ findSymbolIn()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
JITSymbol llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::findSymbolIn ( ModuleHandleT  H,
const std::string &  Name,
bool  ExportedSymbolsOnly 
)
inline

Get the address of a symbol provided by this layer, or some layer below this one.

Definition at line 274 of file CompileOnDemandLayer.h.

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::findSymbol().

◆ removeModule()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
Error llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::removeModule ( ModuleHandleT  H)
inline

Remove the module represented by the given handle.

This will remove all modules in the layers below that were derived from the module represented by H.

Definition at line 249 of file CompileOnDemandLayer.h.

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::~CompileOnDemandLayer().

◆ updatePointer()

template<typename BaseLayerT, typename CompileCallbackMgrT = JITCompileCallbackManager, typename IndirectStubsMgrT = IndirectStubsManager>
Error llvm::orc::CompileOnDemandLayer< BaseLayerT, CompileCallbackMgrT, IndirectStubsMgrT >::updatePointer ( std::string  FuncName,
JITTargetAddress  FnBodyAddr 
)
inline

Update the stub for the given function to point at FnBodyAddr.

This can be used to support re-optimization.

Returns
true if the function exists and the stub is updated, false otherwise.

Definition at line 287 of file CompileOnDemandLayer.h.


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