雷景然 via llvm-dev
2016-Nov-01 16:33 UTC
[llvm-dev] HowToRunJIT doesn't work on windows 10 x64
Hi All, First, I want to show you a bug which I found at HowToUseJIT.cpp. This is correct one, I changed locally: ---------------------------- outs() << "We just constructed this LLVM module:\n\n" << *M; outs() << "\n\nRunning foo on : " << M->getTargetTriple(); outs().flush(); // Now we create the JIT. ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create(); ---------------------------- And then, the original version is : ---------------------------- // Now we create the JIT. ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create(); outs() << "We just constructed this LLVM module:\n\n" << *M; outs() << "\n\nRunning foo on : " << M->getTargetTriple(); outs().flush(); ---------------------------- Because `Owner` is move into `EE`, and `M` is came from `Owner`, so the original version is incorrect. I had change this locally. :) Finally, My question is : why I got the error below when I ran the HowToUseJIT ----------------------------------------- We just constructed this LLVM module: ; ModuleID = 'test' source_filename = "test" target triple = "x86_64-pc-windows-msvc" define i32 @add1(i32 %AnArg) { EntryBlock: %0 = add i32 1, %AnArg ret i32 %0 } define i32 @foo() { EntryBlock: %0 = tail call i32 @add1(i32 10) ret i32 %0 } Running foo on : x86_64-pc-windows-msvc LLVM ERROR: Target does not support MC emission! Press any key to continue . . . ----------------------------------------- My HowToUseJIT.cpp code is below: -------------------------- int main() { ... M->setTargetTriple(sys::getDefaultTargetTriple()); outs() << "We just constructed this LLVM module:\n\n" << *M; outs() << "\n\nRunning foo on : " << M->getTargetTriple(); outs().flush(); ForceMCJITLinking::ForceMCJITLinking(); // Now we create the JIT. ExecutionEngine* EE = EngineBuilder(std::move(Owner)).create(); // Call the `foo' function with no arguments: std::vector<GenericValue> noargs; GenericValue gv = EE->runFunction(FooF, noargs); ... } -------------------------- Best Regards. Leagmain (Jingran.Lear) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161102/01cd5d28/attachment.html>