15 #ifndef LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H
16 #define LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H
26 class JITSymbolResolver;
37 template <
typename BaseLayerT>
50 std::shared_ptr<JITSymbolResolver> Resolver) {
51 return BaseLayer.addModule(std::move(M), std::move(Resolver));
59 SymbolTable[
Name] = Addr;
64 SymbolTable.erase(Name);
77 auto I = SymbolTable.find(Name);
78 if (
I != SymbolTable.end())
80 return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
92 bool ExportedSymbolsOnly) {
93 return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);
100 BaseLayer.emitAndFinalize(H);
104 BaseLayerT &BaseLayer;
105 std::map<std::string, JITTargetAddress> SymbolTable;
111 #endif // LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H
Represents a symbol in the JIT.
void emitAndFinalize(ModuleHandleT H)
Immediately emit and finalize the module set represented by the given handle.
typename BaseLayerT::ModuleHandleT ModuleHandleT
Handle to an added module.
GlobalMappingLayer(BaseLayerT &BaseLayer)
Construct an GlobalMappingLayer with the given BaseLayer.
uint64_t JITTargetAddress
Represents an address in the target process's address space.
void eraseGlobalMapping(const std::string &Name)
Remove the given symbol from the global mapping.
ModuleHandleT addModule(std::shared_ptr< Module > M, std::shared_ptr< JITSymbolResolver > Resolver)
Add the given module to the JIT.
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 removeModule(ModuleHandleT H)
Remove the module set associated with the handle H.
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...