LLVM 24.0.0git
llvm::orc::LinkGraphLinkingLayer::JITLinkCtx Class Referencefinal
Inheritance diagram for llvm::orc::LinkGraphLinkingLayer::JITLinkCtx:
[legend]

Public Member Functions

 JITLinkCtx (LinkGraphLinkingLayer &Layer, std::unique_ptr< MaterializationResponsibility > MR, std::unique_ptr< MemoryBuffer > ObjBuffer)
 ~JITLinkCtx () override
JITLinkMemoryManager & getMemoryManager () override
 Return the MemoryManager to be used for this link.
void notifyMaterializing (LinkGraph &G)
void notifyFailed (Error Err) override
 Notify this context that linking failed.
void lookup (LookupMap Symbols, std::unique_ptr< JITLinkAsyncLookupContinuation > LC) override
 Called by JITLink to resolve external symbols.
Error notifyResolved (LinkGraph &G) override
 Called by JITLink once all defined symbols in the graph have been assigned their final memory locations in the target process.
void notifyFinalized (JITLinkMemoryManager::FinalizedAlloc A) override
 Called by JITLink to notify the context that the object has been finalized (i.e.
LinkGraphPassFunction getMarkLivePass (const Triple &TT) const override
 Returns the mark-live pass to be used for this link.
Error modifyPassConfig (LinkGraph &LG, PassConfiguration &Config) override
 Called by JITLink to modify the pass pipeline prior to linking.
Error notifyEmitted (jitlink::JITLinkMemoryManager::FinalizedAlloc FA)

Additional Inherited Members

Detailed Description

Definition at line 116 of file LinkGraphLinkingLayer.cpp.

Constructor & Destructor Documentation

◆ JITLinkCtx()

llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::JITLinkCtx ( LinkGraphLinkingLayer & Layer,
std::unique_ptr< MaterializationResponsibility > MR,
std::unique_ptr< MemoryBuffer > ObjBuffer )
inline

◆ ~JITLinkCtx()

llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::~JITLinkCtx ( )
inlineoverride

Definition at line 127 of file LinkGraphLinkingLayer.cpp.

Member Function Documentation

◆ getMarkLivePass()

LinkGraphPassFunction llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::getMarkLivePass ( const Triple & TT) const
inlineoverridevirtual

Returns the mark-live pass to be used for this link.

If no pass is returned (the default) then the target-specific linker implementation will choose a conservative default (usually marking all symbols live). This function is only called if shouldAddDefaultTargetPasses returns true, otherwise the JITContext is responsible for adding a mark-live pass in modifyPassConfig.

Reimplemented from llvm::jitlink::JITLinkContext.

Definition at line 288 of file LinkGraphLinkingLayer.cpp.

References G.

◆ getMemoryManager()

JITLinkMemoryManager & llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::getMemoryManager ( )
inlineoverridevirtual

Return the MemoryManager to be used for this link.

Implements llvm::jitlink::JITLinkContext.

Definition at line 134 of file LinkGraphLinkingLayer.cpp.

◆ lookup()

void llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::lookup ( LookupMap Symbols,
std::unique_ptr< JITLinkAsyncLookupContinuation > LC )
inlineoverridevirtual

Called by JITLink to resolve external symbols.

This method is passed a lookup continutation which it must call with a result to continue the linking process.

The lookup continuation may destroy the LinkGraph, and with it the SymbolStringPool that owns the elements of Symbols if the graph holds the only reference to the pool. Implementations must not hold any SymbolStringPtrs from the pool (including the elements of Symbols) across the call to the continuation unless they ensure that the pool outlives that call, e.g. by holding a reference to it. The LinkGraph is not passed to this method, so implementations that need such a reference should obtain one earlier (e.g. via LinkGraph::getSymbolStringPool in modifyPassConfig), or from whatever owns the pool.

Implements llvm::jitlink::JITLinkContext.

Definition at line 150 of file LinkGraphLinkingLayer.cpp.

References llvm::orc::SymbolLookupSet::add(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::insert_range(), llvm::jitlink::RequiredSymbol, llvm::orc::RequiredSymbol, llvm::orc::Resolved, llvm::orc::Result, llvm::orc::Static, and llvm::orc::WeaklyReferencedSymbol.

◆ modifyPassConfig()

Error llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::modifyPassConfig ( LinkGraph & G,
PassConfiguration & Config )
inlineoverridevirtual

Called by JITLink to modify the pass pipeline prior to linking.

The default version performs no modification.

Reimplemented from llvm::jitlink::JITLinkContext.

Definition at line 292 of file LinkGraphLinkingLayer.cpp.

References G, P, llvm::jitlink::PassConfiguration::PreFixupPasses, llvm::jitlink::PassConfiguration::PrePrunePasses, and llvm::Error::success().

◆ notifyEmitted()

Error llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::notifyEmitted ( jitlink::JITLinkMemoryManager::FinalizedAlloc FA)
inline

Definition at line 308 of file LinkGraphLinkingLayer.cpp.

References llvm::joinErrors(), P, and llvm::Error::success().

Referenced by notifyFinalized().

◆ notifyFailed()

void llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::notifyFailed ( Error Err)
inlineoverridevirtual

Notify this context that linking failed.

Called by JITLink if linking cannot be completed.

Implements llvm::jitlink::JITLinkContext.

Definition at line 143 of file LinkGraphLinkingLayer.cpp.

References llvm::joinErrors(), and P.

◆ notifyFinalized()

void llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::notifyFinalized ( JITLinkMemoryManager::FinalizedAlloc Alloc)
inlineoverridevirtual

Called by JITLink to notify the context that the object has been finalized (i.e.

emitted to memory and memory permissions set). If all of this objects dependencies have also been finalized then the code is ready to run.

Implements llvm::jitlink::JITLinkContext.

Definition at line 275 of file LinkGraphLinkingLayer.cpp.

References A(), and notifyEmitted().

◆ notifyMaterializing()

void llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::notifyMaterializing ( LinkGraph & G)
inline

Definition at line 136 of file LinkGraphLinkingLayer.cpp.

References G, and P.

◆ notifyResolved()

Error llvm::orc::LinkGraphLinkingLayer::JITLinkCtx::notifyResolved ( LinkGraph & G)
inlineoverridevirtual

Called by JITLink once all defined symbols in the graph have been assigned their final memory locations in the target process.

At this point the LinkGraph can be inspected to build a symbol table, however the block content will not generally have been copied to the target location yet.

If the client detects an error in the LinkGraph state (e.g. unexpected or missing symbols) they may return an error here. The error will be propagated to notifyFailed and the linker will bail out.

Implements llvm::jitlink::JITLinkContext.

Definition at line 188 of file LinkGraphLinkingLayer.cpp.

References assert(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::empty(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::find(), G, llvm::orc::LinkGraphLayer::getJITSymbolFlagsForSymbol(), llvm::jitlink::Symbol::getName(), llvm::jitlink::Symbol::getScope(), I, llvm::make_error(), llvm::jitlink::SideEffectsOnly, llvm::DenseMapBase< StorageT, KeyT, ValueT, KeyInfoT, BucketT >::size(), and llvm::Error::success().


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