summaryrefslogtreecommitdiffstats
path: root/llvm/examples
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2018-02-14 22:13:02 +0000
committerLang Hames <lhames@gmail.com>2018-02-14 22:13:02 +0000
commit1cd3dd0bd8ba00a9a613f651fe74868276301f03 (patch)
treed56a717bf2daebc2c9a58132ab7709d29839e0b5 /llvm/examples
parente833fe8ec31e1bc51d59c84af158ac44ed423153 (diff)
downloadbcm5719-llvm-1cd3dd0bd8ba00a9a613f651fe74868276301f03.tar.gz
bcm5719-llvm-1cd3dd0bd8ba00a9a613f651fe74868276301f03.zip
[ORC] Consolidate RTDyldObjectLinkingLayer GetMemMgr and GetResolver into a
unified GetResources callback. Having a single 'GetResources' callback will simplify adding new resources in the future. llvm-svn: 325180
Diffstat (limited to 'llvm/examples')
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h10
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h10
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h11
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h10
-rw-r--r--llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h10
-rw-r--r--llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h9
6 files changed, 31 insertions, 29 deletions
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h
index a5553f488bb..a7eb1db8625 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h
@@ -47,7 +47,6 @@ private:
IRCompileLayer<decltype(ObjectLayer), SimpleCompiler> CompileLayer;
public:
-
KaleidoscopeJIT()
: ES(SSP),
Resolver(createLegacyLookupResolver(
@@ -63,10 +62,11 @@ public:
},
[](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),
TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
- ObjectLayer(
- ES,
- [](VModuleKey) { return std::make_shared<SectionMemoryManager>(); },
- [this](VModuleKey K) { return Resolver; }),
+ ObjectLayer(ES,
+ [this](VModuleKey) {
+ return RTDyldObjectLinkingLayer::Resources{
+ std::make_shared<SectionMemoryManager>(), Resolver};
+ }),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)) {
llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
}
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
index c04244a4ad7..b6323b8963b 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h
@@ -56,7 +56,6 @@ private:
IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer;
public:
-
KaleidoscopeJIT()
: ES(SSP),
Resolver(createLegacyLookupResolver(
@@ -72,10 +71,11 @@ public:
},
[](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),
TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
- ObjectLayer(
- ES,
- [](VModuleKey) { return std::make_shared<SectionMemoryManager>(); },
- [this](VModuleKey K) { return Resolver; }),
+ ObjectLayer(ES,
+ [this](VModuleKey) {
+ return RTDyldObjectLinkingLayer::Resources{
+ std::make_shared<SectionMemoryManager>(), Resolver};
+ }),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
OptimizeLayer(CompileLayer, [this](std::shared_ptr<Module> M) {
return optimizeModule(std::move(M));
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
index 767a1183b44..d6d31870002 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h
@@ -63,13 +63,14 @@ private:
CompileOnDemandLayer<decltype(OptimizeLayer)> CODLayer;
public:
-
KaleidoscopeJIT()
: ES(SSP), TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
- ObjectLayer(
- ES,
- [](VModuleKey) { return std::make_shared<SectionMemoryManager>(); },
- [&](orc::VModuleKey K) { return Resolvers[K]; }),
+ ObjectLayer(ES,
+ [this](VModuleKey K) {
+ return RTDyldObjectLinkingLayer::Resources{
+ std::make_shared<SectionMemoryManager>(),
+ Resolvers[K]};
+ }),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
OptimizeLayer(CompileLayer,
[this](std::shared_ptr<Module> M) {
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
index 1fa169b8b13..f3878918065 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h
@@ -89,7 +89,6 @@ private:
std::unique_ptr<IndirectStubsManager> IndirectStubsMgr;
public:
-
KaleidoscopeJIT()
: ES(SSP),
Resolver(createLegacyLookupResolver(
@@ -107,10 +106,11 @@ public:
},
[](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),
TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
- ObjectLayer(
- ES,
- [](VModuleKey) { return std::make_shared<SectionMemoryManager>(); },
- [&](VModuleKey K) { return Resolver; }),
+ ObjectLayer(ES,
+ [this](VModuleKey K) {
+ return RTDyldObjectLinkingLayer::Resources{
+ std::make_shared<SectionMemoryManager>(), Resolver};
+ }),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
OptimizeLayer(CompileLayer,
[this](std::shared_ptr<Module> M) {
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h
index 806573f1667..46638c1f720 100644
--- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h
@@ -95,7 +95,6 @@ private:
MyRemote &Remote;
public:
-
KaleidoscopeJIT(MyRemote &Remote)
: ES(SSP),
Resolver(createLegacyLookupResolver(
@@ -115,10 +114,11 @@ public:
"", SmallVector<std::string, 0>())),
DL(TM->createDataLayout()),
ObjectLayer(ES,
- [&Remote](VModuleKey) {
- return cantFail(Remote.createRemoteMemoryManager());
- },
- [this](VModuleKey) { return Resolver; }),
+ [this](VModuleKey K) {
+ return RTDyldObjectLinkingLayer::Resources{
+ cantFail(this->Remote.createRemoteMemoryManager()),
+ Resolver};
+ }),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
OptimizeLayer(CompileLayer,
[this](std::shared_ptr<Module> M) {
diff --git a/llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h
index c2f9d80f636..3e2fe42a5d8 100644
--- a/llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h
+++ b/llvm/examples/Kaleidoscope/include/KaleidoscopeJIT.h
@@ -51,10 +51,11 @@ public:
},
[](Error Err) { cantFail(std::move(Err), "lookupFlags failed"); })),
TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
- ObjectLayer(
- ES,
- [](VModuleKey) { return std::make_shared<SectionMemoryManager>(); },
- [this](VModuleKey) { return Resolver; }),
+ ObjectLayer(ES,
+ [this](VModuleKey) {
+ return ObjLayerT::Resources{
+ std::make_shared<SectionMemoryManager>(), Resolver};
+ }),
CompileLayer(ObjectLayer, SimpleCompiler(*TM)) {
llvm::sys::DynamicLibrary::LoadLibraryPermanently(nullptr);
}
OpenPOWER on IntegriCloud