summaryrefslogtreecommitdiffstats
path: root/llvm/tools/lli/OrcLazyJIT.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-08-06 22:36:26 +0000
committerLang Hames <lhames@gmail.com>2016-08-06 22:36:26 +0000
commit73976f622d61d7bcd0d455fb1057beaaf3d479a4 (patch)
treef7f63260216be27907f8bcdf8f50383b6b35f36d /llvm/tools/lli/OrcLazyJIT.h
parent728447bd3b44a20a7d9c66c07a7f314a27dfdb19 (diff)
downloadbcm5719-llvm-73976f622d61d7bcd0d455fb1057beaaf3d479a4.tar.gz
bcm5719-llvm-73976f622d61d7bcd0d455fb1057beaaf3d479a4.zip
[ORC] Re-apply r277896, removing bogus triples and datalayouts that broke tests
on linux last time. llvm-svn: 277942
Diffstat (limited to 'llvm/tools/lli/OrcLazyJIT.h')
-rw-r--r--llvm/tools/lli/OrcLazyJIT.h37
1 files changed, 17 insertions, 20 deletions
diff --git a/llvm/tools/lli/OrcLazyJIT.h b/llvm/tools/lli/OrcLazyJIT.h
index 26be63de53e..71e0d839d27 100644
--- a/llvm/tools/lli/OrcLazyJIT.h
+++ b/llvm/tools/lli/OrcLazyJIT.h
@@ -38,7 +38,7 @@ public:
typedef orc::CompileOnDemandLayer<IRDumpLayerT, CompileCallbackMgr> CODLayerT;
typedef CODLayerT::IndirectStubsManagerBuilderT
IndirectStubsManagerBuilder;
- typedef CODLayerT::ModuleSetHandleT ModuleHandleT;
+ typedef CODLayerT::ModuleSetHandleT ModuleSetHandleT;
OrcLazyJIT(std::unique_ptr<TargetMachine> TM,
std::unique_ptr<CompileCallbackMgr> CCMgr,
@@ -62,18 +62,21 @@ public:
DtorRunner.runViaLayer(CODLayer);
}
- ModuleHandleT addModule(std::unique_ptr<Module> M) {
- // Attach a data-layout if one isn't already present.
- if (M->getDataLayout().isDefault())
- M->setDataLayout(DL);
+ ModuleSetHandleT addModuleSet(std::vector<std::unique_ptr<Module>> Ms) {
+ // Attach a data-layouts if they aren't already present.
+ for (auto &M : Ms)
+ if (M->getDataLayout().isDefault())
+ M->setDataLayout(DL);
// Record the static constructors and destructors. We have to do this before
// we hand over ownership of the module to the JIT.
std::vector<std::string> CtorNames, DtorNames;
- for (auto Ctor : orc::getConstructors(*M))
- CtorNames.push_back(mangle(Ctor.Func->getName()));
- for (auto Dtor : orc::getDestructors(*M))
- DtorNames.push_back(mangle(Dtor.Func->getName()));
+ for (auto &M : Ms) {
+ for (auto Ctor : orc::getConstructors(*M))
+ CtorNames.push_back(mangle(Ctor.Func->getName()));
+ for (auto Dtor : orc::getDestructors(*M))
+ DtorNames.push_back(mangle(Dtor.Func->getName()));
+ }
// Symbol resolution order:
// 1) Search the JIT symbols.
@@ -84,24 +87,18 @@ public:
[this](const std::string &Name) -> JITSymbol {
if (auto Sym = CODLayer.findSymbol(Name, true))
return Sym;
- if (auto Sym = CXXRuntimeOverrides.searchOverrides(Name))
- return Sym;
-
+ return CXXRuntimeOverrides.searchOverrides(Name);
+ },
+ [](const std::string &Name) {
if (auto Addr =
RTDyldMemoryManager::getSymbolAddressInProcess(Name))
return JITSymbol(Addr, JITSymbolFlags::Exported);
-
- return JITSymbol(nullptr);
- },
- [](const std::string &Name) {
return JITSymbol(nullptr);
}
);
// Add the module to the JIT.
- std::vector<std::unique_ptr<Module>> S;
- S.push_back(std::move(M));
- auto H = CODLayer.addModuleSet(std::move(S),
+ auto H = CODLayer.addModuleSet(std::move(Ms),
llvm::make_unique<SectionMemoryManager>(),
std::move(Resolver));
@@ -119,7 +116,7 @@ public:
return CODLayer.findSymbol(mangle(Name), true);
}
- JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name) {
+ JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name) {
return CODLayer.findSymbolIn(H, mangle(Name), true);
}
OpenPOWER on IntegriCloud