[LLVMdev] GCC frontend

Chris Lattner sabre at nondot.org
Sat Jul 10 12:56:02 PDT 2004


On Sat, 10 Jul 2004, Ramu Ramamurthy wrote:

>     LLVM is an excellent piece of work,

Thanks!

> LLVM is one of the few project I know that has used the mysterious GCC
> front-end. I think it will be a great contribution to the community if
> you could writeup and document how to interface to the GCC front-end
> data-structures (like LLVM has done). Specifically:
>
> a) detail the gcc front-end tree data-structures
> b) how to go about interfacing to them
> c) what are changes that LLVM did to the gcc front end

While that would be a useful document, I don't think that anyone will be
jumping to write it unfortunately.  We all have plenty of other
interesting things to do, and writing docs that makes it easier for people
to not use LLVM is not a high-priority. :)

> My interest is to interface to gcc data-structures to produce an
> open-source language independent IL in Ocaml -- like LLVM but at a
> higher level suitable for program analysis in Ocaml (like the CIL effort
> at berkeley -- note CIL folks developed their C frontend from scratch --
> a waste of effort when they could have leveraged the gcc frontend)

Ok.

> Unfortunately there is very little documentation for the gcc front end
> interface. I have to spend a lot of time code-browsing the gcc code
> trying to understand the gcc code and data-structures. Since you have
> done this already, I will really appreciate if you could document your
> efforts.

You could look a the llvmgcc source, or you could build on what we already
have with LLVM.  I'm not sure exactly what you hope to gain with a
OCaml-like CIL, but I suspect that you can get 95% or more of the benefit
by writing an OCaml backend for LLVM.  Please read up on LLVM and get a
clear understanding of what we can and can not do, you might be suprised.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://nondot.org/sabre/




More information about the llvm-dev mailing list