LLVM  7.0.0svn
Namespaces | Classes | Typedefs | Enumerations | Functions
llvm::orc Namespace Reference

Namespaces

 remote
 
 rpc
 

Classes

class  AsynchronousSymbolQuery
 A symbol query that returns results via a callback when results are ready. More...
 
class  CompileOnDemandLayer
 Compile-on-demand layer. More...
 
class  CtorDtorIterator
 This iterator provides a convenient way to iterate over the elements of an llvm.global_ctors/llvm.global_dtors instance. More...
 
class  CtorDtorRunner
 Convenience class for recording constructor/destructor names for later execution. More...
 
class  DuplicateDefinition
 
class  ExecutionSession
 An ExecutionSession represents a running JIT program. More...
 
class  GenericIndirectStubsInfo
 Provide information about stub blocks generated by the makeIndirectStubsBlock function. More...
 
class  GlobalMappingLayer
 Global mapping layer. More...
 
class  GlobalRenamer
 
class  IndirectStubsManager
 Base class for managing collections of named indirect stubs. More...
 
class  IRCompileLayer
 Eager IR compiling layer. More...
 
class  IRTransformLayer
 IR mutating layer. More...
 
class  JITCompileCallbackManager
 Target-independent base class for compile callback management. More...
 
class  JITSymbolNotFound
 
class  JITSymbolResolverAdapter
 
class  LambdaResolver
 
class  LambdaSymbolResolver
 Implements SymbolResolver with a pair of supplied function objects for convenience. More...
 
class  LazyEmittingLayer
 Lazy-emitting IR layer. More...
 
class  LegacyLookupFnResolver
 An ORC SymbolResolver implementation that uses a legacy findSymbol-like function to perform lookup;. More...
 
class  LocalCXXRuntimeOverrides
 Support class for static dtor execution. More...
 
class  LocalIndirectStubsManager
 IndirectStubsManager implementation for the host architecture, e.g. More...
 
class  LocalJITCompileCallbackManager
 Manage compile callbacks for in-process JITs. More...
 
class  NullLegacyResolver
 SymbolResolver impliementation that rejects all resolution requests. More...
 
class  NullResolver
 
class  ObjectTransformLayer
 Object mutating layer. More...
 
class  OrcAArch64
 
class  OrcGenericABI
 Generic ORC ABI support. More...
 
class  OrcI386
 I386 support. More...
 
class  OrcMCJITReplacement
 
class  OrcX86_64_Base
 X86_64 code that's common to all ABIs. More...
 
class  OrcX86_64_SysV
 X86_64 support for SysV ABI (Linux, MacOSX). More...
 
class  OrcX86_64_Win32
 X86_64 support for Win32. More...
 
class  RemoteObjectClientLayer
 RemoteObjectClientLayer forwards the ORC Object Layer API over an RPC connection. More...
 
class  RemoteObjectLayer
 Base class containing common utilities for RemoteObjectClientLayer and RemoteObjectServerLayer. More...
 
class  RemoteObjectLayerAPI
 RPC API needed by RemoteObjectClientLayer and RemoteObjectServerLayer. More...
 
class  RemoteObjectServerLayer
 RemoteObjectServerLayer acts as a server and handling RPC calls for the object layer API from the given RPC connection. More...
 
class  RTDyldObjectLinkingLayer
 Bare bones object linking layer. More...
 
class  RTDyldObjectLinkingLayerBase
 
class  SimpleCompiler
 Simple compile functor: Takes a single IR module and returns an ObjectFile. More...
 
class  SymbolResolver
 SymbolResolver is a composable interface for looking up symbol flags and addresses using the AsynchronousSymbolQuery type. More...
 
class  SymbolSource
 Represents a source of symbol definitions which may be materialized (turned into data / code through some materialization process) or discarded (if the definition is overridden by a stronger one). More...
 
class  SymbolStringPool
 String pool for symbol names used by the JIT. More...
 
class  SymbolStringPtr
 Pointer to a pooled string representing a symbol name. More...
 
class  VSO
 Represents a dynamic linkage unit in a JIT process. More...
 

Typedefs

using VModuleKey = uint64_t
 VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module added to the JIT. More...
 
using SymbolNameSet = std::set< SymbolStringPtr >
 A set of symbol names (represented by SymbolStringPtrs for. More...
 
using SymbolMap = std::map< SymbolStringPtr, JITEvaluatedSymbol >
 A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs). More...
 
using SymbolFlagsMap = std::map< SymbolStringPtr, JITSymbolFlags >
 A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags. More...
 

Enumerations

enum  OrcErrorCode : int {
  OrcErrorCode::DuplicateDefinition = 1, OrcErrorCode::JITSymbolNotFound, OrcErrorCode::RemoteAllocatorDoesNotExist, OrcErrorCode::RemoteAllocatorIdAlreadyInUse,
  OrcErrorCode::RemoteMProtectAddrUnrecognized, OrcErrorCode::RemoteIndirectStubsOwnerDoesNotExist, OrcErrorCode::RemoteIndirectStubsOwnerIdAlreadyInUse, OrcErrorCode::RPCConnectionClosed,
  OrcErrorCode::RPCCouldNotNegotiateFunction, OrcErrorCode::RPCResponseAbandoned, OrcErrorCode::UnexpectedRPCCall, OrcErrorCode::UnexpectedRPCResponse,
  OrcErrorCode::UnknownErrorCodeFromRemote, OrcErrorCode::UnknownResourceHandle
}
 

Functions

template<typename LookupFlagsFn , typename LookupFn >
std::unique_ptr< LambdaSymbolResolver< typename std::remove_cv< typename std::remove_reference< LookupFlagsFn >::type >::type, typename std::remove_cv< typename std::remove_reference< LookupFn >::type >::type > > createSymbolResolver (LookupFlagsFn &&LookupFlags, LookupFn &&Lookup)
 Creates a SymbolResolver implementation from the pair of supplied function objects. More...
 
iterator_range< CtorDtorIteratorgetConstructors (const Module &M)
 Create an iterator range over the entries of the llvm.global_ctors array. More...
 
iterator_range< CtorDtorIteratorgetDestructors (const Module &M)
 Create an iterator range over the entries of the llvm.global_ctors array. More...
 
std::unique_ptr< JITCompileCallbackManagercreateLocalCompileCallbackManager (const Triple &T, JITTargetAddress ErrorHandlerAddress)
 Create a local compile callback manager. More...
 
std::function< std::unique_ptr< IndirectStubsManager >)> createLocalIndirectStubsManagerBuilder (const Triple &T)
 Create a local indriect stubs manager builder. More...
 
ConstantcreateIRTypedAddress (FunctionType &FT, JITTargetAddress Addr)
 Build a function pointer of FunctionType with the given constant address. More...
 
GlobalVariablecreateImplPointer (PointerType &PT, Module &M, const Twine &Name, Constant *Initializer)
 Create a function pointer with the given type, name, and initializer in the given Module. More...
 
void makeStub (Function &F, Value &ImplPointer)
 Turn a function declaration into a stub function that makes an indirect call using the given function pointer. More...
 
void makeAllSymbolsExternallyAccessible (Module &M)
 Raise linkage types and rename as necessary to ensure that all symbols are accessible for other modules. More...
 
FunctioncloneFunctionDecl (Module &Dst, const Function &F, ValueToValueMapTy *VMap=nullptr)
 Clone a function declaration into a new module. More...
 
void moveFunctionBody (Function &OrigF, ValueToValueMapTy &VMap, ValueMaterializer *Materializer=nullptr, Function *NewF=nullptr)
 Move the body of function 'F' to a cloned function declaration in a different module (See related cloneFunctionDecl). More...
 
GlobalVariablecloneGlobalVariableDecl (Module &Dst, const GlobalVariable &GV, ValueToValueMapTy *VMap=nullptr)
 Clone a global variable declaration into a new module. More...
 
void moveGlobalVariableInitializer (GlobalVariable &OrigGV, ValueToValueMapTy &VMap, ValueMaterializer *Materializer=nullptr, GlobalVariable *NewGV=nullptr)
 Move global variable GV from its parent module to cloned global declaration in a different module. More...
 
GlobalAliascloneGlobalAliasDecl (Module &Dst, const GlobalAlias &OrigA, ValueToValueMapTy &VMap)
 Clone a global alias declaration into a new module. More...
 
void cloneModuleFlagsMetadata (Module &Dst, const Module &Src, ValueToValueMapTy &VMap)
 Clone module flags metadata into the destination module. More...
 
template<typename DylibLookupFtorT , typename ExternalLookupFtorT >
std::shared_ptr< LambdaResolver< DylibLookupFtorT, ExternalLookupFtorT > > createLambdaResolver (DylibLookupFtorT DylibLookupFtor, ExternalLookupFtorT ExternalLookupFtor)
 
template<typename FindSymbolFn >
Expected< SymbolNameSetlookupFlagsWithLegacyFn (SymbolFlagsMap &SymbolFlags, const SymbolNameSet &Symbols, FindSymbolFn FindSymbol)
 Use the given legacy-style FindSymbol function (i.e. More...
 
template<typename FindSymbolFn >
SymbolNameSet lookupWithLegacyFn (AsynchronousSymbolQuery &Query, const SymbolNameSet &Symbols, FindSymbolFn FindSymbol)
 Use the given legacy-style FindSymbol function (i.e. More...
 
template<typename LegacyLookupFn >
std::shared_ptr< LegacyLookupFnResolver< LegacyLookupFn > > createLegacyLookupResolver (LegacyLookupFn LegacyLookup, std::function< void(Error)> ErrorReporter)
 
std::error_code orcError (OrcErrorCode ErrCode)
 
bool operator== (const SymbolStringPtr &LHS, const SymbolStringPtr &RHS)
 
bool operator!= (const SymbolStringPtr &LHS, const SymbolStringPtr &RHS)
 
bool operator< (const SymbolStringPtr &LHS, const SymbolStringPtr &RHS)
 
static void raiseVisibilityOnValue (GlobalValue &V, GlobalRenamer &R)
 

Typedef Documentation

◆ SymbolFlagsMap

A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.

Definition at line 43 of file Core.h.

◆ SymbolMap

A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).

Definition at line 40 of file Core.h.

◆ SymbolNameSet

using llvm::orc::SymbolNameSet = typedef std::set<SymbolStringPtr>

A set of symbol names (represented by SymbolStringPtrs for.

Definition at line 36 of file Core.h.

◆ VModuleKey

using llvm::orc::VModuleKey = typedef uint64_t

VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module added to the JIT.

Definition at line 30 of file Core.h.

Enumeration Type Documentation

◆ OrcErrorCode

enum llvm::orc::OrcErrorCode : int
strong
Enumerator
DuplicateDefinition 
JITSymbolNotFound 
RemoteAllocatorDoesNotExist 
RemoteAllocatorIdAlreadyInUse 
RemoteMProtectAddrUnrecognized 
RemoteIndirectStubsOwnerDoesNotExist 
RemoteIndirectStubsOwnerIdAlreadyInUse 
RPCConnectionClosed 
RPCCouldNotNegotiateFunction 
RPCResponseAbandoned 
UnexpectedRPCCall 
UnexpectedRPCResponse 
UnknownErrorCodeFromRemote 
UnknownResourceHandle 

Definition at line 23 of file OrcError.h.

Function Documentation

◆ cloneFunctionDecl()

Function * llvm::orc::cloneFunctionDecl ( Module Dst,
const Function F,
ValueToValueMapTy VMap = nullptr 
)

Clone a function declaration into a new module.

This function can be used as the first step towards creating a callback stub (see makeStub), or moving a function body (see moveFunctionBody).

If the VMap argument is non-null, a mapping will be added between F and the new declaration, and between each of F's arguments and the new declaration's arguments. This map can then be passed in to moveFunction to move the function body if required. Note: When moving functions between modules with these utilities, all decls should be cloned (and added to a single VMap) before any bodies are moved. This will ensure that references between functions all refer to the versions in the new module.

Definition at line 177 of file IndirectionUtils.cpp.

References llvm::Function::arg_begin(), llvm::Function::arg_end(), assert(), llvm::Function::copyAttributesFrom(), llvm::Function::Create(), F(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::GlobalValue::getParent(), and llvm::GlobalValue::getValueType().

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer(), and llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ cloneGlobalAliasDecl()

GlobalAlias * llvm::orc::cloneGlobalAliasDecl ( Module Dst,
const GlobalAlias OrigA,
ValueToValueMapTy VMap 
)

◆ cloneGlobalVariableDecl()

GlobalVariable * llvm::orc::cloneGlobalVariableDecl ( Module Dst,
const GlobalVariable GV,
ValueToValueMapTy VMap = nullptr 
)

◆ cloneModuleFlagsMetadata()

void llvm::orc::cloneModuleFlagsMetadata ( Module Dst,
const Module Src,
ValueToValueMapTy VMap 
)

◆ createImplPointer()

GlobalVariable * llvm::orc::createImplPointer ( PointerType PT,
Module M,
const Twine Name,
Constant Initializer 
)

◆ createIRTypedAddress()

Constant * llvm::orc::createIRTypedAddress ( FunctionType FT,
JITTargetAddress  Addr 
)

Build a function pointer of FunctionType with the given constant address.

Usage example: Turn a trampoline address into a function pointer constant for use in a stub.

Definition at line 87 of file IndirectionUtils.cpp.

References llvm::ConstantInt::get(), llvm::PointerType::get(), llvm::ConstantExpr::getCast(), llvm::Type::getContext(), and llvm::Type::getInt64Ty().

Referenced by llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ createLambdaResolver()

template<typename DylibLookupFtorT , typename ExternalLookupFtorT >
std::shared_ptr<LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT> > llvm::orc::createLambdaResolver ( DylibLookupFtorT  DylibLookupFtor,
ExternalLookupFtorT  ExternalLookupFtor 
)

◆ createLegacyLookupResolver()

template<typename LegacyLookupFn >
std::shared_ptr<LegacyLookupFnResolver<LegacyLookupFn> > llvm::orc::createLegacyLookupResolver ( LegacyLookupFn  LegacyLookup,
std::function< void(Error)>  ErrorReporter 
)

Definition at line 129 of file Legacy.h.

◆ createLocalCompileCallbackManager()

std::unique_ptr< JITCompileCallbackManager > llvm::orc::createLocalCompileCallbackManager ( const Triple T,
JITTargetAddress  ErrorHandlerAddress 
)

Create a local compile callback manager.

The given target triple will determine the ABI, and the given ErrorHandlerAddress will be used by the resulting compile callback manager if a compile callback fails.

Definition at line 26 of file IndirectionUtils.cpp.

References llvm::Triple::aarch64, llvm::orc::JITCompileCallbackManager::ErrorHandlerAddress, llvm::Triple::getArch(), llvm::Triple::getOS(), llvm::Triple::x86, and llvm::Triple::x86_64.

Referenced by LLVMOrcCreateInstance(), and llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ createLocalIndirectStubsManagerBuilder()

std::function< std::unique_ptr< IndirectStubsManager >)> llvm::orc::createLocalIndirectStubsManagerBuilder ( const Triple T)

Create a local indriect stubs manager builder.

The given target triple will determine the ABI.

Definition at line 55 of file IndirectionUtils.cpp.

References llvm::Triple::aarch64, llvm::Triple::getArch(), llvm::Triple::getOS(), llvm::make_unique(), llvm::Triple::x86, and llvm::Triple::x86_64.

Referenced by LLVMOrcCreateInstance(), and llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ createSymbolResolver()

template<typename LookupFlagsFn , typename LookupFn >
std::unique_ptr<LambdaSymbolResolver< typename std::remove_cv< typename std::remove_reference<LookupFlagsFn>::type>::type, typename std::remove_cv< typename std::remove_reference<LookupFn>::type>::type> > llvm::orc::createSymbolResolver ( LookupFlagsFn &&  LookupFlags,
LookupFn &&  Lookup 
)

Creates a SymbolResolver implementation from the pair of supplied function objects.

Definition at line 150 of file Core.h.

References Lookup().

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer().

◆ getConstructors()

iterator_range< CtorDtorIterator > llvm::orc::getConstructors ( const Module M)

Create an iterator range over the entries of the llvm.global_ctors array.

Definition at line 74 of file ExecutionUtils.cpp.

References llvm::orc::CtorDtorIterator::CtorDtorIterator(), llvm::Module::getNamedGlobal(), and llvm::make_range().

Referenced by llvm::OrcCBindingsStack::addIRModule().

◆ getDestructors()

iterator_range< CtorDtorIterator > llvm::orc::getDestructors ( const Module M)

Create an iterator range over the entries of the llvm.global_ctors array.

Definition at line 80 of file ExecutionUtils.cpp.

References llvm::orc::CtorDtorIterator::CtorDtorIterator(), llvm::Module::getNamedGlobal(), and llvm::make_range().

Referenced by llvm::OrcCBindingsStack::addIRModule().

◆ lookupFlagsWithLegacyFn()

template<typename FindSymbolFn >
Expected<SymbolNameSet> llvm::orc::lookupFlagsWithLegacyFn ( SymbolFlagsMap SymbolFlags,
const SymbolNameSet Symbols,
FindSymbolFn  FindSymbol 
)

Use the given legacy-style FindSymbol function (i.e.

a function that takes a const std::string& or StringRef and returns a JITSymbol) to find the flags for each symbol in Symbols and store their flags in SymbolFlags. If any JITSymbol returned by FindSymbol is in an error state the function returns immediately with that error, otherwise it returns the set of symbols not found.

Useful for implementing lookupFlags bodies that query legacy resolvers.

Definition at line 44 of file Legacy.h.

Referenced by llvm::orc::LegacyLookupFnResolver< LegacyLookupFn >::lookupFlags(), and llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer().

◆ lookupWithLegacyFn()

template<typename FindSymbolFn >
SymbolNameSet llvm::orc::lookupWithLegacyFn ( AsynchronousSymbolQuery Query,
const SymbolNameSet Symbols,
FindSymbolFn  FindSymbol 
)

Use the given legacy-style FindSymbol function (i.e.

a function that takes a const std::string& or StringRef and returns a JITSymbol) to find the address and flags for each symbol in Symbols and store the result in Query. If any JITSymbol returned by FindSymbol is in an error then Query.setFailed(...) is called with that error and the function returns immediately. On success, returns the set of symbols not found.

Useful for implementing lookup bodies that query legacy resolvers.

Definition at line 71 of file Legacy.h.

References llvm::orc::AsynchronousSymbolQuery::notifySymbolFinalized(), llvm::orc::AsynchronousSymbolQuery::setDefinition(), and llvm::orc::AsynchronousSymbolQuery::setFailed().

Referenced by llvm::orc::LegacyLookupFnResolver< LegacyLookupFn >::lookup(), and llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer().

◆ makeAllSymbolsExternallyAccessible()

void llvm::orc::makeAllSymbolsExternallyAccessible ( Module M)

Raise linkage types and rename as necessary to ensure that all symbols are accessible for other modules.

This should be called before partitioning a module to ensure that the partitions retain access to each other's symbols.

Definition at line 164 of file IndirectionUtils.cpp.

References F(), and raiseVisibilityOnValue().

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer(), and llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ makeStub()

void llvm::orc::makeStub ( Function F,
Value ImplPointer 
)

◆ moveFunctionBody()

void llvm::orc::moveFunctionBody ( Function OrigF,
ValueToValueMapTy VMap,
ValueMaterializer Materializer = nullptr,
Function NewF = nullptr 
)

Move the body of function 'F' to a cloned function declaration in a different module (See related cloneFunctionDecl).

If the target function declaration is not supplied via the NewF parameter then it will be looked up via the VMap.

This will delete the body of function 'F' from its original parent module, but leave its declaration.

Definition at line 196 of file IndirectionUtils.cpp.

References assert(), llvm::CloneFunctionInto(), llvm::Function::deleteBody(), llvm::GlobalValue::getParent(), and llvm::GlobalValue::isDeclaration().

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer(), and llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ moveGlobalVariableInitializer()

void llvm::orc::moveGlobalVariableInitializer ( GlobalVariable OrigGV,
ValueToValueMapTy VMap,
ValueMaterializer Materializer = nullptr,
GlobalVariable NewGV = nullptr 
)

Move global variable GV from its parent module to cloned global declaration in a different module.

If the target global declaration is not supplied via the NewGV parameter then it will be looked up via the VMap.

This will delete the initializer of GV from its original parent module, but leave its declaration.

Definition at line 228 of file IndirectionUtils.cpp.

References assert(), llvm::GlobalVariable::getInitializer(), llvm::GlobalValue::getParent(), llvm::GlobalVariable::hasInitializer(), llvm::MapValue(), llvm::RF_None, and llvm::GlobalVariable::setInitializer().

Referenced by llvm::orc::CompileOnDemandLayer< CompileLayerT, CompileCallbackMgr >::updatePointer(), and llvm::orc::LocalIndirectStubsManager< TargetT >::updatePointer().

◆ operator!=()

bool llvm::orc::operator!= ( const SymbolStringPtr LHS,
const SymbolStringPtr RHS 
)
inline

Definition at line 104 of file SymbolStringPool.h.

◆ operator<()

bool llvm::orc::operator< ( const SymbolStringPtr LHS,
const SymbolStringPtr RHS 
)
inline

Definition at line 108 of file SymbolStringPool.h.

◆ operator==()

bool llvm::orc::operator== ( const SymbolStringPtr LHS,
const SymbolStringPtr RHS 
)
inline

Definition at line 100 of file SymbolStringPool.h.

◆ orcError()

std::error_code llvm::orc::orcError ( OrcErrorCode  ErrCode)

◆ raiseVisibilityOnValue()

static void llvm::orc::raiseVisibilityOnValue ( GlobalValue V,
GlobalRenamer R 
)
static