14 #ifndef LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H 15 #define LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H 34 std::function<Expected<std::unique_ptr<MemoryBuffer>>(
Module &)>;
37 std::function<void(VModuleKey K, std::unique_ptr<Module>)>;
45 std::unique_ptr<Module> M)
override;
48 mutable std::mutex IRLayerMutex;
59 template <
typename BaseLayerT,
typename CompileFtor>
64 std::function<void(VModuleKey K, std::unique_ptr<Module>)>;
69 BaseLayerT &BaseLayer, CompileFtor Compile,
71 : BaseLayer(BaseLayer), Compile(
std::move(Compile)),
72 NotifyCompiled(
std::move(NotifyCompiled)) {}
79 this->NotifyCompiled = std::move(NotifyCompiled);
85 if (
auto Err = BaseLayer.addObject(std::move(K), Compile(*M)))
88 NotifyCompiled(std::move(K), std::move(M));
100 return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
112 bool ExportedSymbolsOnly) {
113 return BaseLayer.findSymbolIn(K, Name, ExportedSymbolsOnly);
122 BaseLayerT &BaseLayer;
131 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H Represents a symbol in the JIT.
Compute iterated dominance frontiers using a linear time algorithm.
A Module instance is used to store all the information related to an LLVM module. ...
Error removeModule(VModuleKey K)
Remove the module associated with the VModuleKey K.
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
std::function< void(VModuleKey K, std::unique_ptr< Module >)> NotifyCompiledCallback
Callback type for notifications when modules are compiled.
CompileFtor & getCompiler()
Get a reference to the compiler functor.
JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly)
Search for the given named symbol.
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Eager IR compiling layer.
Error addModule(VModuleKey K, std::unique_ptr< Module > M)
Compile the module, and add the resulting object to the base layer along with the given memory manage...
Interface for layers that accept LLVM IR.
std::function< Expected< std::unique_ptr< MemoryBuffer > >(Module &)> CompileFunction
Error emitAndFinalize(VModuleKey K)
Immediately emit and finalize the module represented by the given handle.
static ErrorSuccess success()
Create a success value.
void emit(MaterializationResponsibility R, VModuleKey K, std::unique_ptr< Module > M) override
Emit should materialize the given IR.
void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled)
An ExecutionSession represents a running JIT program.
IRCompileLayer2(ExecutionSession &ES, ObjectLayer &BaseLayer, CompileFunction Compile)
std::function< void(VModuleKey K, std::unique_ptr< Module >)> NotifyCompiledFunction
Lightweight error class with error context and mandatory checking.
Interface for Layers that accept object files.
void setNotifyCompiled(NotifyCompiledCallback NotifyCompiled)
(Re)set the NotifyCompiled callback.
IRCompileLayer(BaseLayerT &BaseLayer, CompileFtor Compile, NotifyCompiledCallback NotifyCompiled=NotifyCompiledCallback())
Construct an IRCompileLayer with the given BaseLayer, which must implement the ObjectLayer concept...
JITSymbol findSymbolIn(VModuleKey K, const std::string &Name, bool ExportedSymbolsOnly)
Get the address of the given symbol in compiled module represented by the handle H.