Abstract
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 [6]. 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.
This is a preview of subscription content, log in via an institution.
Preview
Unable to display preview. Download preview PDF.
References
AW Appel. Compiling with continuations. Cambridge University Press, 1992.
H Baker. Cons should not cons its arguments, Part II: Cheney on the MTA. SIGPLAN Notices, 30(9): 17–20, Sept 1995.
JF Bartlett. SCHEME to C: a portable Scheme-to-C compiler. Technical Report RR 89/1, DEC WRL, 1989.
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.
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.
ME Conway. Proposal for an UNCOL. Communications of the ACM, 1(10): 5–8, October 1958.
L George. MLRISC: Customizable and Reusable Code Generators. Technical report, Bell Laboratories, Murray Hill, 1997.
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.
H McGilton J Gosling. The Java Language Environment: a White Paper. Technical report, Sun Microsystems, 1996.
R Jones. Tail recursion without space leaks. Journal of Functional Programming, 2(1): 73–80, Jan 1992.
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.
SL Peyton Jones, T Nordin, and D Oliva. The C-manual. Technical report, Department of Computing Science, University of Glasgow, 1998.
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.
Brian T. Lewis, L. Peter Deutsch, and Theodore C. Goldstein. Clarity MCode: A retargetable intermediate representation for compilation. ACM SIGPLAN Notices, 30(3): 119–128, March 1995.
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.
G Morrisett, K Crary, N Glew, and D Walker. Stack-based typed assembly language. In Proc Types in Compilation, Osaka, Japan, March 1998.
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.
Kevin O'Brien, Kathryn M. O'Brien, Martin Hopkins, Arvin Shepherd, and Ron Unrau. XIL and YIL: The intermediate languages of TOBEY. ACM SIGPLAN Notices, 30(3): 71–82, March 1995.
M Pettersson. Simulating tail calls in C. Technical report, Department of Computer Science, Linkoping University, 1995.
GL Steele. Rabbit: a compiler for Scheme. Technical Report AI-TR-474, MIT Lab for Computer Science, 1978.
D Tarditi, A Acharya, and P Lee. No assembly required: compiling Standard ML to C. ACM Letters on Programming Languages and Systems, 1(2): 161–177, 1992.
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.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Jones, S.P., Nordin, T., Oliva, D. (1998). C--: A portable assembly language. In: Clack, C., Hammond, K., Davie, T. (eds) Implementation of Functional Languages. IFL 1997. Lecture Notes in Computer Science, vol 1467. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0055421
Download citation
DOI: https://doi.org/10.1007/BFb0055421
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64849-9
Online ISBN: 978-3-540-68528-9
eBook Packages: Springer Book Archive