[LLVMdev] Some basic questions regarding MCJIT and Kaleidoscope sample

Dibyendu Majumdar mobile at majumdar.org.uk
Tue Feb 10 13:57:10 PST 2015


Hi,

I am building a new JIT compiler for Lua (actually a derivative of
Lua), and am planning to use LLVM for this. I have trying out some
basic functions using LLVM 3.5.1. I have been puzzled by one aspect of
the MCJIT versions of the Kaleidoscope sample, and would hugely
appreciate some insight.

Can a single MCJIT instance be used to manage several modules?
Why is a separate MCJIT instance created for each module?

Unfortunately the tutorial text does not explain the rationale for this.

At the moment in my implementation I am putting each compiled function
in its own module and creating an engine for it. This is so that each
function can be managed independently and linked to garbage collection
in Lua. However I do not know if there is a better way - for example
creating a shared engine across all modules. I would also like to
understand the trade offs with this approach versus other approaches.

Many thanks

Regards
Dibyendu



More information about the llvm-dev mailing list