[cfe-dev] How to use clang and llvm for JIT, preferably via the C API

Joel Andersson via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 31 06:22:37 PDT 2015


Hi!

I'm trying to add JIT support to our software for mathematical optimization
(http://casadi.org), but it's proving difficult. Since we already support
generation of C code, the natural approach is to generate C code (either as
temporary files or as strings) and parse this code using clang. Although
we've managed to implement a proof-of-concept, I'm struggling to implement
something more maintainable.

In particular, I'd like to use the C API (libclang), but I don't see how
this can be combined with JIT. If I want to do clang+JIT, am I forced to
use the (unstable) C++ API?

Here is a stackoverflow post I posted on the subject (without luck):

http://stackoverflow.com/questions/32254862/just-in-time-compilation-using-libclang-and-llvm-c

Best regards,
Joel

P.S. I'm also struggling to set up our (CMake-based) build system so that
it works with multiple llvm versions and multiple platforms. The
"llvm-config" doesn't appear to have anything clang-related. But I guess
that's a separate issue.

-- 
-- 
Joel Andersson, PhD
Ptge. Busquets 11-13, atico 3
E-08940 Cornella de Llobregat (Barcelona), Spain
Home: +34-93-6034011
Mobile: +34-63-4408800 (in Sweden also +46-707-360512)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150831/ee98f134/attachment.html>


More information about the cfe-dev mailing list