Re: Compiling to C (where C is used as misspelled assembly)

fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
16 May 1997 00:49:59 -0400

          From comp.compilers

Related articles
Compiling to C (where C is used as misspelled assembly) bear@sonic.net (Ray Dillinger) (1997-05-14)
Re: Compiling to C (where C is used as misspelled assembly) fabre@gr.osf.org (Christian Fabre) (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) fjh@mundook.cs.mu.OZ.AU (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) chase@world.std.com (David Chase) (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) darius@phidani.be (Darius Blasband) (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) hbaker@netcom.com (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) ramb@spring.epic.com (Ram Bhamidipaty) (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) dwight@pentasoft.com (Dwight VandenBerghe) (1997-05-16)
Re: Compiling to C (where C is used as misspelled assembly) conway@mundook.cs.mu.OZ.AU (1997-05-17)
[9 later articles]
| List of all articles for this month |

From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.lang.scheme,comp.compilers
Date: 16 May 1997 00:49:59 -0400
Organization: Comp Sci, University of Melbourne
References: 97-05-183
Keywords: C, assembler

Ray Dillinger <bear@sonic.net> writes:


>I've been looking for a good target language for compilation;
>something way close to machine code, with all the subroutine calls
>abstracted out to explicit stack handling, forward goto's, and
>conditional goto's, all the variables abstracted out to heavily-reused
>registers and symbol-table refs, etc.


See


              "Compiling logic programs to C using GNU C as a portable assembler",
              Fergus Henderson, Zoltan Somogyi and Thomas Conway.
              Proceedings of the ILPS '95 Postconference Workshop on Sequential
              Implementation Technologies for Logic Programming Languages.
              Portland, Oregon, December 1995.
              Available via <http://www.cs.mu.oz.au/mercury/papers.html>.


This paper discusses the merits of using C, and in particular GNU C,
as exactly this sort of low-level target language. We've used this
approach in the Mercury compiler, and although it is not without its
drawbacks, in the end the results have been quite successful.


>Will modern C systems handle this?
>[Probably not. Machine generated source code always seems to break
>compilers designed for code written by humans. -John]


Although we have encountered a few bugs in various versions of gcc
that caused gcc to abort with internal errors, they have generally
been easy to avoid -- typically all you need to do is to compile the
offending file at a lower optimization level. We've carefully tested
more than a million lines of generated C code on four architectures
(and ported to several more architectures), and as far as I can recall
we've only encountered one gcc bug that required us to change the way
we generate code.
--
Fergus Henderson <fjh@cs.mu.oz.au>
WWW: <http://www.cs.mu.oz.au/~fjh>
PGP: finger fjh@128.250.37.3
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.