LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Attributes | List of all members
llvm::orc::ObjectLinkingLayer Class Reference

An ObjectLayer implementation built on JITLink. More...

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

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

Public Types

using ReturnObjectBufferFunction = std::function< void(std::unique_ptr< MemoryBuffer >)>
 

Public Member Functions

 ObjectLinkingLayer (ExecutionSession &ES)
 Construct an ObjectLinkingLayer using the ExecutorProcessControl instance's memory manager.
 
 ObjectLinkingLayer (ExecutionSession &ES, jitlink::JITLinkMemoryManager &MemMgr)
 Construct an ObjectLinkingLayer using a custom memory manager.
 
 ObjectLinkingLayer (ExecutionSession &ES, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr)
 Construct an ObjectLinkingLayer.
 
void setReturnObjectBuffer (ReturnObjectBufferFunction ReturnObjectBuffer)
 Set an object buffer return function.
 
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) override
 Emit a LinkGraph.
 
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.
 
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 given ResourceTracker.
 
Error add (ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > O)
 Adds a MaterializationUnit for the object file in the given memory buffer to the JITDylib for the given ResourceTracker.
 
Error add (JITDylib &JD, std::unique_ptr< MemoryBuffer > O, MaterializationUnit::Interface I)
 Adds a MaterializationUnit for the object file in the given memory buffer to the given JITDylib.
 
Error add (JITDylib &JD, std::unique_ptr< MemoryBuffer > O)
 Adds a MaterializationUnit for the object file in the given memory buffer to the given JITDylib.
 
- Public Member Functions inherited from llvm::orc::LinkGraphLinkingLayer
 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.
 
- Public Member Functions inherited from llvm::RTTIExtends< ObjectLinkingLayer, ObjectLayer >
const void * dynamicClassID () const override
 
bool isA () const
 Check whether this instance is a subclass of QueryT.
 
bool isA (const void *const ClassID) const override
 

Static Public Attributes

static char ID
 

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.
 
- Static Public Member Functions inherited from llvm::RTTIExtends< ObjectLinkingLayer, ObjectLayer >
static const void * classID ()
 
static bool classof (const T *R)
 
- Protected Member Functions inherited from llvm::orc::LinkGraphLinkingLayer
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 inherited from llvm::orc::LinkGraphLinkingLayer
std::function< void(std::unique_ptr< MemoryBuffer >)> ReturnObjectBuffer
 

Detailed Description

An ObjectLayer implementation built on JITLink.

Clients can use this class to add relocatable object files to an ExecutionSession, and it typically serves as the base layer (underneath a compiling layer like IRCompileLayer) for the rest of the JIT.

Definition at line 41 of file ObjectLinkingLayer.h.

Member Typedef Documentation

◆ ReturnObjectBufferFunction

using llvm::orc::ObjectLinkingLayer::ReturnObjectBufferFunction = std::function<void(std::unique_ptr<MemoryBuffer>)>

Definition at line 49 of file ObjectLinkingLayer.h.

Constructor & Destructor Documentation

◆ ObjectLinkingLayer() [1/3]

llvm::orc::ObjectLinkingLayer::ObjectLinkingLayer ( ExecutionSession ES)
inline

Construct an ObjectLinkingLayer using the ExecutorProcessControl instance's memory manager.

Definition at line 54 of file ObjectLinkingLayer.h.

◆ ObjectLinkingLayer() [2/3]

llvm::orc::ObjectLinkingLayer::ObjectLinkingLayer ( ExecutionSession ES,
jitlink::JITLinkMemoryManager MemMgr 
)
inline

Construct an ObjectLinkingLayer using a custom memory manager.

Definition at line 58 of file ObjectLinkingLayer.h.

◆ ObjectLinkingLayer() [3/3]

llvm::orc::ObjectLinkingLayer::ObjectLinkingLayer ( ExecutionSession ES,
std::unique_ptr< jitlink::JITLinkMemoryManager MemMgr 
)
inline

Construct an ObjectLinkingLayer.

Takes ownership of the given JITLinkMemoryManager. This method is a temporary hack to simplify co-existence with RTDyldObjectLinkingLayer (which also owns its allocators).

Definition at line 66 of file ObjectLinkingLayer.h.

Member Function Documentation

◆ add() [1/4]

Error ObjectLayer::add ( JITDylib JD,
std::unique_ptr< MemoryBuffer O 
)

Adds a MaterializationUnit for the object file in the given memory buffer to the given JITDylib.

The interface for the object will be built using the default object interface builder.

Definition at line 163 of file Layer.cpp.

◆ add() [2/4]

Error llvm::orc::ObjectLayer::add ( JITDylib JD,
std::unique_ptr< MemoryBuffer O,
MaterializationUnit::Interface  I 
)
inline

Adds a MaterializationUnit for the object file in the given memory buffer to the given JITDylib.

Definition at line 155 of file Layer.h.

◆ add() [3/4]

Error ObjectLayer::add ( ResourceTrackerSP  RT,
std::unique_ptr< MemoryBuffer O 
)

Adds a MaterializationUnit for the object file in the given memory buffer to the JITDylib for the given ResourceTracker.

The interface for the object will be built using the default object interface builder.

Definition at line 151 of file Layer.cpp.

◆ add() [4/4]

Error ObjectLayer::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 given ResourceTracker.

Definition at line 145 of file Layer.cpp.

Referenced by llvm::orc::LazyObjectLinkingLayer::add(), llvm::orc::JITLinkReentryTrampolines::emit(), and llvm::orc::COFFPlatform::setupJITDylib().

◆ emit() [1/3]

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

Emit a LinkGraph.

Reimplemented from llvm::orc::LinkGraphLinkingLayer.

◆ emit() [2/3]

void llvm::orc::LinkGraphLinkingLayer::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.

This overload is intended for use by ObjectLinkingLayer.

◆ emit() [3/3]

void llvm::orc::ObjectLinkingLayer::emit ( std::unique_ptr< MaterializationResponsibility R,
std::unique_ptr< MemoryBuffer O 
)
override

◆ setReturnObjectBuffer()

void llvm::orc::ObjectLinkingLayer::setReturnObjectBuffer ( ReturnObjectBufferFunction  ReturnObjectBuffer)
inline

Set an object buffer return function.

By default object buffers are deleted once the JIT has linked them. If a return function is set then it will be called to transfer ownership of the buffer instead.

Definition at line 75 of file ObjectLinkingLayer.h.

References llvm::orc::LinkGraphLinkingLayer::ReturnObjectBuffer.

Member Data Documentation

◆ ID

char llvm::orc::ObjectLinkingLayer::ID
static

Definition at line 47 of file ObjectLinkingLayer.h.


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