LLVM  6.0.0svn
Public Types | Public Member Functions | List of all members
llvm::orc::GlobalMappingLayer< BaseLayerT > Class Template Reference

Global mapping layer. More...

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

Public Types

using ModuleHandleT = typename BaseLayerT::ModuleHandleT
 Handle to an added module. More...
 

Public Member Functions

 GlobalMappingLayer (BaseLayerT &BaseLayer)
 Construct an GlobalMappingLayer with the given BaseLayer. More...
 
Expected< ModuleHandleTaddModule (std::shared_ptr< Module > M, std::shared_ptr< JITSymbolResolver > Resolver)
 Add the given module to the JIT. More...
 
Error removeModule (ModuleHandleT H)
 Remove the module set associated with the handle H. More...
 
void setGlobalMapping (const std::string &Name, JITTargetAddress Addr)
 Manually set the address to return for the given symbol. More...
 
void eraseGlobalMapping (const std::string &Name)
 Remove the given symbol from the global mapping. More...
 
JITSymbol findSymbol (const std::string &Name, bool ExportedSymbolsOnly)
 Search for the given named symbol. More...
 
JITSymbol findSymbolIn (ModuleHandleT H, const std::string &Name, bool ExportedSymbolsOnly)
 Get the address of the given symbol in the context of the of the module represented by the handle H. More...
 
Error emitAndFinalize (ModuleHandleT H)
 Immediately emit and finalize the module set represented by the given handle. More...
 

Detailed Description

template<typename BaseLayerT>
class llvm::orc::GlobalMappingLayer< BaseLayerT >

Global mapping layer.

This layer overrides the findSymbol method to first search a local symbol table that the client can define. It can be used to inject new symbol mappings into the JIT. Beware, however: symbols within a single IR module or object file will still resolve locally (via RuntimeDyld's symbol table) - such internal references cannot be overriden via this layer.

Definition at line 38 of file GlobalMappingLayer.h.

Member Typedef Documentation

◆ ModuleHandleT

template<typename BaseLayerT >
using llvm::orc::GlobalMappingLayer< BaseLayerT >::ModuleHandleT = typename BaseLayerT::ModuleHandleT

Handle to an added module.

Definition at line 42 of file GlobalMappingLayer.h.

Constructor & Destructor Documentation

◆ GlobalMappingLayer()

template<typename BaseLayerT >
llvm::orc::GlobalMappingLayer< BaseLayerT >::GlobalMappingLayer ( BaseLayerT &  BaseLayer)
inline

Construct an GlobalMappingLayer with the given BaseLayer.

Definition at line 45 of file GlobalMappingLayer.h.

Member Function Documentation

◆ addModule()

template<typename BaseLayerT >
Expected<ModuleHandleT> llvm::orc::GlobalMappingLayer< BaseLayerT >::addModule ( std::shared_ptr< Module M,
std::shared_ptr< JITSymbolResolver Resolver 
)
inline

Add the given module to the JIT.

Returns
A handle for the added modules.

Definition at line 50 of file GlobalMappingLayer.h.

◆ emitAndFinalize()

template<typename BaseLayerT >
Error llvm::orc::GlobalMappingLayer< BaseLayerT >::emitAndFinalize ( ModuleHandleT  H)
inline

Immediately emit and finalize the module set represented by the given handle.

Parameters
HHandle for module set to emit/finalize.

Definition at line 100 of file GlobalMappingLayer.h.

◆ eraseGlobalMapping()

template<typename BaseLayerT >
void llvm::orc::GlobalMappingLayer< BaseLayerT >::eraseGlobalMapping ( const std::string &  Name)
inline

Remove the given symbol from the global mapping.

Definition at line 64 of file GlobalMappingLayer.h.

◆ findSymbol()

template<typename BaseLayerT >
JITSymbol llvm::orc::GlobalMappingLayer< BaseLayerT >::findSymbol ( const std::string &  Name,
bool  ExportedSymbolsOnly 
)
inline

Search for the given named symbol.

This method will first search the local symbol table, returning any symbol found there. If the symbol is not found in the local table then this call will be passed through to the base layer.

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 77 of file GlobalMappingLayer.h.

References llvm::JITSymbolFlags::Exported, and I.

◆ findSymbolIn()

template<typename BaseLayerT >
JITSymbol llvm::orc::GlobalMappingLayer< BaseLayerT >::findSymbolIn ( ModuleHandleT  H,
const std::string &  Name,
bool  ExportedSymbolsOnly 
)
inline

Get the address of the given symbol in the context of the of the module represented by the handle H.

This call is forwarded to the base layer's implementation.

Parameters
HThe handle for the module to search in.
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 is found in the given module.

Definition at line 92 of file GlobalMappingLayer.h.

◆ removeModule()

template<typename BaseLayerT >
Error llvm::orc::GlobalMappingLayer< BaseLayerT >::removeModule ( ModuleHandleT  H)
inline

Remove the module set associated with the handle H.

Definition at line 56 of file GlobalMappingLayer.h.

◆ setGlobalMapping()

template<typename BaseLayerT >
void llvm::orc::GlobalMappingLayer< BaseLayerT >::setGlobalMapping ( const std::string &  Name,
JITTargetAddress  Addr 
)
inline

Manually set the address to return for the given symbol.

Definition at line 59 of file GlobalMappingLayer.h.


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