[LLVMdev] MCJIT and Kaleidoscope Tutorial

Dmitri Rubinstein dmitri.rubinstein at googlemail.com
Mon Jun 3 04:56:33 PDT 2013


Hi all,

I tried to modify Kaleidoscope Tutorial (toy.cpp from 
llvm/examples/Kaleidoscope/Chapter7, LLVM 3.3 release branch) in order 
to use MCJIT instead of JIT. I get segmentation fault when running 
toy.cpp with fibonacci example from the tutorial. My modified toy.cpp is 
in attachment and still works with JIT (when #define USE_MCJIT line is 
commented out).

I read discussions regarding MCJIT in this mailing list, and I 
understand it that MCJIT currently cannot be used in the same way as 
JIT. The separate function-by-function (i.e. incremental) compilation 
approach with getPointerToFunction, like the one used in the 
Kaleidoscope tutorial, will not work. Is this correct or do I do 
something wrong in my code ?

There was also a discussion about using multi-module approach instead of 
getPointerToFunction, but it seems that support for this is not yet 
available. I would like to know if there is any way currently to let 
Kaleidoscope-style of compilation work with MCJIT, and if no when it 
will be available ?

Also, even if MCJIT does not support currently this compilation style I 
still not understand why getPointerToFunction returns me a non-NULL 
pointer ? I expected to get at least assertion or a NULL pointer.

Thanks,

Dmitri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: toy.cpp
Type: text/x-c++src
Size: 33667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130603/bb601c0f/attachment.cpp>


More information about the llvm-dev mailing list