I'm still meddling with different ways to exploit LLVM's awesome JIT compilation capabilities from OCaml. Although I've managed to get minimal compilers up and running with relatively little effort, I can't help but think that I'm spending a significant amount of time reinventing the C front-end. Would it make sense to have higher-level OCaml bindings to the current CLang front-end to make code generation even easier? Does CLang use a suitable intermediate representation for this to be possible? Just an idea... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e
On Thu, 14 Feb 2008, Jon Harrop wrote:> Would it make sense to have higher-level OCaml bindings to the current CLang > front-end to make code generation even easier? > > Does CLang use a suitable intermediate representation for this to be possible?The higher level IR that clang uses is basically a C AST. This interface 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. -Chris -- http://nondot.org/sabre/ http://llvm.org/
On Thursday 14 February 2008 16:33:25 Chris Lattner wrote:> On Thu, 14 Feb 2008, Jon Harrop wrote: > > Does CLang use a suitable intermediate representation for this to be > > possible? > > The higher level IR that clang uses is basically a C AST. This interface > 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/ :-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e