LLVM  10.0.0svn
Classes | Public Types | Public Member Functions | 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, jitlink::JITLinkMemoryManager &MemMgr)
 Construct an ObjectLinkingLayer with the given NotifyLoaded, and NotifyEmitted functors. 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...
 
void emit (MaterializationResponsibility R, std::unique_ptr< MemoryBuffer > O) override
 Emit the object. 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...
 
- Public Member Functions inherited from llvm::orc::ObjectLayer
 ObjectLayer (ExecutionSession &ES)
 
virtual ~ObjectLayer ()
 
ExecutionSessiongetExecutionSession ()
 Returns the execution session for this layer. More...
 
virtual Error add (JITDylib &JD, std::unique_ptr< MemoryBuffer > O, VModuleKey K=VModuleKey())
 Adds a MaterializationUnit representing the given IR to the given JITDylib. More...
 

Friends

class ObjectLinkingLayerJITLinkContext
 

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

Member Typedef Documentation

◆ ReturnObjectBufferFunction

Definition at line 77 of file ObjectLinkingLayer.h.

Constructor & Destructor Documentation

◆ ObjectLinkingLayer()

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

Construct an ObjectLinkingLayer with the given NotifyLoaded, and NotifyEmitted functors.

Definition at line 320 of file ObjectLinkingLayer.cpp.

◆ ~ObjectLinkingLayer()

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

Destruct an ObjectLinkingLayer.

Definition at line 324 of file ObjectLinkingLayer.cpp.

Member Function Documentation

◆ addPlugin()

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

Add a pass-config modifier.

Definition at line 95 of file ObjectLinkingLayer.h.

References llvm::Lock, llvm::RISCVFenceField::O, and Plugins.

◆ emit()

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

Emit the object.

Implements llvm::orc::ObjectLayer.

Definition at line 329 of file ObjectLinkingLayer.cpp.

References assert(), llvm::jitlink::jitLink(), P, and TT.

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

References TT.

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

Friends And Related Function Documentation

◆ ObjectLinkingLayerJITLinkContext

friend class ObjectLinkingLayerJITLinkContext
friend

Definition at line 54 of file ObjectLinkingLayer.h.


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