[comp.lang.c] Register Transfer Language

ADLER1%BRANDEIS.BITNET@WISCVM.WISC.EDU (08/11/87)

I have been reading the files internals-1,internals-2,internals-3 and
internals-4 which accompany the GNU C Compiler in the hope that they
will make it easier for me to make sense out of the code. In the file
internals-2 , there is some discussion of RTL  which stands not for
Run Time Library but for Register Transfer Language.

Now let me try to say what I imagine is true before asking my question.
I'm new at this, so maybe the following is complete nonsense:
Apparently, the compiler works by translating (or compiling ?) C code
into the intermediate language RTL (which is contained in the compiler
source code) and then compiles (?) the resulting RTL
code. RTL is close enough to a general purpose machine language that
one achieves portability merely by giving RTL a file containing a
machine description to pin down specifics. The description of the
features of RTL in internals-2 is nice to read, but I can't help feeling
that since RTL is a general language and since it plays such a key role
in the GNU C Compiler, that it might be instructive to invest some time
in studying RTL in its own right.

My question is this: how can one isolate the language RTL from the GNU
C Compiler so that one can write and run programs in it?

Your comments and criticisms are welcome.

Sincerely,

Allan Adler
ADLER1@BRANDEIS.BITNET

dg@wrs.UUCP (08/12/87)

In article <8740@brl-adm.ARPA> ADLER1%BRANDEIS.BITNET@WISCVM.WISC.EDU writes:
> .....
>
>Apparently, the compiler works by translating (or compiling ?) C code
>into the intermediate language RTL (which is contained in the compiler
>source code) and then compiles (?) the resulting RTL
>code. RTL is close enough to a general purpose machine language that
>one achieves portability merely by giving RTL a file containing a
>machine description to pin down specifics. The description of the
>features of RTL in internals-2 is nice to read, but I can't help feeling
>that since RTL is a general language and since it plays such a key role
>in the GNU C Compiler, that it might be instructive to invest some time
>in studying RTL in its own right.
>
>My question is this: how can one isolate the language RTL from the GNU
>C Compiler so that one can write and run programs in it?

I don't know the workings of the GNU C compiler, but it may be the case
that the RTL file is produced and saved albeit as a temporary file.
If the passes are available as separate programs (e.g. like cpp / ccom / c2
with BSD UNIX) then it may be possible to isolate the bits you are after
in this manner. While on this subject, several other languages have taken
a similar approach, notably UCSD Pascal with it's P codes, and BCPL with
O code files. In this instance BCPL is probably more appropriate, as the
idea was to write ONE ONLY compiler that went from BCPL source to O codes,
then for each machine write an O code compiler to produce native executables.
Porting then was trivial: generate the O codes for the front end (BCPL -> O
code) on a working implementation, send them over to the new machine,
run them through the back end, and you have your working compiler, at a
VERY minimal cost. This is an subset of the N machines / M languages
problem, but since porting BCPL is so easy (and it is - it took a team
of three of us about a month to write the O code to executable program
for an apple w/ a 6502, hence we had BCPL running on an apple in a month)
it demonstrates the advantages of working with a RTL type of setup.
Alternatively, as has been mentioned, if you produce hardware that directly
executes Pascal P codes (I've seen it done with AMD 2900 bit slices) or
BCPL O codes, you can get an implementation of the language that goes
faster than the new transwarp ships in Star Trek - the bit slice P code
machine I saw was faster than current 12MHz 68020 technology, and that
was just a 16 bit setup running at a leisurly 2 MHz.
Hopefully this provides some insight into some of the advantages of
separating RTL out, if you can do it you will be doing the world a favour!!
--
		dg@wrs.UUCP - David Goodenough

					+---+
					| +-+-+
					+-+-+ |
					  +---+

ADLER1%BRANDEIS.BITNET@wiscvm.wisc.EDU (08/20/87)

This is my second try at posting the following question.


I have been reading the info file "internals" (made from the file
internals.texinfo which accompanies the GNU C Compiler) in the hope that it
will make it easier for me to make sense out of the code. In it,
there is some discussion of RTL  which stands not for
Run Time Library but for Register Transfer Language.

Now let me try to say what I imagine is true before asking my question.
I'm new at this, so maybe the following is complete nonsense:
Apparently, the compiler works by translating (or compiling ?) C code
into the intermediate language RTL (which is contained in the compiler
source code) and then compiles (?) the resulting RTL
code. RTL is close enough to a general purpose machine language that
one implements it on a given machine by providing a file containing a
machine description to pin down specifics. The description of the
features of RTL in the info file is nice to read, but I can't help feeling
that since RTL is a general language and since it plays such a key role
in the GNU C Compiler, that it might be instructive to invest some time
in studying RTL in its own right.

My question is this: how can one isolate the language RTL from the GNU
C Compiler so that one can write and run programs in it?

Your comments and criticisms are welcome.

Sincerely,

Allan Adler
ADLER1@BRABRAB sl sl ks

molly@killer.uucp (Molly Fredericks) (08/20/87)

In article <8740@brl-adm.ARPA>, ADLER1%BRANDEIS.BITNET@WISCVM.WISC.EDU writes:
[ Line eater at work ... chomp ... chomp ... chomp ... ]

> Apparently, the compiler works by translating (or compiling ?) C code
> into the intermediate language RTL (which is contained in the compiler
> source code) and then compiles (?) the resulting RTL
> code. RTL is close enough to a general purpose machine language that
> one achieves portability merely by giving RTL a file containing a
> machine description to pin down specifics.
>
> My question is this: how can one isolate the language RTL from the GNU
> C Compiler so that one can write and run programs in it?
> 

My question is a bit more basic.  I have a compiler that I've been working
on but never get finished and I wind up working on machines with the
weirdest assemblers - I just want to invent my own assembly language,
write and assembler and generate code for that and emulate the results.

Sounds an awful like the UCSD-P System don't it?  Well, not all my ideas
are original :-)

This is what I am looking for:
	Emulator for a reasonable machine, stack, one or two address
	machines would be nice, three address is too weird.
	Assembler to assemble the code my compiler produces.
	Linker to (you guessed it ...) link the modules.

In short, an entire Programmers Tool Box for a non-existent machine ...

So, where do I find it?

Molly
-- 
       Molly Fredericks       UUCP: { any place real }!ihnp4!killer!molly
    Disclaimer:  Neither me, nor my cat, had anything to do with any of this
  "I love giving my cat a bath, except for all those hairs I get on my tongue"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~