Together with Jan Sjodin (in copy of this email), we begin an
implementation of the JIT with MC. The idea, suggested by Jan, is to
develop a MCJIT in parallel of the current JIT and to keep the two
implementations until (at least) the new MC one is mature enough.
Currently code is kept on gitorious
Following this, a boolean "bool MCJIT = false" has been introduced to
the "static ExecutionEngine *create(...)" method, allowing the lli
tool to use the MCJIT with the optional flag "-mcjit".
The MCJIT can now execute little functions with no relocation (like
add(a,b) => a+b), to do that some modifications have been made :
- The addPassesToEmitMC method has been added to TargetMachine class.
It fills the MCContext pointer so we can build the MCJITStreamer.
- The Finish method of MCAssembler have a new optional argument
"Writer" to allow a custom MCJITObjectWriter to be used.
Can you give us some feedbacks on the general idea and on this 2
particular hooks ?
Currently MCJIT has one unittest and the binary size is quite big
(~110MB in debug...) because before using the MC framework we need to
call "InitializeAllTargets()" and friends (same as llc does). For the
JIT, we need only the "host" backend and "InitializeHostTarget()"-like
method doesn't seem to exist. Do you have an opinion on this ?
Attached you will find the patch introducing the first MCJIT draft.
Can you comment on this ?
Jan and Olivier.
mc_jit.patch (55.4 KB)