summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h')
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
index e9999efd37a..8037e58ae4f 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
@@ -45,15 +45,17 @@ private:
MangleAndInterner Mangle;
ThreadSafeContext Ctx;
+ JITDylib &MainJD;
+
public:
KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
: ObjectLayer(ES,
[]() { return std::make_unique<SectionMemoryManager>(); }),
CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
- OptimizeLayer(ES, CompileLayer, optimizeModule),
- DL(std::move(DL)), Mangle(ES, this->DL),
- Ctx(std::make_unique<LLVMContext>()) {
- ES.getMainJITDylib().addGenerator(
+ OptimizeLayer(ES, CompileLayer, optimizeModule), DL(std::move(DL)),
+ Mangle(ES, this->DL), Ctx(std::make_unique<LLVMContext>()),
+ MainJD(ES.createJITDylib("<main>")) {
+ MainJD.addGenerator(
cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
DL.getGlobalPrefix())));
}
@@ -76,12 +78,11 @@ public:
}
Error addModule(std::unique_ptr<Module> M) {
- return OptimizeLayer.add(ES.getMainJITDylib(),
- ThreadSafeModule(std::move(M), Ctx));
+ return OptimizeLayer.add(MainJD, ThreadSafeModule(std::move(M), Ctx));
}
Expected<JITEvaluatedSymbol> lookup(StringRef Name) {
- return ES.lookup({&ES.getMainJITDylib()}, Mangle(Name.str()));
+ return ES.lookup({&MainJD}, Mangle(Name.str()));
}
private:
OpenPOWER on IntegriCloud