LLVM 20.0.0git
|
An ObjectLayer implementation built on JITLink. More...
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
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. | |
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. | |
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 |
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.
using llvm::orc::ObjectLinkingLayer::ReturnObjectBufferFunction = std::function<void(std::unique_ptr<MemoryBuffer>)> |
Definition at line 49 of file ObjectLinkingLayer.h.
|
inline |
Construct an ObjectLinkingLayer using the ExecutorProcessControl instance's memory manager.
Definition at line 54 of file ObjectLinkingLayer.h.
|
inline |
Construct an ObjectLinkingLayer using a custom memory manager.
Definition at line 58 of file ObjectLinkingLayer.h.
|
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.
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.
|
inline |
Adds a MaterializationUnit for the object file in the given memory buffer to the given JITDylib.
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.
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().
|
overridevirtual |
Emit a LinkGraph.
Reimplemented from llvm::orc::LinkGraphLinkingLayer.
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.
|
override |
Emit an object file.
Definition at line 21 of file ObjectLinkingLayer.cpp.
References assert(), llvm::jitlink::createLinkGraphFromObject(), emit(), G, and llvm::orc::LinkGraphLayer::getExecutionSession().
Referenced by llvm::orc::LazyObjectLinkingLayer::emit(), emit(), llvm::orc::JITLinkRedirectableSymbolManager::emitRedirectableSymbols(), llvm::orc::SimpleMachOHeaderMU::materialize(), and llvm::orc::SectCreateMaterializationUnit::materialize().
|
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.
|
static |
Definition at line 47 of file ObjectLinkingLayer.h.