Programming Language for Beginners
Paul Brook
paul@codesourcery.com
Fri Sep 10 16:45:00 GMT 2004
On Friday 10 September 2004 16:57, Kevin Handy wrote:
> Paul Brook wrote:
> >It doesn't answer your question, but you might consider working with the
> >current development version of GCC (what will become 4.0). The interface
> >between a frontend and the rest of gcc is much cleaner there as a result
> > of the tree-ssa work.
>
> Is there documentation of the tre-ssa interface anywhere?
>
> All I see in the gccint manual is a reference that you should be
> generating either GENERIC or GIMPLE trees (with numerous
> BUG's and TODO's in the text), and then the documentation
> goes on to "Trees: The intermediate representation used by the
> C and C++ front ends". Are these "Trees" SIMPLE, GIMPLE,
> or RTL? Since it also talks about writing "back-ends" using
> that structure, I assume it is RTL. Shouldn't this be made
> obvious in the text?
You want GENERIC. Unfortunately the gccint manual is all the documentation we
have. Everything else you'll have to figure out from the source.
GIMPLE is a subset of GENERIC used by the optimizers. I think the C frontends
go directly from parse trees to GIMPLE.
RTL is used for target specific code generation, and the old optimizers. You
shouldn't need to know anything about this.
> Which front end would be the best one to look at to understand
> how the tree-ssa interface works? Which one woule be the best one
> to copy for a new front end?
I'd say the Fortran frontend, but I'm biased:)
The Fortran frontend has been recently rewritten. It uses custom data
structures while parsing, then translates these into GENERIC trees once a
whole program unit has been parsed.
> Which front end would be the best one to look at to understand
> how the tree-ssa interface works? Which one woule be the best one
> to copy for a new front end?
The C and C++ frontends can be confusing because they extend the "tree"
structures and use them for parsing. These are then transformed into GENERIC.
This results in slightly different semantics depending where in the sompiler
you happen to be.
I'm not sure what the Java frontend looks like.
Ada hasn't recovered from the tree-ssa merge, so I'd stay well clear.
Paul
More information about the Gcc
mailing list