15 #ifndef LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H
16 #define LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H
31 template <
typename BaseLayerT>
42 template <
typename ModuleSetT,
typename MemoryManagerPtrT,
43 typename SymbolResolverPtrT>
45 MemoryManagerPtrT MemMgr,
46 SymbolResolverPtrT Resolver) {
47 return BaseLayer.addModuleSet(std::move(Ms), std::move(MemMgr),
56 SymbolTable[
Name] = Addr;
61 SymbolTable.erase(Name);
74 auto I = SymbolTable.find(Name);
75 if (
I != SymbolTable.end())
77 return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
89 bool ExportedSymbolsOnly) {
90 return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);
97 BaseLayer.emitAndFinalize(H);
101 BaseLayerT &BaseLayer;
102 std::map<std::string, JITTargetAddress> SymbolTable;
108 #endif // LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H
Represents a symbol in the JIT.
JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name, bool ExportedSymbolsOnly)
Get the address of the given symbol in the context of the set of modules represented by the handle H...
ModuleSetHandleT addModuleSet(ModuleSetT Ms, MemoryManagerPtrT MemMgr, SymbolResolverPtrT Resolver)
Add the given module set to the JIT.
BaseLayerT::ModuleSetHandleT ModuleSetHandleT
Handle to a set of added modules.
GlobalMappingLayer(BaseLayerT &BaseLayer)
Construct an GlobalMappingLayer with the given BaseLayer.
void eraseGlobalMapping(const std::string &Name)
Remove the given symbol from the global mapping.
void emitAndFinalize(ModuleSetHandleT H)
Immediately emit and finalize the module set represented by the given handle.
uint64_t JITTargetAddress
Represents an address in the target process's address space.
void setGlobalMapping(const std::string &Name, JITTargetAddress Addr)
Manually set the address to return for the given symbol.
JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly)
Search for the given named symbol.
void removeModuleSet(ModuleSetHandleT H)
Remove the module set associated with the handle H.