summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-07-20 18:31:50 +0000
committerLang Hames <lhames@gmail.com>2018-07-20 18:31:50 +0000
commitfd0c1e71694ef1def33ec6293dbfae1f4c96f39b (patch)
tree541008992490aff54ab77d8e67ef8f69293c555a /llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
parenta2e18bba304842cecb8d68bc4199af17067d7ef4 (diff)
downloadbcm5719-llvm-fd0c1e71694ef1def33ec6293dbfae1f4c96f39b.tar.gz
bcm5719-llvm-fd0c1e71694ef1def33ec6293dbfae1f4c96f39b.zip
[ORC] Replace SymbolResolvers in the new ORC layers with search orders on VSOs.
A search order is a list of VSOs to be searched linearly to find symbols. Each VSO now has a search order that will be used when fixing up definitions in that VSO. Each VSO's search order defaults to just that VSO itself. This is a first step towards removing symbol resolvers from ORC altogether. In practice symbol resolvers tended to be used to implement a search order anyway, sometimes with additional programatic generation of symbols. Now that VSOs support programmatic generation of definitions via fallback generators, search orders provide a cleaner way to achieve the desired effect (while removing a lot of boilerplate). llvm-svn: 337593
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/LLJIT.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/LLJIT.cpp47
1 files changed, 5 insertions, 42 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 059fba23d57..52ff4efe56b 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -35,7 +35,6 @@ Error LLJIT::addIRModule(VSO &V, std::unique_ptr<Module> M) {
return Err;
auto K = ES->allocateVModule();
- Resolvers[K] = createResolverFor(V);
return CompileLayer.add(V, K, std::move(M));
}
@@ -49,23 +48,13 @@ LLJIT::LLJIT(std::unique_ptr<ExecutionSession> ES,
: ES(std::move(ES)), Main(this->ES->createVSO("main")), TM(std::move(TM)),
DL(std::move(DL)),
ObjLinkingLayer(*this->ES,
- [this](VModuleKey K) { return getRTDyldResources(K); }),
+ [this](VModuleKey K) { return getMemoryManager(K); }),
CompileLayer(*this->ES, ObjLinkingLayer, SimpleCompiler(*this->TM)),
- CtorRunner(Main), DtorRunner(Main) {
- VSOLookupOrder[&Main] = VSOList({&Main});
-}
-
-std::shared_ptr<SymbolResolver> LLJIT::takeSymbolResolver(VModuleKey K) {
- auto ResolverI = Resolvers.find(K);
- assert(ResolverI != Resolvers.end() && "Missing resolver");
- auto Resolver = std::move(ResolverI->second);
- Resolvers.erase(ResolverI);
- return Resolver;
-}
+ CtorRunner(Main), DtorRunner(Main) {}
-RTDyldObjectLinkingLayer2::Resources LLJIT::getRTDyldResources(VModuleKey K) {
- return orc::RTDyldObjectLinkingLayer2::Resources(
- {llvm::make_unique<SectionMemoryManager>(), takeSymbolResolver(K)});
+std::shared_ptr<RuntimeDyld::MemoryManager>
+LLJIT::getMemoryManager(VModuleKey K) {
+ return llvm::make_unique<SectionMemoryManager>();
}
std::string LLJIT::mangle(StringRef UnmangledName) {
@@ -77,21 +66,6 @@ std::string LLJIT::mangle(StringRef UnmangledName) {
return MangledName;
}
-std::unique_ptr<SymbolResolver> LLJIT::createResolverFor(VSO &V) {
- return createSymbolResolver(
- [&](SymbolFlagsMap &Flags, const SymbolNameSet &Symbols) {
- return V.lookupFlags(Flags, Symbols);
- },
- [&, this](std::shared_ptr<AsynchronousSymbolQuery> Q,
- SymbolNameSet Symbols) {
- assert(VSOLookupOrder.count(&V) && "No VSO lookup order for V");
- SymbolNameSet Unresolved = std::move(Symbols);
- for (auto *LV : VSOLookupOrder[&V])
- Unresolved = LV->lookup(Q, std::move(Unresolved));
- return Unresolved;
- });
-}
-
Error LLJIT::applyDataLayout(Module &M) {
if (M.getDataLayout().isDefault())
M.setDataLayout(DL);
@@ -143,7 +117,6 @@ Error LLLazyJIT::addLazyIRModule(VSO &V, std::unique_ptr<Module> M) {
recordCtorDtors(*M);
auto K = ES->allocateVModule();
- setSymbolResolver(K, createResolverFor(V));
return CODLayer.add(V, K, std::move(M));
}
@@ -155,17 +128,7 @@ LLLazyJIT::LLLazyJIT(
: LLJIT(std::move(ES), std::move(TM), std::move(DL)),
CCMgr(std::move(CCMgr)), TransformLayer(*this->ES, CompileLayer),
CODLayer(*this->ES, TransformLayer, *this->CCMgr, std::move(ISMBuilder),
- [this](VModuleKey K) { return takeSymbolResolver(K); },
- [this](VModuleKey K, std::shared_ptr<SymbolResolver> R) {
- setSymbolResolver(K, std::move(R));
- },
[&]() -> LLVMContext & { return Ctx; }) {}
-void LLLazyJIT::setSymbolResolver(VModuleKey K,
- std::shared_ptr<SymbolResolver> R) {
- assert(!Resolvers.count(K) && "Resolver already present for VModule K");
- Resolvers[K] = std::move(R);
-}
-
} // End namespace orc.
} // End namespace llvm.
OpenPOWER on IntegriCloud