<div dir="ltr">Hi Lang,<div><br></div><div>Thanks a lot, I should have thought of that... I can use libclang to get hold of the IR - that way I can avoid the command-line completely.</div><div><br></div><div>I don't think performance will be an issue, our generated code is quite large so the extra overhead will probably be dwarfed by other steps in the compilation chain.</div><div><br></div><div>When you refer to the "stable MCJIT API", you mean the C API, right? From what I can tell, it indeed appears to have the required functionality (<a href="http://llvm.org/docs/doxygen/html/c_2ExecutionEngine_8h.html">http://llvm.org/docs/doxygen/html/c_2ExecutionEngine_8h.html</a>).</div><div><br></div><div>Thanks!</div><div>Joel</div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-31 23:02 GMT+02:00 Lang Hames <span dir="ltr"><<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Joel,<div><br></div><div>As far as I know libclang doesn't provide an API for code generation (though I would double-check this on clang-dev).</div><div><br></div><div>If you can get hold of IR (e.g. by exec'ing "clang -c -emit-llvm ...") you can use the stable MCJIT API to JIT that. The performance of such a scheme may not be great though.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><br></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 31, 2015 at 7:57 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">+Lang for JIT stuff</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Aug 31, 2015 at 6:22 AM, Joel Andersson via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><div style="font-size:12.8000001907349px">Hi!</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">I'm trying to add JIT support to our software for mathematical optimization (<a href="http://casadi.org/" target="_blank">http://casadi.org</a>), 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.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">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?</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Here is a stackoverflow post I posted on the subject (without luck):</div><div style="font-size:12.8000001907349px"><br></div><a href="http://stackoverflow.com/questions/32254862/just-in-time-compilation-using-libclang-and-llvm-c" style="font-size:12.8000001907349px" target="_blank">http://stackoverflow.com/questions/32254862/just-in-time-compilation-using-libclang-and-llvm-c</a><br clear="all" style="font-size:12.8000001907349px"><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Best regards,</div><div style="font-size:12.8000001907349px">Joel</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">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.</div><span><font color="#888888"><div style="font-size:12.8000001907349px"></div><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>-- <br>Joel Andersson, PhD<br>Ptge. Busquets 11-13, atico 3<br>E-08940 Cornella de Llobregat (Barcelona), Spain<br>Home: <a href="tel:%2B34-93-6034011" value="+34936034011" target="_blank">+34-93-6034011</a><br>Mobile: <span style="font-size:12.8000001907349px">+34-63-4408800 (in</span><span style="font-size:12.8000001907349px"> Sweden also </span><span style="font-size:12.8000001907349px">+46-707-360512)</span></div></div></div></div></div></div></div>
</font></span></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>-- <br>Joel Andersson, PhD<br>Ptge. Busquets 11-13, atico 3<br>E-08940 Cornella de Llobregat (Barcelona), Spain<br>Home: +34-93-6034011<br>Mobile: <span style="font-size:12.8000001907349px">+34-63-4408800 (in</span><span style="font-size:12.8000001907349px"> Sweden also </span><span style="font-size:12.8000001907349px">+46-707-360512)</span></div></div></div></div></div></div></div>
</div></div></div>