15 #ifndef LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H 16 #define LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H 26 class JITSymbolResolver;
37 template <
typename BaseLayerT>
51 std::shared_ptr<JITSymbolResolver>
Resolver) {
52 return BaseLayer.addModule(std::move(M), std::move(Resolver));
60 SymbolTable[
Name] = Addr;
65 SymbolTable.erase(Name);
78 auto I = SymbolTable.find(Name);
79 if (
I != SymbolTable.end())
81 return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
93 bool ExportedSymbolsOnly) {
94 return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);
101 return BaseLayer.emitAndFinalize(H);
105 BaseLayerT &BaseLayer;
106 std::map<std::string, JITTargetAddress> SymbolTable;
112 #endif // LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H Represents a symbol in the JIT.
This class represents lattice values for constants.
Expected< ModuleHandleT > addModule(std::shared_ptr< Module > M, std::shared_ptr< JITSymbolResolver > Resolver)
Add the given module to the JIT.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Tagged union holding either a T or a Error.
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.
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Error emitAndFinalize(ModuleHandleT H)
Immediately emit and finalize the module set represented by the given handle.
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.
Error 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...
Lightweight error class with error context and mandatory checking.