summaryrefslogtreecommitdiff
path: root/examples/Kaleidoscope/include/KaleidoscopeJIT.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/Kaleidoscope/include/KaleidoscopeJIT.h')
-rw-r--r--examples/Kaleidoscope/include/KaleidoscopeJIT.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/Kaleidoscope/include/KaleidoscopeJIT.h b/examples/Kaleidoscope/include/KaleidoscopeJIT.h
index fe73d717976..1e2d567c057 100644
--- a/examples/Kaleidoscope/include/KaleidoscopeJIT.h
+++ b/examples/Kaleidoscope/include/KaleidoscopeJIT.h
@@ -41,7 +41,7 @@ class KaleidoscopeJIT {
public:
using ObjLayerT = RTDyldObjectLinkingLayer;
using CompileLayerT = IRCompileLayer<ObjLayerT, SimpleCompiler>;
- using ModuleHandleT = CompileLayerT::ModuleHandleT;
+ using ModuleHandleT = CompileLayerT::ModuleSetHandleT;
KaleidoscopeJIT()
: TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
@@ -62,9 +62,9 @@ public:
return JITSymbol(nullptr);
},
[](const std::string &S) { return nullptr; });
- auto H = CompileLayer.addModule(std::move(M),
- make_unique<SectionMemoryManager>(),
- std::move(Resolver));
+ auto H = CompileLayer.addModuleSet(singletonSet(std::move(M)),
+ make_unique<SectionMemoryManager>(),
+ std::move(Resolver));
ModuleHandles.push_back(H);
return H;
@@ -72,7 +72,7 @@ public:
void removeModule(ModuleHandleT H) {
ModuleHandles.erase(find(ModuleHandles, H));
- CompileLayer.removeModule(H);
+ CompileLayer.removeModuleSet(H);
}
JITSymbol findSymbol(const std::string Name) {
@@ -89,6 +89,12 @@ private:
return MangledName;
}
+ template <typename T> static std::vector<T> singletonSet(T t) {
+ std::vector<T> Vec;
+ Vec.push_back(std::move(t));
+ return Vec;
+ }
+
JITSymbol findMangledSymbol(const std::string &Name) {
#ifdef LLVM_ON_WIN32
// The symbol lookup of ObjectLinkingLayer uses the SymbolRef::SF_Exported