C--: A portable assembly language
Of late it has become very common for research compilers to emit C as their target code, relying on a C compiler to generate machine code. In effect, C is being used as a portable compiler target language. It offers a simple and effective way of avoiding the need to re-implement effective register allocation, instruction selection, and instruction scheduling, and so on, all for a variety of target architectures. The trouble is that C was designed as a programming language not as a compiler target language, and is not very suitable for the latter purpose. The obvious thing to do is to define a language that is designed as a portable target language.
This paper describes C--, a portable compiler target language, or assembler. C-- has to strike a balance between being high-level enough to allow the back end a fair crack of the whip, while being low level enough to give the front end the control it needs. It is not clear that a path exists between these two rocks; the ghost of UNCOL lurks ominously in the shadows . Yet the increasing popularity of C as a compiler target language (despite its unsuitability) suggests strong demand, and provides an existence proof that something useful can be done.
KeywordsGarbage Collection Source Language Calling Convention Register Allocation Target Architecture
Unable to display preview. Download preview PDF.
- AW Appel. Compiling with continuations. Cambridge University Press, 1992.Google Scholar
- JF Bartlett. SCHEME to C: a portable Scheme-to-C compiler. Technical Report RR 89/1, DEC WRL, 1989.Google Scholar
- ME Benitez, P Chan, JW Davidson, AM Holler, S Meloy, and V Santhanam. ANDF: Finally an UNCOL after 30 years. Technical Report TR-91-05, University of Virginia, Department of Computer Science, Charlottesville, VA, March 1989.Google Scholar
- ME Benitez and JW Davidson. The advantages of machine-Dependent global optimization. In International Conference on Programming Languages and Architectures (PLSA '94), pages 105–123, 1994.Google Scholar
- L George. MLRISC: Customizable and Reusable Code Generators. Technical report, Bell Laboratories, Murray Hill, 1997.Google Scholar
- Fergus Henderson, Thomas Conway, and Zoltan Somogyi. Compiling logic programs to C using GNU C as a portable assembler. In Postconference Workshop on Sequential Implementation Technologies for Logic Programming (ILPS'95), pages 1–15, Portland, Or, 1995.Google Scholar
- H McGilton J Gosling. The Java Language Environment: a White Paper. Technical report, Sun Microsystems, 1996.Google Scholar
- Simon L. Peyton Jones. Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-machine. Journal of Functional Programming, 2(2): 127–202, April 1992.Google Scholar
- SL Peyton Jones, T Nordin, and D Oliva. The C-manual. Technical report, Department of Computing Science, University of Glasgow, 1998.Google Scholar
- SL Peyton Jones, N Ramsey, and JW Davidson. Portable support for garbage collection, debugging, and exceptions. Technical report, In preparation, Department of Computing Science, University of Glasgow, 1998.Google Scholar
- S Lucco, O Sharp, and R Wahbe. Omniware: a universal substrate for Web programming. In Fourth International World Wide Web Conference, Boston: The Web Revolution, Dec 1995.Google Scholar
- G Morrisett, K Crary, N Glew, and D Walker. Stack-based typed assembly language. In Proc Types in Compilation, Osaka, Japan, March 1998.Google Scholar
- G Morrisett, D Walker, K Crary, and N Glew. From system f to typed assembly language. In Proc 25th ACM Symposium on Principles of Programming Languages, San Diego, Jan 1998.Google Scholar
- M Pettersson. Simulating tail calls in C. Technical report, Department of Computer Science, Linkoping University, 1995.Google Scholar
- GL Steele. Rabbit: a compiler for Scheme. Technical Report AI-TR-474, MIT Lab for Computer Science, 1978.Google Scholar
- D Tarditi, G Morrisett, P Cheng, C Stone, R Harper, and P Lee. Til: A typedirected optimizing compiler for ml. In Proc SIGPLAN Symposium on Programming Language Design and Implementation (PLDI'96), Philadelphia. ACM, May 1996.Google Scholar