[LLVMdev] Higher-level OCaml bindings

Jon Harrop jon at ffconsultancy.com
Thu Feb 14 09:26:22 PST 2008


On Thursday 14 February 2008 17:24:04 Chris Lattner wrote:
> On Thu, 14 Feb 2008, Jon Harrop wrote:
> >> is under constant flux  though.  If you wanted to do this, it would be
> >> very reasonable to just cons up some C code and send it through the
> >> clang parser.  Clang works great in a JIT environment.
> >
> > Great! Sounds like CIL should do the trick:
> >
> >  http://manju.cs.berkeley.edu/cil/
>
> Huh?

CIL should provide the AST type already in OCaml with a pretty printer to 
generate C code as a string that can be fed straight into CLang for JIT 
compilation. Then all I need is bindings to actually invoke CLang from OCaml 
with a string containing the source code.

I'm particularly interested in making FFI to existing C libraries as easy as 
possible using code compiled by my compiler. I can't think of a better way 
than explicitly using C as an intermediate language. :-)

Thanks,
-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e



More information about the llvm-dev mailing list