This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Putting C++ code into gcc front end
Op za 08-03-2003, om 00:07 schreef Neil Booth:
> Geert Bosch wrote:-
>
> > Note that Ada already builds its own tree for a complete
> > translation unit. As last action the root of this tree is
> > passed to "Gigi", which is the code that converts the GNAT
> > trees to GCC trees. However, even though this glue code is
> > very local, it is quite complex, and separation still isn't
> > quite complete. A better documented back end / front end
> > interface would be a great step forward.
>
> IMO Ada has the best and cleanest GCC front end, despite being I think
> the biggest. I wonder if the fact that it has its own representation
> is just a coincidence.
Well, of course having per-front end IRs gives you better separation
between the front end and the middle/back end, and you *may* just get a
cleaner front end if you design your new IR carefully..
But having your own representation is in itself not the Holy Grail
either. Like Ada, G95 has its own internal representation. The task of
translating it to another IR (GENERIC for G95) should not be
underestimated. Like Geert said: That code is quite complex indeed.
(And I doubt even a million pages of documentation would change that.)
What I dislike most is that we go from one internal representation to
the next and there is no overlap between them: It's not like WHIRL where
you have five (?) different levels, but instead you go from a set of
front-end specific parse tree data structs to GENERIC, to GIMPLE, to
RTL. These are completely different intermediate representations, only
GENERIC->GIMPLE is lowering, and even that step is almost a complete
rewrite in some bad cases.
Surely you would not want something like that in the C front end.
It is funny to see ipf-orc get away with front ends that build their
parse tree in their own IRs (most notably the GNU C/C++ front ends that
build trees) and then translate that to WHIRL. And we're discussing
adding yet another intermediate representation that is nothing like what
we have now. Yuck.
Greetz
Steven