[llvm-dev] JIT compilation with LLVM

Lang Hames via llvm-dev llvm-dev at lists.llvm.org
Fri May 31 13:06:20 PDT 2019


Hi Daniel, Frank,

MCJIT is an ExecutionEngine implementation. You never get a direct pointer
to it, instead you create one using an EngineBuilder and access it via the
ExecutionEngine interface.

The LLJIT class (llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h) provides an
alternative (non ExecutionEngine based) interface for basic JITing. You can
find a usage example in llvm/examples/HowToUseLLJIT.

Finally, as Frank suggested, you can build your own JIT class out of ORC
components by following the BuildingAJIT tutorial series. This series is
(still) under development, but the initial chapters should be enough to
build something with MCJIT's capabilities.

Cheers,
Lang.


On Mon, May 13, 2019 at 2:07 AM Frank Tetzel via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> > I am developing a small project using LLVM. The objective is to
> > provide dynamic loading via JIT compilation of C++ code contained in
> > a (TS) module. For this reason, I would like to return an explicitly
> > raw void pointer (resembling libdl's `void *dlsym(void *, char const
> > *);` as closely as possible) to the compiled result. The MCJIT class
> > offers the most convenient API for me, but I'm not sure it is
> > intended for public use as it is not in the include path in a LLVM
> > installation, even when built from source (I am building from the git
> > repo); neither is OrcMCJITReplacement. What is the way that you would
> > suggest to use LLVM's JIT capabilities? It would already help a lot
> > if I knew which function/class names to look up.
>
>
> I guess, the best place to start is the tutorial[1]. This one is for
> the ORC JIT API. I am not the right person to ask what the prefered API
> for new projects is as I'm still quite new to all of this as well.
>
> To get a function pointer, you have to resolve the symbol in the
> generated code.
>
>
> [1] https://llvm.org/docs/tutorial/BuildingAJIT1.html
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190531/3409aa80/attachment.html>


More information about the llvm-dev mailing list