From 8e1c20f81376fcedbbf33d39a57c92021d5180e2 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Fri, 15 Jul 2016 01:39:49 +0000 Subject: [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 --- .../Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h | 7 ++++--- .../Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h | 11 ++++++----- .../Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h | 13 +++++++------ 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'examples/Kaleidoscope') diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h b/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h index 7ef1d07d879..68bdafe9897 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 TM; const DataLayout DL; - std::unique_ptr CompileCallbackManager; ObjectLinkingLayer<> ObjectLayer; IRCompileLayer CompileLayer; @@ -50,6 +49,8 @@ private: OptimizeFunction; IRTransformLayer OptimizeLayer; + + std::unique_ptr CompileCallbackManager; CompileOnDemandLayer 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 M) { return optimizeModule(std::move(M)); }), + CompileCallbackManager( + orc::createLocalCompileCallbackManager(TM->getTargetTriple(), 0)), CODLayer(OptimizeLayer, [this](Function &F) { return std::set({&F}); }, *CompileCallbackManager, diff --git a/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h b/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h index b856bb5e4f3..d14c2b1805f 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 TM; const DataLayout DL; - std::unique_ptr CompileCallbackMgr; - std::unique_ptr IndirectStubsMgr; ObjectLinkingLayer<> ObjectLayer; IRCompileLayer CompileLayer; @@ -76,19 +74,22 @@ private: IRTransformLayer OptimizeLayer; + std::unique_ptr CompileCallbackMgr; + std::unique_ptr 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 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 900ad844573..24d6dc9b7b8 100644 --- a/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h +++ b/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h @@ -69,11 +69,8 @@ typedef remote::OrcRemoteTargetClient MyRemote; class KaleidoscopeJIT { private: - MyRemote &Remote; std::unique_ptr TM; const DataLayout DL; - JITCompileCallbackManager *CompileCallbackMgr; - std::unique_ptr IndirectStubsMgr; ObjectLinkingLayer<> ObjectLayer; IRCompileLayer CompileLayer; @@ -82,18 +79,22 @@ private: IRTransformLayer OptimizeLayer; + JITCompileCallbackManager *CompileCallbackMgr; + std::unique_ptr 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 M) { return optimizeModule(std::move(M)); - }) { + }), + Remote(Remote) { auto CCMgrOrErr = Remote.enableCompileCallbacks(0); if (!CCMgrOrErr) { logAllUnhandledErrors(CCMgrOrErr.takeError(), errs(), -- cgit v1.2.3