LLVM  10.0.0svn
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::orc::LLJIT Class Reference

A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT. More...

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

Inheritance diagram for llvm::orc::LLJIT:
Inheritance graph
[legend]
Collaboration diagram for llvm::orc::LLJIT:
Collaboration graph
[legend]

Public Member Functions

 ~LLJIT ()
 Destruct this instance. More...
 
ExecutionSessiongetExecutionSession ()
 Returns the ExecutionSession for this instance. More...
 
const DataLayoutgetDataLayout () const
 Returns a reference to the DataLayout for this instance. More...
 
JITDylibgetMainJITDylib ()
 Returns a reference to the JITDylib representing the JIT'd main program. More...
 
JITDylibgetJITDylibByName (StringRef Name)
 Returns the JITDylib with the given name, or nullptr if no JITDylib with that name exists. More...
 
JITDylibcreateJITDylib (std::string Name)
 Create a new JITDylib with the given name and return a reference to it. More...
 
Error defineAbsolute (StringRef Name, JITEvaluatedSymbol Address)
 Convenience method for defining an absolute symbol. More...
 
Error addIRModule (JITDylib &JD, ThreadSafeModule TSM)
 Adds an IR module to the given JITDylib. More...
 
Error addIRModule (ThreadSafeModule TSM)
 Adds an IR module to the Main JITDylib. More...
 
Error addObjectFile (JITDylib &JD, std::unique_ptr< MemoryBuffer > Obj)
 Adds an object file to the given JITDylib. More...
 
Error addObjectFile (std::unique_ptr< MemoryBuffer > Obj)
 Adds an object file to the given JITDylib. More...
 
Expected< JITEvaluatedSymbollookupLinkerMangled (JITDylib &JD, StringRef Name)
 Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to look up symbols based on their IR name use the lookup function instead). More...
 
Expected< JITEvaluatedSymbollookupLinkerMangled (StringRef Name)
 Look up a symbol in the main JITDylib by the symbol's linker-mangled name (to look up symbols based on their IR name use the lookup function instead). More...
 
Expected< JITEvaluatedSymbollookup (JITDylib &JD, StringRef UnmangledName)
 Look up a symbol in JITDylib JD based on its IR symbol name. More...
 
Expected< JITEvaluatedSymbollookup (StringRef UnmangledName)
 Look up a symbol in the main JITDylib based on its IR symbol name. More...
 
Error runConstructors ()
 Runs all not-yet-run static constructors. More...
 
Error runDestructors ()
 Runs all not-yet-run static destructors. More...
 
ObjectLayergetObjLinkingLayer ()
 Returns a reference to the ObjLinkingLayer. More...
 

Static Public Member Functions

static Expected< std::unique_ptr< LLJIT > > Create (LLJITBuilderState &S)
 

Protected Member Functions

 LLJIT (LLJITBuilderState &S, Error &Err)
 Create an LLJIT instance with a single compile thread. More...
 
std::string mangle (StringRef UnmangledName)
 
Error applyDataLayout (Module &M)
 
void recordCtorDtors (Module &M)
 

Static Protected Member Functions

static std::unique_ptr< ObjectLayercreateObjectLinkingLayer (LLJITBuilderState &S, ExecutionSession &ES)
 
static Expected< IRCompileLayer::CompileFunctioncreateCompileFunction (LLJITBuilderState &S, JITTargetMachineBuilder JTMB)
 

Protected Attributes

std::unique_ptr< ExecutionSessionES
 
JITDylibMain
 
DataLayout DL
 
std::unique_ptr< ThreadPoolCompileThreads
 
std::unique_ptr< ObjectLayerObjLinkingLayer
 
std::unique_ptr< IRCompileLayerCompileLayer
 
CtorDtorRunner CtorRunner
 
CtorDtorRunner DtorRunner
 

Friends

template<typename , typename , typename >
class LLJITBuilderSetters
 

Detailed Description

A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.

Create instances using LLJITBuilder.

Definition at line 35 of file LLJIT.h.

Constructor & Destructor Documentation

◆ ~LLJIT()

llvm::orc::LLJIT::~LLJIT ( )

Destruct this instance.

If a multi-threaded instance, waits for all compile threads to complete.

Definition at line 30 of file LLJIT.cpp.

◆ LLJIT()

llvm::orc::LLJIT::LLJIT ( LLJITBuilderState S,
Error Err 
)
protected

Create an LLJIT instance with a single compile thread.

Definition at line 104 of file LLJIT.cpp.

Referenced by getObjLinkingLayer().

Member Function Documentation

◆ addIRModule() [1/2]

Error llvm::orc::LLJIT::addIRModule ( JITDylib JD,
ThreadSafeModule  TSM 
)

Adds an IR module to the given JITDylib.

Definition at line 41 of file LLJIT.cpp.

References assert().

Referenced by addIRModule(), and createJITDylib().

◆ addIRModule() [2/2]

Error llvm::orc::LLJIT::addIRModule ( ThreadSafeModule  TSM)
inline

Adds an IR module to the Main JITDylib.

Definition at line 77 of file LLJIT.h.

References addIRModule(), addObjectFile(), and Main.

◆ addObjectFile() [1/2]

Error llvm::orc::LLJIT::addObjectFile ( JITDylib JD,
std::unique_ptr< MemoryBuffer Obj 
)

Adds an object file to the given JITDylib.

Definition at line 51 of file LLJIT.cpp.

References assert(), and llvm::orc::LLJITBuilderState::ES.

Referenced by addIRModule(), and addObjectFile().

◆ addObjectFile() [2/2]

Error llvm::orc::LLJIT::addObjectFile ( std::unique_ptr< MemoryBuffer Obj)
inline

Adds an object file to the given JITDylib.

Definition at line 85 of file LLJIT.h.

References addObjectFile(), lookupLinkerMangled(), and Main.

◆ applyDataLayout()

Error llvm::orc::LLJIT::applyDataLayout ( Module M)
protected

◆ Create()

static Expected<std::unique_ptr<LLJIT> > llvm::orc::LLJIT::Create ( LLJITBuilderState S)
static

◆ createCompileFunction()

Expected< IRCompileLayer::CompileFunction > llvm::orc::LLJIT::createCompileFunction ( LLJITBuilderState S,
JITTargetMachineBuilder  JTMB 
)
staticprotected

◆ createJITDylib()

JITDylib& llvm::orc::LLJIT::createJITDylib ( std::string  Name)
inline

Create a new JITDylib with the given name and return a reference to it.

JITDylib names must be unique. If the given name is derived from user input or elsewhere in the environment then the client should check (e.g. by calling getJITDylibByName) that the given name is not already in use.

Definition at line 66 of file LLJIT.h.

References addIRModule(), llvm::Address, defineAbsolute(), ES, and Name.

◆ createObjectLinkingLayer()

std::unique_ptr< ObjectLayer > llvm::orc::LLJIT::createObjectLinkingLayer ( LLJITBuilderState S,
ExecutionSession ES 
)
staticprotected

◆ defineAbsolute()

Error llvm::orc::LLJIT::defineAbsolute ( StringRef  Name,
JITEvaluatedSymbol  Address 
)

Convenience method for defining an absolute symbol.

Definition at line 35 of file LLJIT.cpp.

References llvm::orc::absoluteSymbols(), and llvm::orc::LLJITBuilderState::ES.

Referenced by createJITDylib().

◆ getDataLayout()

const DataLayout& llvm::orc::LLJIT::getDataLayout ( ) const
inline

Returns a reference to the DataLayout for this instance.

Definition at line 49 of file LLJIT.h.

References DL.

◆ getExecutionSession()

ExecutionSession& llvm::orc::LLJIT::getExecutionSession ( )
inline

Returns the ExecutionSession for this instance.

Definition at line 46 of file LLJIT.h.

References ES.

◆ getJITDylibByName()

JITDylib* llvm::orc::LLJIT::getJITDylibByName ( StringRef  Name)
inline

Returns the JITDylib with the given name, or nullptr if no JITDylib with that name exists.

Definition at line 56 of file LLJIT.h.

References ES.

◆ getMainJITDylib()

JITDylib& llvm::orc::LLJIT::getMainJITDylib ( )
inline

Returns a reference to the JITDylib representing the JIT'd main program.

Definition at line 52 of file LLJIT.h.

References Main.

◆ getObjLinkingLayer()

ObjectLayer& llvm::orc::LLJIT::getObjLinkingLayer ( )
inline

Returns a reference to the ObjLinkingLayer.

Definition at line 118 of file LLJIT.h.

References createCompileFunction(), createObjectLinkingLayer(), ES, LLJIT(), and ObjLinkingLayer.

◆ lookup() [1/2]

Expected<JITEvaluatedSymbol> llvm::orc::LLJIT::lookup ( JITDylib JD,
StringRef  UnmangledName 
)
inline

Look up a symbol in JITDylib JD based on its IR symbol name.

Definition at line 102 of file LLJIT.h.

References lookupLinkerMangled(), and mangle().

Referenced by lookup().

◆ lookup() [2/2]

Expected<JITEvaluatedSymbol> llvm::orc::LLJIT::lookup ( StringRef  UnmangledName)
inline

Look up a symbol in the main JITDylib based on its IR symbol name.

Definition at line 107 of file LLJIT.h.

References lookup(), and Main.

◆ lookupLinkerMangled() [1/2]

Expected< JITEvaluatedSymbol > llvm::orc::LLJIT::lookupLinkerMangled ( JITDylib JD,
StringRef  Name 
)

Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to look up symbols based on their IR name use the lookup function instead).

Definition at line 57 of file LLJIT.cpp.

References llvm::orc::LLJITBuilderState::ES.

Referenced by addObjectFile(), lookup(), and lookupLinkerMangled().

◆ lookupLinkerMangled() [2/2]

Expected<JITEvaluatedSymbol> llvm::orc::LLJIT::lookupLinkerMangled ( StringRef  Name)
inline

Look up a symbol in the main JITDylib by the symbol's linker-mangled name (to look up symbols based on their IR name use the lookup function instead).

Definition at line 97 of file LLJIT.h.

References lookupLinkerMangled(), and Main.

◆ mangle()

std::string llvm::orc::LLJIT::mangle ( StringRef  UnmangledName)
protected

Definition at line 143 of file LLJIT.cpp.

References DL, and llvm::Mangler::getNameWithPrefix().

Referenced by lookup().

◆ recordCtorDtors()

void llvm::orc::LLJIT::recordCtorDtors ( Module M)
protected

◆ runConstructors()

Error llvm::orc::LLJIT::runConstructors ( )
inline

Runs all not-yet-run static constructors.

Definition at line 112 of file LLJIT.h.

References CtorRunner, and llvm::orc::CtorDtorRunner::run().

◆ runDestructors()

Error llvm::orc::LLJIT::runDestructors ( )
inline

Runs all not-yet-run static destructors.

Definition at line 115 of file LLJIT.h.

References DtorRunner, and llvm::orc::CtorDtorRunner::run().

Friends And Related Function Documentation

◆ LLJITBuilderSetters

template<typename , typename , typename >
friend class LLJITBuilderSetters
friend

Definition at line 36 of file LLJIT.h.

Member Data Documentation

◆ CompileLayer

std::unique_ptr<IRCompileLayer> llvm::orc::LLJIT::CompileLayer
protected

Definition at line 143 of file LLJIT.h.

◆ CompileThreads

std::unique_ptr<ThreadPool> llvm::orc::LLJIT::CompileThreads
protected

Definition at line 140 of file LLJIT.h.

◆ CtorRunner

CtorDtorRunner llvm::orc::LLJIT::CtorRunner
protected

Definition at line 145 of file LLJIT.h.

Referenced by recordCtorDtors(), and runConstructors().

◆ DL

DataLayout llvm::orc::LLJIT::DL
protected

Definition at line 139 of file LLJIT.h.

Referenced by applyDataLayout(), getDataLayout(), and mangle().

◆ DtorRunner

CtorDtorRunner llvm::orc::LLJIT::DtorRunner
protected

Definition at line 145 of file LLJIT.h.

Referenced by recordCtorDtors(), and runDestructors().

◆ ES

std::unique_ptr<ExecutionSession> llvm::orc::LLJIT::ES
protected

◆ Main

JITDylib& llvm::orc::LLJIT::Main
protected

◆ ObjLinkingLayer

std::unique_ptr<ObjectLayer> llvm::orc::LLJIT::ObjLinkingLayer
protected

Definition at line 142 of file LLJIT.h.

Referenced by getObjLinkingLayer().


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