A suggestion to make it easier to develop gcc front ends

Paul Brook paul@nowt.org
Sat Apr 5 21:30:00 GMT 2003


On Saturday 05 April 2003 4:02 pm, Pablo De Napoli wrote:
> Dear developers of gcc:
>
> I want to make a suggestion of an improvement to gcc. The goal of this
> improvement would be making easier to develop new front-ends to gcc for
> different languages.
>
> My idea is that the backend and the front-ends of the gcc should be
> clearly separated. The backend should be implemented as a library. Then
> if someone wants to develop a new language, he would include the
> apropiated headers (say #include <gccbackend.h>) and link with the
> library.
>
> The backend library would implement the convertion from RTL code to
> assembler code, generating debugging code and (language-independent)
> optimizations.
>
> The gcc backend library should have a well-documented and (hopefully)
> stable API. So that when the gcc backends improves, we don't need to
> change every time the gcc front-ends source.

It still isn't entirely done, but a large proportion of the things you 
suggest have already been implemented in the tree-ssa branch. Specifically 
there is the GENERIC/GIMPLE intermediate tree representation. Generating 
these trees (the frontend) and optimizing/generating code from them (the 
backend) are two distinct processes, with the exception of a bit of setup 
code.

I'm not sure I'd describe the interface as well documented or stable as it's 
still fairly new, but It certainly could (and IMHO should) be.

I know of at least one person who routinely does work on g95 by developing 
the fronted in a seperate tree and linking with libbackend.a.

I haven't looked at the mainline/release branches recently, so couldn't say 
how much this is true for those.

Paul Brook



More information about the Gcc mailing list