|Re Generating RTL code firstname.lastname@example.org (1989-01-05)|
|From:||email@example.com (Patrick PAROUBEK)|
|Keywords:||RTL, code generator, gcc|
|Date:||5 Jan 89 11:40:40 GMT|
|Organization:||Universite PARIS 6 - LITP - equipe CLIP|
>Is there any simple way of getting gcc to compile from hand-generated
>RTL code ?
>Dan Rice, Swarthmore College, Swarthmore PA 19081
>2. Has anybody tried to separate the code generation part of gcc from
>the parsing part. I ask this because I would like to write a Modula-2
>compiler with the same code generator.
>Piet van Oostrumm, Dept of Computer Science, Umiversity of Utrecht
To port the compiler for the CLIP language which we are now developing
in LITP, I extracted the code generator of gcc in order to connect
it to the front-end of the current CLIP compiler. The modified version
of gcc 1.18 can run now either with one or two passes. The intermediary
file generated during two-passes compilation contains RTL language in a
readable form. The modifications to perform on the compiler are limited
because almost all the I/O functions for RTL language already exist.
But I want to precise that the idea of having the gcc code generator
on a stand alone basis is not as good as it may seem at first view.
First of all, R.M. Stallman (the author of gcc), questioned about the
issue, said that he does not intend in the future to release the code
generator alone because, it would incite people to develope their own
copyrighted front-end, and that is contrary to the aims of the Free
Software Foundation. According to him, the amount of work required to
write a new front-end generating RTL code is equivalent to the one
required to modify directly the font-end of gcc. Furthermore the use
of an intermediary file would make the resulting product too slow to
This last point cancels, in my opinion, the first one, but I think
Mr Stallman is right if your intend is compiler writing. The reason is
that the gcc code generator is not in its actual form a stand-alone code
generator, as a consequence it is finely attuned to the gcc front-end and,
the RTL expressions it recognizes form only a subset of all the possible
expressions you can write. There is no need to implement all the
possible cases (and they are numerous when one is dealing with code
generation) when you can do with only a few of them and
thus use simple and straightforward algorithms (like linear search)
without loss of performances.
Although the RTL language is machine-independent, the code you write
with it, is machine-dependent (register numbers, offsets values etc.. )
and will still require some porting work.
The reason why I used the gcc code generator to port the CLIP compiler
from VAX to SUN3, is that the intermediary language of the CLIP compiler
(inspired from the pcc intermediary code) is easily translated into RTL
code, and the machine-dependency issue does not offer any real problem
due to the processors similarity.
Furthermore, CLIP being an experimental language I was ready to trade
compilation speed for ease of porting.
Universite Pierre et Marie Curie - LITP
tour 45-55, piece 205
4 place Jussieu
75252 PARIS CEDEX 05
phone : +33 1 43 36 25 25 ext.40-55, UUCP : ..!uunet!mcvax!inria!litp!pap
Return to the
Search the comp.compilers archives again.