14 #ifndef LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
15 #define LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
34 template <
typename BaseLayerT,
typename CompileFtor>
44 : BaseLayer(BaseLayer), Compile(std::move(Compile)) {}
55 std::shared_ptr<JITSymbolResolver> Resolver) {
56 using CompileResult = decltype(Compile(*M));
57 auto Obj = std::make_shared<CompileResult>(Compile(*M));
58 return BaseLayer.addObject(std::move(Obj), std::move(Resolver));
63 return BaseLayer.removeObject(H);
71 return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
83 bool ExportedSymbolsOnly) {
84 return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);
91 return BaseLayer.emitAndFinalize(H);
95 BaseLayerT &BaseLayer;
103 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H
Represents a symbol in the JIT.
Expected< ModuleHandleT > addModule(std::shared_ptr< Module > M, std::shared_ptr< JITSymbolResolver > Resolver)
Compile the module, and add the resulting object to the base layer along with the given memory manage...
Error removeModule(ModuleHandleT H)
Remove the module associated with the handle H.
CompileFtor & getCompiler()
Get a reference to the compiler functor.
Tagged union holding either a T or a Error.
JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly)
Search for the given named symbol.
Eager IR compiling layer.
IRCompileLayer(BaseLayerT &BaseLayer, CompileFtor Compile)
Construct an IRCompileLayer with the given BaseLayer, which must implement the ObjectLayer concept...
Error emitAndFinalize(ModuleHandleT H)
Immediately emit and finalize the module represented by the given handle.
typename ObjectLayerT::ObjHandleT ModuleHandleT
Handle to a compiled module.
Lightweight error class with error context and mandatory checking.
JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name, bool ExportedSymbolsOnly)
Get the address of the given symbol in compiled module represented by the handle H.