14#ifndef LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
15#define LLVM_EXECUTIONENGINE_ORC_OBJECTLINKINGLAYER_H
35class EHFrameRegistrar;
42class ObjectLinkingLayerJITLinkContext;
97 std::function<void(std::unique_ptr<MemoryBuffer>)>;
112 std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr);
121 this->ReturnObjectBuffer = std::move(ReturnObjectBuffer);
126 std::lock_guard<std::mutex> Lock(LayerMutex);
127 Plugins.push_back(std::move(
P));
136 std::lock_guard<std::mutex> Lock(LayerMutex);
137 auto I =
llvm::find_if(Plugins, [&](
const std::shared_ptr<Plugin> &Elem) {
138 return Elem.get() == &
P;
140 assert(
I != Plugins.end() &&
"Plugin not present");
156 void emit(std::unique_ptr<MaterializationResponsibility> R,
157 std::unique_ptr<MemoryBuffer> O)
override;
160 void emit(std::unique_ptr<MaterializationResponsibility> R,
161 std::unique_ptr<jitlink::LinkGraph>
G);
173 this->OverrideObjectFlags = OverrideObjectFlags;
190 this->AutoClaimObjectSymbols = AutoClaimObjectSymbols;
204 mutable std::mutex LayerMutex;
206 std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgrOwnership;
207 bool OverrideObjectFlags =
false;
208 bool AutoClaimObjectSymbols =
false;
211 std::vector<std::shared_ptr<Plugin>> Plugins;
218 std::unique_ptr<jitlink::EHFrameRegistrar> Registrar);
229 std::mutex EHFramePluginMutex;
231 std::unique_ptr<jitlink::EHFrameRegistrar> Registrar;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Implements a dense probed hash-table based set.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Inheritance utility for extensible RTTI.
Holds context for a single jitLink invocation.
Represents a finalized allocation.
Manages allocations of JIT memory.
void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) override
Error notifyEmitted(MaterializationResponsibility &MR) override
Error notifyFailed(MaterializationResponsibility &MR) override
Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override
void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::PassConfiguration &PassConfig) override
An ExecutionSession represents a running JIT program.
Represents a JIT'd dynamic library.
ResourceTrackerSP getDefaultResourceTracker()
Get the default resource tracker for this JITDylib.
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
virtual Error add(ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > O, MaterializationUnit::Interface I)
Adds a MaterializationUnit for the object file in the given memory buffer to the JITDylib for the giv...
Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or e...
virtual Error notifyRemovingResources(JITDylib &JD, ResourceKey K)=0
virtual void notifyMaterializing(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx, MemoryBufferRef InputObject)
virtual Error notifyFailed(MaterializationResponsibility &MR)=0
DenseMap< SymbolStringPtr, JITLinkSymbolSet > SyntheticSymbolDependenciesMap
virtual void notifyLoaded(MaterializationResponsibility &MR)
virtual Error notifyEmitted(MaterializationResponsibility &MR)
virtual void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::PassConfiguration &Config)
virtual SyntheticSymbolDependenciesMap getSyntheticSymbolDependencies(MaterializationResponsibility &MR)
Return any dependencies that synthetic symbols (e.g.
virtual void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey)=0
An ObjectLayer implementation built on JITLink.
void removePlugin(Plugin &P)
Remove a plugin.
ObjectLinkingLayer & addPlugin(std::shared_ptr< Plugin > P)
Add a plugin.
ObjectLinkingLayer & setAutoClaimResponsibilityForObjectSymbols(bool AutoClaimObjectSymbols)
If set, this ObjectLinkingLayer instance will claim responsibility for any symbols provided by a give...
ObjectLinkingLayer & setOverrideObjectFlagsWithResponsibilityFlags(bool OverrideObjectFlags)
Instructs this ObjectLinkingLayer instance to override the symbol flags found in the AtomGraph with t...
void setReturnObjectBuffer(ReturnObjectBufferFunction ReturnObjectBuffer)
Set an object buffer return function.
std::function< void(std::unique_ptr< MemoryBuffer >)> ReturnObjectBufferFunction
Error add(ResourceTrackerSP, std::unique_ptr< jitlink::LinkGraph > G)
Add a LinkGraph to the JITDylib targeted by the given tracker.
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
Emit an object file.
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G)
Emit a LinkGraph.
~ObjectLinkingLayer()
Destruct an ObjectLinkingLayer.
ObjectLinkingLayer(ExecutionSession &ES, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr)
Construct an ObjectLinkingLayer.
Error add(JITDylib &JD, std::unique_ptr< jitlink::LinkGraph > G)
Add a LinkGraph to the given JITDylib.
Listens for ResourceTracker operations.
This is an optimization pass for GlobalISel generic memory operations.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes...