<div>Hi All,</div><div><br></div><div>First, I want to show you a bug which I found at HowToUseJIT.cpp.</div><div><br></div><div>This is correct one, I changed locally:</div><div>----------------------------</div><div><div>  outs() << "We just constructed this LLVM module:\n\n" << *M;</div><div>  outs() << "\n\nRunning foo on : " << M->getTargetTriple();</div><div>  outs().flush();</div><div><br></div><div>  // Now we create the JIT.</div><div>  ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create();</div></div><div>----------------------------</div><div><br></div><div>And then, the original version is :</div><div>----------------------------</div><div>  // Now we create the JIT.</div><div>  ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create();</div><div><br></div><div><div>  outs() << "We just constructed this LLVM module:\n\n" << *M;</div><div>  outs() << "\n\nRunning foo on : " << M->getTargetTriple();</div><div>  outs().flush();</div><div></div></div><div>----------------------------</div><div><br></div><div>Because `Owner` is move into `EE`, and `M` is came from `Owner`, so the original version is incorrect.</div><div><br></div><div>I had change this locally. :)</div><div><br></div><div>Finally, My question is : why I got the error below when I ran the HowToUseJIT</div><div>-----------------------------------------</div><div><div>We just constructed this LLVM module:</div><div><br></div><div>; ModuleID = 'test'</div><div>source_filename = "test"</div><div>target triple = "x86_64-pc-windows-msvc"</div><div><br></div><div>define i32 @add1(i32 %AnArg) {</div><div>EntryBlock:</div><div>  %0 = add i32 1, %AnArg</div><div>  ret i32 %0</div><div>}</div><div><br></div><div>define i32 @foo() {</div><div>EntryBlock:</div><div>  %0 = tail call i32 @add1(i32 10)</div><div>  ret i32 %0</div><div>}</div><div><br></div><div><br></div><div><br></div><div>Running foo on : x86_64-pc-windows-msvc</div><div>LLVM ERROR: Target does not support MC emission!</div><div>Press any key to continue . . .</div></div><div>-----------------------------------------</div><div><br></div><div>My HowToUseJIT.cpp code is below:</div><div>--------------------------</div><div><div>int main() {</div><div>  ...</div><div>  M->setTargetTriple(sys::getDefaultTargetTriple());</div><div>  outs() << "We just constructed this LLVM module:\n\n" << *M;</div><div>  outs() << "\n\nRunning foo on : " << M->getTargetTriple();</div><div>  outs().flush();</div><div><br></div><div>  ForceMCJITLinking::ForceMCJITLinking();</div><div>  // Now we create the JIT.</div><div>  ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create();</div><div><br></div><div>  // Call the `foo' function with no arguments:</div><div>  std::vector<GenericValue> noargs;</div><div>  GenericValue gv = EE->runFunction(FooF, noargs);</div></div><div>  ...</div><div>}</div><div>--------------------------</div><div><br></div><div><br></div><div>Best Regards.</div><div>Leagmain  (Jingran.Lear)</div><div><br></div><div><br></div><div> </div><div><br></div>