LLVM  16.0.0git
Classes | Public Types | Public Member Functions | Static Public Attributes | Friends | 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]
Collaboration diagram for llvm::orc::ObjectLinkingLayer:
Collaboration graph
[legend]

Classes

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 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. More...
 
 ObjectLinkingLayer (ExecutionSession &ES, jitlink::JITLinkMemoryManager &MemMgr)
 Construct an ObjectLinkingLayer using a custom memory manager. More...
 
 ObjectLinkingLayer (ExecutionSession &ES, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr)
 Construct an ObjectLinkingLayer. More...
 
 ~ObjectLinkingLayer ()
 Destruct an ObjectLinkingLayer. More...
 
void setReturnObjectBuffer (ReturnObjectBufferFunction ReturnObjectBuffer)
 Set an object buffer return function. More...
 
ObjectLinkingLayeraddPlugin (std::unique_ptr< Plugin > P)
 Add a pass-config modifier. More...
 
Error add (ResourceTrackerSP, std::unique_ptr< jitlink::LinkGraph > G)
 Add a LinkGraph to the JITDylib targeted by the given tracker. More...
 
Error add (JITDylib &JD, std::unique_ptr< jitlink::LinkGraph > G)
 Add a LinkGraph to the given JITDylib. More...
 
void emit (std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< MemoryBuffer > O) override
 Emit an object file. More...
 
void emit (std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G)
 Emit a LinkGraph. More...
 
ObjectLinkingLayersetOverrideObjectFlagsWithResponsibilityFlags (bool OverrideObjectFlags)
 Instructs this ObjectLinkingLayer instance to override the symbol flags found in the AtomGraph with the flags supplied by the MaterializationResponsibility instance. More...
 
ObjectLinkingLayersetAutoClaimResponsibilityForObjectSymbols (bool AutoClaimObjectSymbols)
 If set, this ObjectLinkingLayer instance will claim responsibility for any symbols provided by a given object file that were not already in the MaterializationResponsibility instance. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from llvm::RTTIExtends< ObjectLinkingLayer, ObjectLayer >
const void * dynamicClassID () const override
 
bool isA (const void *const ClassID) const override
 

Static Public Attributes

static char ID
 

Friends

class ObjectLinkingLayerJITLinkContext
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::RTTIExtends< ObjectLinkingLayer, ObjectLayer >
static const void * classID ()
 
static bool classof (const RTTIRoot *R)
 

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 50 of file ObjectLinkingLayer.h.

Member Typedef Documentation

◆ ReturnObjectBufferFunction

Definition at line 98 of file ObjectLinkingLayer.h.

Constructor & Destructor Documentation

◆ ObjectLinkingLayer() [1/3]

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

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

Definition at line 623 of file ObjectLinkingLayer.cpp.

References llvm::orc::ExecutionSession::registerResourceManager().

◆ ObjectLinkingLayer() [2/3]

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

Construct an ObjectLinkingLayer using a custom memory manager.

Definition at line 628 of file ObjectLinkingLayer.cpp.

References llvm::orc::ExecutionSession::registerResourceManager().

◆ ObjectLinkingLayer() [3/3]

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

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

◆ ~ObjectLinkingLayer()

llvm::orc::ObjectLinkingLayer::~ObjectLinkingLayer ( )

Destruct an ObjectLinkingLayer.

Definition at line 640 of file ObjectLinkingLayer.cpp.

References assert().

Member Function Documentation

◆ add() [1/6]

Error llvm::orc::ObjectLinkingLayer::add ( JITDylib JD,
std::unique_ptr< jitlink::LinkGraph G 
)
inline

Add a LinkGraph to the given JITDylib.

Definition at line 136 of file ObjectLinkingLayer.h.

References add(), G, llvm::orc::JITDylib::getDefaultResourceTracker(), and move.

◆ add() [2/6]

Error ObjectLayer::add

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 179 of file Layer.cpp.

◆ add() [3/6]

Error llvm::orc::ObjectLayer::add
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() [4/6]

Error ObjectLayer::add

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 172 of file Layer.cpp.

◆ add() [5/6]

Error ObjectLayer::add

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

Definition at line 163 of file Layer.cpp.

◆ add() [6/6]

Error llvm::orc::ObjectLinkingLayer::add ( ResourceTrackerSP  ,
std::unique_ptr< jitlink::LinkGraph G 
)

Add a LinkGraph to the JITDylib targeted by the given tracker.

Referenced by add().

◆ addPlugin()

ObjectLinkingLayer& llvm::orc::ObjectLinkingLayer::addPlugin ( std::unique_ptr< Plugin P)
inline

Add a pass-config modifier.

Definition at line 126 of file ObjectLinkingLayer.h.

References move, and P.

◆ emit() [1/2]

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

Emit a LinkGraph.

◆ emit() [2/2]

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

◆ setAutoClaimResponsibilityForObjectSymbols()

ObjectLinkingLayer& llvm::orc::ObjectLinkingLayer::setAutoClaimResponsibilityForObjectSymbols ( bool  AutoClaimObjectSymbols)
inline

If set, this ObjectLinkingLayer 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 177 of file ObjectLinkingLayer.h.

◆ setOverrideObjectFlagsWithResponsibilityFlags()

ObjectLinkingLayer& llvm::orc::ObjectLinkingLayer::setOverrideObjectFlagsWithResponsibilityFlags ( bool  OverrideObjectFlags)
inline

Instructs this ObjectLinkingLayer instance to override the symbol flags found in the AtomGraph 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 160 of file ObjectLinkingLayer.h.

◆ 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 121 of file ObjectLinkingLayer.h.

References move.

Friends And Related Function Documentation

◆ ObjectLinkingLayerJITLinkContext

friend class ObjectLinkingLayerJITLinkContext
friend

Definition at line 52 of file ObjectLinkingLayer.h.

Member Data Documentation

◆ ID

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

Definition at line 55 of file ObjectLinkingLayer.h.


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