[llvm-exegesis] Pull out LLVMTargetMachine to simplify debugging. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 18 Apr 2018 13:39:03 +0000 (13:39 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 18 Apr 2018 13:39:03 +0000 (13:39 +0000)
Has been useful while trying to get around all the error reporting issues mentioned on PR37049.

llvm-svn: 330255

llvm/tools/llvm-exegesis/lib/InMemoryAssembler.cpp

index 00b7ee7..f110d00 100644 (file)
@@ -202,6 +202,7 @@ JitFunction::JitFunction(JitFunctionContext &&Context,
   LLVMLinkInMCJIT();
   uintptr_t CodeSize = 0;
   std::string Error;
+  llvm::LLVMTargetMachine *TM = FunctionContext.TM.release();
   ExecEngine.reset(
       llvm::EngineBuilder(std::move(FunctionContext.Module))
           .setErrorStr(&Error)
@@ -209,7 +210,7 @@ JitFunction::JitFunction(JitFunctionContext &&Context,
           .setEngineKind(llvm::EngineKind::JIT)
           .setMCJITMemoryManager(
               llvm::make_unique<TrackingSectionMemoryManager>(&CodeSize))
-          .create(FunctionContext.TM.release()));
+          .create(TM));
   if (!ExecEngine)
     llvm::report_fatal_error(Error);
   // Adding the generated object file containing the assembled function.