diff options
author | Lang Hames <lhames@gmail.com> | 2016-07-15 01:39:49 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2016-07-15 01:39:49 +0000 |
commit | 8e1c20f81376fcedbbf33d39a57c92021d5180e2 (patch) | |
tree | a1f6d47e42bba6fa9c33927187eec5e0ea33b11b /examples | |
parent | 343b2711ecbe862c86f5a410e2b57c904f7bf9ce (diff) | |
download | llvm-8e1c20f81376fcedbbf33d39a57c92021d5180e2.tar.gz |
[Kaleidoscope][BuildingAJIT] Start filling in text for chapter 3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples')
3 files changed, 17 insertions, 14 deletions
diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h b/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h index 7ef1d07d8790..68bdafe9897c 100644 --- a/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h +++ b/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h @@ -42,7 +42,6 @@ class KaleidoscopeJIT { private: std::unique_ptr<TargetMachine> TM; const DataLayout DL; - std::unique_ptr<JITCompileCallbackManager> CompileCallbackManager; ObjectLinkingLayer<> ObjectLayer; IRCompileLayer<decltype(ObjectLayer)> CompileLayer; @@ -50,6 +49,8 @@ private: OptimizeFunction; IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer; + + std::unique_ptr<JITCompileCallbackManager> CompileCallbackManager; CompileOnDemandLayer<decltype(OptimizeLayer)> CODLayer; public: @@ -57,13 +58,13 @@ public: KaleidoscopeJIT() : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()), - CompileCallbackManager( - orc::createLocalCompileCallbackManager(TM->getTargetTriple(), 0)), CompileLayer(ObjectLayer, SimpleCompiler(*TM)), OptimizeLayer(CompileLayer, [this](std::unique_ptr<Module> M) { return optimizeModule(std::move(M)); }), + CompileCallbackManager( + orc::createLocalCompileCallbackManager(TM->getTargetTriple(), 0)), CODLayer(OptimizeLayer, [this](Function &F) { return std::set<Function*>({&F}); }, *CompileCallbackManager, diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h b/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h index b856bb5e4f3b..d14c2b1805f6 100644 --- a/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h +++ b/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h @@ -66,8 +66,6 @@ class KaleidoscopeJIT { private: std::unique_ptr<TargetMachine> TM; const DataLayout DL; - std::unique_ptr<JITCompileCallbackManager> CompileCallbackMgr; - std::unique_ptr<IndirectStubsManager> IndirectStubsMgr; ObjectLinkingLayer<> ObjectLayer; IRCompileLayer<decltype(ObjectLayer)> CompileLayer; @@ -76,19 +74,22 @@ private: IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer; + std::unique_ptr<JITCompileCallbackManager> CompileCallbackMgr; + std::unique_ptr<IndirectStubsManager> IndirectStubsMgr; + public: typedef decltype(OptimizeLayer)::ModuleSetHandleT ModuleHandle; KaleidoscopeJIT() : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()), - CompileCallbackMgr( - orc::createLocalCompileCallbackManager(TM->getTargetTriple(), 0)), CompileLayer(ObjectLayer, SimpleCompiler(*TM)), OptimizeLayer(CompileLayer, [this](std::unique_ptr<Module> M) { return optimizeModule(std::move(M)); - }) { + }), + CompileCallbackMgr( + orc::createLocalCompileCallbackManager(TM->getTargetTriple(), 0)) { auto IndirectStubsMgrBuilder = orc::createLocalIndirectStubsManagerBuilder(TM->getTargetTriple()); IndirectStubsMgr = IndirectStubsMgrBuilder(); diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h b/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h index 900ad8445735..24d6dc9b7b8f 100644 --- a/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h +++ b/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h @@ -69,11 +69,8 @@ typedef remote::OrcRemoteTargetClient<FDRPCChannel> MyRemote; class KaleidoscopeJIT { private: - MyRemote &Remote; std::unique_ptr<TargetMachine> TM; const DataLayout DL; - JITCompileCallbackManager *CompileCallbackMgr; - std::unique_ptr<IndirectStubsManager> IndirectStubsMgr; ObjectLinkingLayer<> ObjectLayer; IRCompileLayer<decltype(ObjectLayer)> CompileLayer; @@ -82,18 +79,22 @@ private: IRTransformLayer<decltype(CompileLayer), OptimizeFunction> OptimizeLayer; + JITCompileCallbackManager *CompileCallbackMgr; + std::unique_ptr<IndirectStubsManager> IndirectStubsMgr; + MyRemote &Remote; + public: typedef decltype(OptimizeLayer)::ModuleSetHandleT ModuleHandle; KaleidoscopeJIT(MyRemote &Remote) - : Remote(Remote), - TM(EngineBuilder().selectTarget()), + : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()), CompileLayer(ObjectLayer, SimpleCompiler(*TM)), OptimizeLayer(CompileLayer, [this](std::unique_ptr<Module> M) { return optimizeModule(std::move(M)); - }) { + }), + Remote(Remote) { auto CCMgrOrErr = Remote.enableCompileCallbacks(0); if (!CCMgrOrErr) { logAllUnhandledErrors(CCMgrOrErr.takeError(), errs(), |