LLVM 20.0.0git
|
LinkGraphLinkingLayer links LinkGraphs into the Executor using JITLink. More...
#include "llvm/ExecutionEngine/Orc/LinkGraphLinkingLayer.h"
Classes | |
class | JITLinkCtx |
class | Plugin |
Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or emitted, and when JITLink is being configured. More... | |
Public Member Functions | |
LinkGraphLinkingLayer (ExecutionSession &ES) | |
Construct a LinkGraphLinkingLayer using the ExecutorProcessControl instance's memory manager. | |
LinkGraphLinkingLayer (ExecutionSession &ES, jitlink::JITLinkMemoryManager &MemMgr) | |
Construct a LinkGraphLinkingLayer using a custom memory manager. | |
LinkGraphLinkingLayer (ExecutionSession &ES, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr) | |
Construct an LinkGraphLinkingLayer. | |
~LinkGraphLinkingLayer () | |
Destroy the LinkGraphLinkingLayer. | |
LinkGraphLinkingLayer & | addPlugin (std::shared_ptr< Plugin > P) |
Add a plugin. | |
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 with the flags supplied by the MaterializationResponsibility instance. | |
LinkGraphLinkingLayer & | setAutoClaimResponsibilityForObjectSymbols (bool AutoClaimObjectSymbols) |
If set, this LinkGraphLinkingLayer instance will claim responsibility for any symbols provided by a given object file that were not already in the MaterializationResponsibility instance. | |
Public Member Functions inherited from llvm::orc::LinkGraphLayer | |
LinkGraphLayer (ExecutionSession &ES) | |
virtual | ~LinkGraphLayer () |
ExecutionSession & | getExecutionSession () |
virtual Error | add (ResourceTrackerSP RT, std::unique_ptr< jitlink::LinkGraph > G, MaterializationUnit::Interface I) |
Adds a LinkGraph to the JITDylib for the given ResourceTracker. | |
Error | add (ResourceTrackerSP RT, std::unique_ptr< jitlink::LinkGraph > G) |
Adds a LinkGraph to the JITDylib for the given ResourceTracker. | |
Error | add (JITDylib &JD, std::unique_ptr< jitlink::LinkGraph > G, MaterializationUnit::Interface I) |
Adds a LinkGraph to the given JITDylib. | |
Error | add (JITDylib &JD, std::unique_ptr< jitlink::LinkGraph > G) |
Adds a LinkGraph to the given JITDylib. | |
virtual void | emit (std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G)=0 |
Emit should materialize the given IR. | |
MaterializationUnit::Interface | getInterface (jitlink::LinkGraph &G) |
Get the interface for the given LinkGraph. | |
Protected Member Functions | |
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. | |
Protected Attributes | |
std::function< void(std::unique_ptr< MemoryBuffer >)> | ReturnObjectBuffer |
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::orc::LinkGraphLayer | |
static JITSymbolFlags | getJITSymbolFlagsForSymbol (jitlink::Symbol &Sym) |
Get the JITSymbolFlags for the given symbol. | |
LinkGraphLinkingLayer links LinkGraphs into the Executor using JITLink.
Clients can use this class to add LinkGraphs to an ExecutionSession, and it serves as a base for the ObjectLinkingLayer that can link object files.
Definition at line 43 of file LinkGraphLinkingLayer.h.
llvm::orc::LinkGraphLinkingLayer::LinkGraphLinkingLayer | ( | ExecutionSession & | ES | ) |
Construct a LinkGraphLinkingLayer using the ExecutorProcessControl instance's memory manager.
Definition at line 484 of file LinkGraphLinkingLayer.cpp.
References llvm::orc::ExecutionSession::registerResourceManager().
llvm::orc::LinkGraphLinkingLayer::LinkGraphLinkingLayer | ( | ExecutionSession & | ES, |
jitlink::JITLinkMemoryManager & | MemMgr | ||
) |
Construct a LinkGraphLinkingLayer using a custom memory manager.
Definition at line 489 of file LinkGraphLinkingLayer.cpp.
References llvm::orc::ExecutionSession::registerResourceManager().
llvm::orc::LinkGraphLinkingLayer::LinkGraphLinkingLayer | ( | ExecutionSession & | ES, |
std::unique_ptr< jitlink::JITLinkMemoryManager > | MemMgr | ||
) |
Construct an LinkGraphLinkingLayer.
Takes ownership of the given JITLinkMemoryManager. This method is a temporary hack to simplify co-existence with RTDyldObjectLinkingLayer (which also owns its allocators).
llvm::orc::LinkGraphLinkingLayer::~LinkGraphLinkingLayer | ( | ) |
Destroy the LinkGraphLinkingLayer.
Definition at line 501 of file LinkGraphLinkingLayer.cpp.
References assert(), llvm::orc::ExecutionSession::deregisterResourceManager(), and llvm::orc::LinkGraphLayer::getExecutionSession().
|
inline |
Add a plugin.
Definition at line 93 of file LinkGraphLinkingLayer.h.
References P.
Referenced by llvm::orc::JITLinkReentryTrampolines::JITLinkReentryTrampolines(), and llvm::orc::LazyObjectLinkingLayer::LazyObjectLinkingLayer().
|
overridevirtual |
Emit a LinkGraph.
Implements llvm::orc::LinkGraphLayer.
Reimplemented in llvm::orc::ObjectLinkingLayer.
|
protected |
Emit a LinkGraph with the given backing buffer.
This overload is intended for use by ObjectLinkingLayer.
|
inline |
Remove a plugin.
This remove applies only to subsequent links (links already underway will continue to use the plugin), and does not of itself destroy the plugin – destruction will happen once all shared pointers (including those held by in-progress links) are destroyed.
Definition at line 103 of file LinkGraphLinkingLayer.h.
References assert(), llvm::find_if(), I, and P.
|
inline |
If set, this LinkGraphLinkingLayer instance will claim responsibility for any symbols provided by a given object file that were not already in the MaterializationResponsibility instance.
Setting this flag allows higher-level program representations (e.g. LLVM IR) to be added based on only a subset of the symbols they provide, without having to write intervening layers to scan and add the additional symbols. This trades diagnostic quality for convenience however: If all symbols are enumerated up-front then clashes can be detected and reported early (and usually deterministically). If this option is set, clashes for the additional symbols may not be detected until late, and detection may depend on the flow of control through JIT'd code. Use with care.
Definition at line 142 of file LinkGraphLinkingLayer.h.
|
inline |
Instructs this LinkgraphLinkingLayer instance to override the symbol flags found in the LinkGraph with the flags supplied by the MaterializationResponsibility instance.
This is a workaround to support symbol visibility in COFF, which does not use the libObject's SF_Exported flag. Use only when generating / adding COFF object files.
FIXME: We should be able to remove this if/when COFF properly tracks exported symbols.
Definition at line 125 of file LinkGraphLinkingLayer.h.
|
protected |
Definition at line 155 of file LinkGraphLinkingLayer.h.
Referenced by llvm::orc::ObjectLinkingLayer::setReturnObjectBuffer(), and llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::~JITLinkCtx().