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, ThreadSafeModule TSM)>;
47 mutable std::mutex IRLayerMutex;
58 template <
typename BaseLayerT,
typename CompileFtor>
63 std::function<void(VModuleKey K, std::unique_ptr<Module>)>;
68 BaseLayerT &BaseLayer, CompileFtor Compile,
70 : BaseLayer(BaseLayer), Compile(
std::move(Compile)),
71 NotifyCompiled(
std::move(NotifyCompiled)) {}
78 this->NotifyCompiled = std::move(NotifyCompiled);
84 if (
auto Err = BaseLayer.addObject(std::move(K), Compile(*M)))
87 NotifyCompiled(std::move(K), std::move(M));
99 return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
111 bool ExportedSymbolsOnly) {
112 return BaseLayer.findSymbolIn(K, Name, ExportedSymbolsOnly);
121 BaseLayerT &BaseLayer;
130 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H void setNotifyCompiled(NotifyCompiledFunction NotifyCompiled)
IRCompileLayer(ExecutionSession &ES, ObjectLayer &BaseLayer, CompileFunction Compile)
Represents a symbol in the JIT.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void emit(MaterializationResponsibility R, ThreadSafeModule TSM) override
Emit should materialize the given IR.
LegacyIRCompileLayer(BaseLayerT &BaseLayer, CompileFtor Compile, NotifyCompiledCallback NotifyCompiled=NotifyCompiledCallback())
Construct an LegacyIRCompileLayer with the given BaseLayer, which must implement the ObjectLayer conc...
std::function< void(VModuleKey K, std::unique_ptr< Module >)> NotifyCompiledCallback
Callback type for notifications when modules are compiled.
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
std::function< Expected< std::unique_ptr< MemoryBuffer > >(Module &)> CompileFunction
Error removeModule(VModuleKey K)
Remove the module associated with the VModuleKey K.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
Error emitAndFinalize(VModuleKey K)
Immediately emit and finalize the module represented by the given handle.
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
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.
An LLVM Module together with a shared ThreadSafeContext.
Eager IR compiling layer.
Interface for layers that accept LLVM IR.
static ErrorSuccess success()
Create a success value.
CompileFtor & getCompiler()
Get a reference to the compiler functor.
void setNotifyCompiled(NotifyCompiledCallback NotifyCompiled)
(Re)set the NotifyCompiled callback.
An ExecutionSession represents a running JIT program.
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...
Lightweight error class with error context and mandatory checking.
Interface for Layers that accept object files.
std::function< void(VModuleKey K, ThreadSafeModule TSM)> NotifyCompiledFunction
JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly)
Search for the given named symbol.