From: | conway@mundook.cs.mu.OZ.AU (Thomas Charles CONWAY) |
Newsgroups: | comp.compilers |
Date: | 17 May 1997 00:05:21 -0400 |
Organization: | Comp Sci, University of Melbourne |
References: | 97-05-183 |
Keywords: | C, assembler |
Ray Dillinger <bear@sonic.net> writes:
>However, this will violate every "reasonable" assumption a maker of C
>compiers will have about programming style. It will mean a program is
>compiled into a *single routine* of C code, with Goto destinations
>that might be more than 64K bytes away -- and no templates, no library
>functions linked, no header files, etc etc....
>
>Will modern C systems handle this?
>[Probably not. Machine generated source code always seems to break
>compilers designed for code written by humans. -John]
The Melbourne University implementation of Mercury generates C code.
What we actually generate is C code that uses heaps of macros. We have
different definitions of these macros that allow us to make use of a
variety of different features of the underlying C compiler and OS. For
example, if we are using gcc, we make use of nonlocal- gotos and
machine registers.
In the worst case, we compile each basic block to a single function
which returns a continuation function pointer and use a driver-loop.
The resulting system is almost ANSI C - the only non-ansi assumption
is that there is an integer type and a pointer type between which we
can make lossless coersions (on most machines these are `int' and
`void *').
For more information, check out our website:
http://www.cs.mu.oz.au/mercury
Thomas
--
Thomas Conway conway@cs.mu.oz.au
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.