Daniel Dunbar daniel at zuster.org
Tue Jul 20 08:09:14 PDT 2010

Hi Olivier,

On Mon, Jul 19, 2010 at 5:14 AM, Olivier Meurant
<meurant.olivier at gmail.com> wrote:
> 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
> (http://gitorious.org/llvm-mc-jit/llvm-mc-jit).

Great, we would really love to kill to the old JIT and move everything
to the MC framework.

> 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 :


In the context of the JIT, there really is no such thing as a
relocation, just fixups. I'm not completely sure what the right
approach is, but the JIT should be able to fully resolve all of the
symbols that are being used in the module. We may need some extra
interfaces to allow the JIT to tell the MCAssembler about the address
of some external symbols though.

> - 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.

Ok. We could also make the streamer setup the right ObjectWriter,
since the ObjectStreamer should always know what that is.

> Can you give us some feedbacks on the general idea and on this 2
> particular hooks ?

Seems reasonable, but I haven't looked at the code yet. I would
suggest trying to split your work up into separate patches which
implement incremental pieces of functionality, then submitting them to
llvm-commits for review. That is much easier for us to deal with than
large monolithic patches out of tree.

> 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 ?

You shouldn't need to initialize all targets to use MC, you should be
able to just use InitializeHostTarget(). If not, its probably a bug

 - Daniel

> Attached you will find the patch introducing the first MCJIT draft.
> Can you comment on this ?
> Jan and Olivier.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list