LLVM 20.0.0git
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::orc::LinkGraphLinkingLayer Class Reference

LinkGraphLinkingLayer links LinkGraphs into the Executor using JITLink. More...

#include "llvm/ExecutionEngine/Orc/LinkGraphLinkingLayer.h"

Inheritance diagram for llvm::orc::LinkGraphLinkingLayer:
Inheritance graph
[legend]

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.
 
LinkGraphLinkingLayeraddPlugin (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.
 
LinkGraphLinkingLayersetOverrideObjectFlagsWithResponsibilityFlags (bool OverrideObjectFlags)
 Instructs this LinkgraphLinkingLayer instance to override the symbol flags found in the LinkGraph with the flags supplied by the MaterializationResponsibility instance.
 
LinkGraphLinkingLayersetAutoClaimResponsibilityForObjectSymbols (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 ()
 
ExecutionSessiongetExecutionSession ()
 
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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ LinkGraphLinkingLayer() [1/3]

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().

◆ LinkGraphLinkingLayer() [2/3]

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().

◆ LinkGraphLinkingLayer() [3/3]

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).

◆ ~LinkGraphLinkingLayer()

llvm::orc::LinkGraphLinkingLayer::~LinkGraphLinkingLayer ( )

Member Function Documentation

◆ addPlugin()

LinkGraphLinkingLayer & llvm::orc::LinkGraphLinkingLayer::addPlugin ( std::shared_ptr< Plugin P)
inline

◆ emit() [1/2]

void llvm::orc::LinkGraphLinkingLayer::emit ( std::unique_ptr< MaterializationResponsibility R,
std::unique_ptr< jitlink::LinkGraph G 
)
overridevirtual

Emit a LinkGraph.

Implements llvm::orc::LinkGraphLayer.

Reimplemented in llvm::orc::ObjectLinkingLayer.

◆ emit() [2/2]

void llvm::orc::LinkGraphLinkingLayer::emit ( std::unique_ptr< MaterializationResponsibility R,
std::unique_ptr< jitlink::LinkGraph G,
std::unique_ptr< MemoryBuffer ObjBuf 
)
protected

Emit a LinkGraph with the given backing buffer.

This overload is intended for use by ObjectLinkingLayer.

◆ removePlugin()

void llvm::orc::LinkGraphLinkingLayer::removePlugin ( Plugin P)
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.

◆ setAutoClaimResponsibilityForObjectSymbols()

LinkGraphLinkingLayer & llvm::orc::LinkGraphLinkingLayer::setAutoClaimResponsibilityForObjectSymbols ( bool  AutoClaimObjectSymbols)
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.

◆ setOverrideObjectFlagsWithResponsibilityFlags()

LinkGraphLinkingLayer & llvm::orc::LinkGraphLinkingLayer::setOverrideObjectFlagsWithResponsibilityFlags ( bool  OverrideObjectFlags)
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.

Member Data Documentation

◆ ReturnObjectBuffer

std::function<void(std::unique_ptr<MemoryBuffer>)> llvm::orc::LinkGraphLinkingLayer::ReturnObjectBuffer
protected

The documentation for this class was generated from the following files: