<div dir="ltr">Dear llvm-dev list,<div><br></div><div>Apologies if this list is not the right venue for this query - suitable redirection would be appreciated in that case.</div><div><br></div><div>I have a JIT use case that I'd like to know the best way to implement using LLVM.</div><div><br></div><div>I am looking to migrate from the existing native compilation option (Tiny C Compiler - TCC) for pLisp, a Lisp dialect and IDE.</div><div><br></div><div>At present, the native compilation is done by converting the Lisp code to C, storing the C code in a char buffer, and passing it to TCC programmatically via the API provided. I get a function pointer in return, which I store and invoke as needed.</div><div><br></div><div>Delving into the LLVM documentation, I found that one possible way to achieve the same functionality in LLVM is to use clag/libclang to convert the C source to LLVM IR, load this IR into the the JIT context and (skipping some steps I'm yet to figure out) get the desired function pointer.</div><div><br></div><div>Is this approach the right one? One issue I foresee is that libclang's clang_parseTranslateUnit() function expects the C code to be from a file (although the file can be in-memory), whereas in my case the C code needs to be picked up from a char buffer - necessitating fmemopen(), etc.</div><div><br></div><div>Thanks for your assistance.<br clear="all"><div><br></div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,<br>Rajesh Jayaprakash</div><div>(<a href="https://github.com/shikantaza/plisp">https://github.com/shikantaza/plisp</a>)<br><br></div></div></div></div>