summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-06-23 23:25:28 +0000
committerLang Hames <lhames@gmail.com>2017-06-23 23:25:28 +0000
commitcd9d49b605cc0c3283bc6f2ad4c38f8e1a525e7d (patch)
treede5c655184f5e9f11f2af90a3ab42d4ac10b6e1f /llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4
parent7aacb659dad5ecdaa984406e0c6cc9a087f44e1b (diff)
downloadbcm5719-llvm-cd9d49b605cc0c3283bc6f2ad4c38f8e1a525e7d.tar.gz
bcm5719-llvm-cd9d49b605cc0c3283bc6f2ad4c38f8e1a525e7d.zip
[ORC] Re-apply r306166 and r306168 with fix for regression test.
llvm-svn: 306182
Diffstat (limited to 'llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4')
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
index 58642237d4f..d45874e9a69 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
@@ -77,7 +77,7 @@ private:
IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
using OptimizeFunction =
- std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>;
+ std::function<std::shared_ptr<Module>(std::shared_ptr<Module>)>;
IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
@@ -85,14 +85,14 @@ private:
std::unique_ptr<IndirectStubsManager> IndirectStubsMgr;
public:
- using ModuleHandle = decltype(OptimizeLayer)::ModuleSetHandleT;
+ using ModuleHandle = decltype(OptimizeLayer)::ModuleHandleT;
KaleidoscopeJIT()
: TM(EngineBuilder().selectTarget()),
DL(TM->createDataLayout()),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
OptimizeLayer(CompileLayer,
- [this](std::unique_ptr<Module> M) {
+ [this](std::shared_ptr<Module> M) {
return optimizeModule(std::move(M));
}),
CompileCallbackMgr(
@@ -125,15 +125,11 @@ public:
return JITSymbol(nullptr);
});
- // Build a singleton module set to hold our module.
- std::vector<std::unique_ptr<Module>> Ms;
- Ms.push_back(std::move(M));
-
// Add the set to the JIT with the resolver we created above and a newly
// created SectionMemoryManager.
- return OptimizeLayer.addModuleSet(std::move(Ms),
- make_unique<SectionMemoryManager>(),
- std::move(Resolver));
+ return OptimizeLayer.addModule(std::move(M),
+ make_unique<SectionMemoryManager>(),
+ std::move(Resolver));
}
Error addFunctionAST(std::unique_ptr<FunctionAST> FnAST) {
@@ -199,7 +195,7 @@ public:
}
void removeModule(ModuleHandle H) {
- OptimizeLayer.removeModuleSet(H);
+ OptimizeLayer.removeModule(H);
}
private:
@@ -210,7 +206,7 @@ private:
return MangledNameStream.str();
}
- std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) {
+ std::shared_ptr<Module> optimizeModule(std::shared_ptr<Module> M) {
// Create a function pass manager.
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());
OpenPOWER on IntegriCloud