13#ifndef LLVM_EXECUTIONENGINE_ORC_LINKGRAPHLINKINGLAYER_H
14#define LLVM_EXECUTIONENGINE_ORC_LINKGRAPHLINKINGLAYER_H
34class EHFrameRegistrar;
87 std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgr);
94 std::lock_guard<std::mutex> Lock(LayerMutex);
95 Plugins.push_back(std::move(
P));
104 std::lock_guard<std::mutex> Lock(LayerMutex);
105 auto I =
llvm::find_if(Plugins, [&](
const std::shared_ptr<Plugin> &Elem) {
106 return Elem.get() == &
P;
108 assert(
I != Plugins.end() &&
"Plugin not present");
113 void emit(std::unique_ptr<MaterializationResponsibility> R,
114 std::unique_ptr<jitlink::LinkGraph>
G)
override;
126 this->OverrideObjectFlags = OverrideObjectFlags;
143 this->AutoClaimObjectSymbols = AutoClaimObjectSymbols;
151 void emit(std::unique_ptr<MaterializationResponsibility> R,
152 std::unique_ptr<jitlink::LinkGraph>
G,
153 std::unique_ptr<MemoryBuffer> ObjBuf);
167 mutable std::mutex LayerMutex;
169 std::unique_ptr<jitlink::JITLinkMemoryManager> MemMgrOwnership;
170 bool OverrideObjectFlags =
false;
171 bool AutoClaimObjectSymbols =
false;
173 std::vector<std::shared_ptr<Plugin>> Plugins;
180 std::unique_ptr<jitlink::EHFrameRegistrar> Registrar);
191 std::mutex EHFramePluginMutex;
193 std::unique_ptr<jitlink::EHFrameRegistrar> Registrar;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
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.
Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or e...
virtual Error notifyEmitted(MaterializationResponsibility &MR)
virtual Error notifyRemovingResources(JITDylib &JD, ResourceKey K)=0
virtual Error notifyFailed(MaterializationResponsibility &MR)=0
virtual void notifyLoaded(MaterializationResponsibility &MR)
virtual void notifyMaterializing(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx, MemoryBufferRef InputObject)
virtual void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::PassConfiguration &Config)
virtual void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey)=0
LinkGraphLinkingLayer links LinkGraphs into the Executor using JITLink.
LinkGraphLinkingLayer(ExecutionSession &ES, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr)
Construct an LinkGraphLinkingLayer.
LinkGraphLinkingLayer & setAutoClaimResponsibilityForObjectSymbols(bool AutoClaimObjectSymbols)
If set, this LinkGraphLinkingLayer instance will claim responsibility for any symbols provided by a g...
void removePlugin(Plugin &P)
Remove a plugin.
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G) override
Emit a LinkGraph.
LinkGraphLinkingLayer & setOverrideObjectFlagsWithResponsibilityFlags(bool OverrideObjectFlags)
Instructs this LinkgraphLinkingLayer instance to override the symbol flags found in the LinkGraph wit...
std::function< void(std::unique_ptr< MemoryBuffer >)> ReturnObjectBuffer
void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G, std::unique_ptr< MemoryBuffer > ObjBuf)
Emit a LinkGraph with the given backing buffer.
~LinkGraphLinkingLayer()
Destroy the LinkGraphLinkingLayer.
LinkGraphLinkingLayer & addPlugin(std::shared_ptr< Plugin > P)
Add a plugin.
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
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...