summaryrefslogtreecommitdiff
path: root/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-06-23 21:45:29 +0000
committerLang Hames <lhames@gmail.com>2017-06-23 21:45:29 +0000
commita5b199883c2f629345eee4fbbf2bd842a1bbca1b (patch)
treea13a39b879df3e80f8558341934d97978db1eb3f /examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
parent48d560bf0c66dd8eeb26bc7985f2be9adef9112a (diff)
[ORC] Move ORC IR layer interface from addModuleSet to addModule and fix the
module type as std::shared_ptr<Module>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h')
-rw-r--r--examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h b/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
index c851b609779..f6fb3071d52 100644
--- a/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
+++ b/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
@@ -51,7 +51,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;
@@ -59,13 +59,13 @@ private:
CompileOnDemandLayer<decltype(OptimizeLayer)> CODLayer;
public:
- using ModuleHandle = decltype(CODLayer)::ModuleSetHandleT;
+ using ModuleHandle = decltype(CODLayer)::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));
}),
CompileCallbackManager(
@@ -98,15 +98,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 CODLayer.addModuleSet(std::move(Ms),
- make_unique<SectionMemoryManager>(),
- std::move(Resolver));
+ return CODLayer.addModule(std::move(M),
+ make_unique<SectionMemoryManager>(),
+ std::move(Resolver));
}
JITSymbol findSymbol(const std::string Name) {
@@ -117,11 +113,11 @@ public:
}
void removeModule(ModuleHandle H) {
- CODLayer.removeModuleSet(H);
+ CODLayer.removeModule(H);
}
private:
- 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());