LLVM  7.0.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | 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:
[legend]
Collaboration diagram for llvm::orc::LLJIT:
[legend]

Public Member Functions

ExecutionSession & getExecutionSession ()
 Returns a reference to the ExecutionSession for this JIT instance. More...
 
VSO & getMainVSO ()
 Returns a reference to the VSO representing the JIT'd main program. More...
 
Error defineAbsolute (StringRef Name, JITEvaluatedSymbol Address)
 Convenience method for defining an absolute symbol. More...
 
Error addIRModule (VSO &V, std::unique_ptr< Module > M)
 Adds an IR module to the given VSO. More...
 
Error addIRModule (std::unique_ptr< Module > M)
 Adds an IR module to the Main VSO. More...
 
Expected< JITEvaluatedSymbol > lookupLinkerMangled (VSO &V, StringRef Name)
 Look up a symbol in VSO V by the symbol's linker-mangled name (to look up symbols based on their IR name use the lookup function instead). More...
 
Expected< JITEvaluatedSymbol > lookupLinkerMangled (StringRef Name)
 Look up a symbol in the main VSO by the symbol's linker-mangled name (to look up symbols based on their IR name use the lookup function instead). More...
 
Expected< JITEvaluatedSymbol > lookup (VSO &V, StringRef UnmangledName)
 Look up a symbol in VSO V based on its IR symbol name. More...
 
Expected< JITEvaluatedSymbol > lookup (StringRef UnmangledName)
 Look up a symbol in the main VSO 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...
 

Static Public Member Functions

static Expected< std::unique_ptr< LLJIT > > Create (std::unique_ptr< ExecutionSession > ES, std::unique_ptr< TargetMachine > TM, DataLayout DL)
 Create an LLJIT instance. More...
 

Protected Member Functions

 LLJIT (std::unique_ptr< ExecutionSession > ES, std::unique_ptr< TargetMachine > TM, DataLayout DL)
 
std::shared_ptr< RuntimeDyld::MemoryManager > getMemoryManager (VModuleKey K)
 
std::string mangle (StringRef UnmangledName)
 
Error applyDataLayout (Module &M)
 
void recordCtorDtors (Module &M)
 

Protected Attributes

std::unique_ptr< ExecutionSession > ES
 
VSO & Main
 
std::unique_ptr< TargetMachine > TM
 
DataLayout DL
 
RTDyldObjectLinkingLayer2 ObjLinkingLayer
 
IRCompileLayer2 CompileLayer
 
CtorDtorRunner2 CtorRunner
 
CtorDtorRunner2 DtorRunner
 

Detailed Description

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

Definition at line 30 of file LLJIT.h.

Constructor & Destructor Documentation

◆ LLJIT()

llvm::orc::LLJIT::LLJIT ( std::unique_ptr< ExecutionSession >  ES,
std::unique_ptr< TargetMachine >  TM,
DataLayout  DL 
)
protected

Definition at line 46 of file LLJIT.cpp.

References CompileLayer, CtorRunner, DtorRunner, ES, getMemoryManager(), Main, ObjLinkingLayer, and TM.

Referenced by Create(), and runDestructors().

Member Function Documentation

◆ addIRModule() [1/2]

Error llvm::orc::LLJIT::addIRModule ( VSO &  V,
std::unique_ptr< Module >  M 
)

Adds an IR module to the given VSO.

Definition at line 31 of file LLJIT.cpp.

References assert().

Referenced by addIRModule(), and getMainVSO().

◆ addIRModule() [2/2]

Error llvm::orc::LLJIT::addIRModule ( std::unique_ptr< Module >  M)
inline

Adds an IR module to the Main VSO.

Definition at line 50 of file LLJIT.h.

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

◆ applyDataLayout()

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

◆ Create()

Expected< std::unique_ptr< LLJIT > > llvm::orc::LLJIT::Create ( std::unique_ptr< ExecutionSession >  ES,
std::unique_ptr< TargetMachine >  TM,
DataLayout  DL 
)
static

Create an LLJIT instance.

Definition at line 19 of file LLJIT.cpp.

References LLJIT().

◆ defineAbsolute()

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

Convenience method for defining an absolute symbol.

Definition at line 25 of file LLJIT.cpp.

References llvm::orc::absoluteSymbols(), llvm::orc::VSO::define(), ES, and Main.

Referenced by getMainVSO().

◆ getExecutionSession()

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

Returns a reference to the ExecutionSession for this JIT instance.

Definition at line 38 of file LLJIT.h.

References ES.

◆ getMainVSO()

VSO& llvm::orc::LLJIT::getMainVSO ( )
inline

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

Definition at line 41 of file LLJIT.h.

References addIRModule(), llvm::Address, defineAbsolute(), and Main.

◆ getMemoryManager()

std::shared_ptr< RuntimeDyld::MemoryManager > llvm::orc::LLJIT::getMemoryManager ( VModuleKey  K)
protected

Definition at line 56 of file LLJIT.cpp.

Referenced by LLJIT(), and runDestructors().

◆ lookup() [1/2]

Expected<JITEvaluatedSymbol> llvm::orc::LLJIT::lookup ( VSO &  V,
StringRef  UnmangledName 
)
inline

Look up a symbol in VSO V based on its IR symbol name.

Definition at line 65 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 VSO based on its IR symbol name.

Definition at line 70 of file LLJIT.h.

References lookup(), and Main.

◆ lookupLinkerMangled() [1/2]

Expected< JITEvaluatedSymbol > llvm::orc::LLJIT::lookupLinkerMangled ( VSO &  V,
StringRef  Name 
)

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

Definition at line 41 of file LLJIT.cpp.

References ES, and llvm::orc::lookup().

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

◆ lookupLinkerMangled() [2/2]

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

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

Definition at line 60 of file LLJIT.h.

References lookupLinkerMangled(), and Main.

◆ mangle()

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

Definition at line 60 of file LLJIT.cpp.

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

Referenced by lookup(), and runDestructors().

◆ 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 75 of file LLJIT.h.

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

◆ runDestructors()

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

Runs all not-yet-run static destructors.

Definition at line 78 of file LLJIT.h.

References applyDataLayout(), DtorRunner, getMemoryManager(), LLJIT(), mangle(), recordCtorDtors(), and llvm::orc::CtorDtorRunner2::run().

Member Data Documentation

◆ CompileLayer

IRCompileLayer2 llvm::orc::LLJIT::CompileLayer
protected

Definition at line 99 of file LLJIT.h.

Referenced by LLJIT().

◆ CtorRunner

CtorDtorRunner2 llvm::orc::LLJIT::CtorRunner
protected

Definition at line 101 of file LLJIT.h.

Referenced by LLJIT(), recordCtorDtors(), and runConstructors().

◆ DL

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

Definition at line 96 of file LLJIT.h.

Referenced by applyDataLayout(), and mangle().

◆ DtorRunner

CtorDtorRunner2 llvm::orc::LLJIT::DtorRunner
protected

Definition at line 101 of file LLJIT.h.

Referenced by LLJIT(), recordCtorDtors(), and runDestructors().

◆ ES

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

Definition at line 92 of file LLJIT.h.

Referenced by defineAbsolute(), getExecutionSession(), LLJIT(), and lookupLinkerMangled().

◆ Main

VSO& llvm::orc::LLJIT::Main
protected

◆ ObjLinkingLayer

RTDyldObjectLinkingLayer2 llvm::orc::LLJIT::ObjLinkingLayer
protected

Definition at line 98 of file LLJIT.h.

Referenced by LLJIT().

◆ TM

std::unique_ptr<TargetMachine> llvm::orc::LLJIT::TM
protected

Definition at line 95 of file LLJIT.h.

Referenced by LLJIT().


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