OSDN Git Service

[BuildingAJIT] Use the remote target triple to construct the TargetMachine in
authorLang Hames <lhames@gmail.com>
Wed, 19 Oct 2016 22:41:03 +0000 (22:41 +0000)
committerLang Hames <lhames@gmail.com>
Wed, 19 Oct 2016 22:41:03 +0000 (22:41 +0000)
Chapter 5.

Chapter 5 demonstrates remote JITing: code is executed on the remote, not the
machine running the REPL, so it's the remote's triple (and TargetMachine) that
we need.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284657 91177308-0d34-0410-b5e6-96231b3b80d8

examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h

index b122386..f11f036 100644 (file)
@@ -87,7 +87,8 @@ public:
   typedef decltype(OptimizeLayer)::ModuleSetHandleT ModuleHandle;
 
   KaleidoscopeJIT(MyRemote &Remote)
-      : TM(EngineBuilder().selectTarget()),
+      : TM(EngineBuilder().selectTarget(Triple(Remote.getTargetTriple()), "",
+                                        "", SmallVector<std::string, 0>())),
         DL(TM->createDataLayout()),
         CompileLayer(ObjectLayer, SimpleCompiler(*TM)),
         OptimizeLayer(CompileLayer,