18 Expected<std::unique_ptr<LLJIT>>
21 return std::unique_ptr<LLJIT>(
22 new LLJIT(std::move(ES), std::move(TM), std::move(DL)));
26 auto InternedName =
ES->getSymbolStringPool().intern(Name);
32 assert(M &&
"Can not add null module");
37 auto K =
ES->allocateVModule();
48 : ES(
std::move(ES)),
Main(this->ES->createVSO(
"main")), TM(
std::move(TM)),
55 std::shared_ptr<RuntimeDyld::MemoryManager>
57 return llvm::make_unique<SectionMemoryManager>();
61 std::string MangledName;
74 return make_error<StringError>(
75 "Added modules have incompatible data layouts",
90 const Triple &TT = TM->getTargetTriple();
94 return make_error<StringError>(
95 std::string(
"No callback manager available for ") + TT.
str(),
100 return make_error<StringError>(
101 std::string(
"No indirect stubs manager builder for ") + TT.
str(),
104 return std::unique_ptr<LLLazyJIT>(
105 new LLLazyJIT(std::move(ES), std::move(TM), std::move(DL), Ctx,
106 std::move(CCMgr), std::move(ISMBuilder)));
110 assert(M &&
"Can not add null module");
119 auto K =
ES->allocateVModule();
120 return CODLayer.add(V, K, std::move(M));
123 LLLazyJIT::LLLazyJIT(
124 std::unique_ptr<ExecutionSession>
ES, std::unique_ptr<TargetMachine>
TM,
126 std::unique_ptr<JITCompileCallbackManager> CCMgr,
127 std::function<std::unique_ptr<IndirectStubsManager>()> ISMBuilder)
128 :
LLJIT(std::move(ES), std::move(TM), std::move(DL)),
129 CCMgr(std::move(CCMgr)), TransformLayer(*this->ES,
CompileLayer),
130 CODLayer(*this->ES, TransformLayer, *this->CCMgr, std::move(ISMBuilder),
virtual Error add(VSO &V, VModuleKey K, std::unique_ptr< Module > M)
Adds a MaterializationUnit representing the given IR to the given VSO.
std::enable_if< std::is_convertible< typename std::decay< UniquePtrToMaterializationUnit >::type, std::unique_ptr< MaterializationUnit > >::value, Error >::type define(UniquePtrToMaterializationUnit &&MU)
Define all symbols provided by the materialization unit to be part of the given VSO.
A parsed version of the target data layout string in and methods for querying it. ...
Compute iterated dominance frontiers using a linear time algorithm.
std::function< std::unique_ptr< IndirectStubsManager >)> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indriect stubs manager builder.
Error defineAbsolute(StringRef Name, JITEvaluatedSymbol Address)
Convenience method for defining an absolute symbol.
A Module instance is used to store all the information related to an LLVM module. ...
A symbol table that supports asynchoronous symbol queries.
void setDataLayout(StringRef Desc)
Set the data layout.
std::map< SymbolStringPtr, JITEvaluatedSymbol > SymbolMap
A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).
uint64_t VModuleKey
VModuleKey provides a unique identifier (allocated and managed by ExecutionSessions) for a module add...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Error addLazyIRModule(VSO &V, std::unique_ptr< Module > M)
Add a module to be lazily compiled to VSO V.
CtorDtorRunner2 DtorRunner
IRCompileLayer2 CompileLayer
Tagged union holding either a T or a Error.
Simple compile functor: Takes a single IR module and returns an ObjectFile.
RTDyldObjectLinkingLayer2 ObjLinkingLayer
iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
std::shared_ptr< RuntimeDyld::MemoryManager > getMemoryManager(VModuleKey K)
const std::string & str() const
This is an important class for using LLVM in a threaded context.
std::string mangle(StringRef UnmangledName)
LLJIT(std::unique_ptr< ExecutionSession > ES, std::unique_ptr< TargetMachine > TM, DataLayout DL)
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 n...
CtorDtorRunner2 CtorRunner
Triple - Helper class for working with autoconf configuration names.
std::unique_ptr< ExecutionSession > ES
static ErrorSuccess success()
Create a success value.
void recordCtorDtors(Module &M)
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
Expected< SymbolMap > lookup(const VSOList &VSOs, SymbolNameSet Names)
Look up the given names in the given VSOs.
static Expected< std::unique_ptr< LLLazyJIT > > Create(std::unique_ptr< ExecutionSession > ES, std::unique_ptr< TargetMachine > TM, DataLayout DL, LLVMContext &Ctx)
Create an LLLazyJIT instance.
std::unique_ptr< TargetMachine > TM
bool isDefault() const
Test if the DataLayout was constructed from an empty string.
An extended version of LLJIT that supports lazy function-at-a-time compilation of LLVM IR...
void add(iterator_range< CtorDtorIterator > CtorDtors)
Represents a symbol that has been evaluated to an address already.
void makeAllSymbolsExternallyAccessible(Module &M)
Raise linkage types and rename as necessary to ensure that all symbols are accessible for other modul...
static Expected< std::unique_ptr< LLJIT > > Create(std::unique_ptr< ExecutionSession > ES, std::unique_ptr< TargetMachine > TM, DataLayout DL)
Create an LLJIT instance.
iterator_range< CtorDtorIterator > getConstructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
std::unique_ptr< JITCompileCallbackManager > createLocalCompileCallbackManager(const Triple &T, ExecutionSession &ES, JITTargetAddress ErrorHandlerAddress)
Create a local compile callback manager.
Error applyDataLayout(Module &M)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
Lightweight error class with error context and mandatory checking.
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
print Print MemDeps of function
StringRef - Represent a constant reference to a string, i.e.
Error addIRModule(VSO &V, std::unique_ptr< Module > M)
Adds an IR module to the given VSO.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...