Advertisement

C--: A portable assembly language

  • Simon Peyton Jones
  • Thomas Nordin
  • Dino Oliva
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1467)

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.

Keywords

Garbage Collection Source Language Calling Convention Register Allocation Target Architecture 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    AW Appel. Compiling with continuations. Cambridge University Press, 1992.Google Scholar
  2. [2]
    H Baker. Cons should not cons its arguments, Part II: Cheney on the MTA. SIGPLAN Notices, 30(9): 17–20, Sept 1995.CrossRefGoogle Scholar
  3. [3]
    JF Bartlett. SCHEME to C: a portable Scheme-to-C compiler. Technical Report RR 89/1, DEC WRL, 1989.Google Scholar
  4. [4]
    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
  5. [5]
    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
  6. [6]
    ME Conway. Proposal for an UNCOL. Communications of the ACM, 1(10): 5–8, October 1958.zbMATHCrossRefGoogle Scholar
  7. [7]
    L George. MLRISC: Customizable and Reusable Code Generators. Technical report, Bell Laboratories, Murray Hill, 1997.Google Scholar
  8. [8]
    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
  9. [9]
    H McGilton J Gosling. The Java Language Environment: a White Paper. Technical report, Sun Microsystems, 1996.Google Scholar
  10. [10]
    R Jones. Tail recursion without space leaks. Journal of Functional Programming, 2(1): 73–80, Jan 1992.zbMATHCrossRefGoogle Scholar
  11. [11]
    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
  12. [12]
    SL Peyton Jones, T Nordin, and D Oliva. The C-manual. Technical report, Department of Computing Science, University of Glasgow, 1998.Google Scholar
  13. [13]
    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
  14. [14]
    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.CrossRefGoogle Scholar
  15. [15]
    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
  16. [16]
    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
  17. [17]
    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
  18. [18]
    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.CrossRefGoogle Scholar
  19. [19]
    M Pettersson. Simulating tail calls in C. Technical report, Department of Computer Science, Linkoping University, 1995.Google Scholar
  20. [20]
    GL Steele. Rabbit: a compiler for Scheme. Technical Report AI-TR-474, MIT Lab for Computer Science, 1978.Google Scholar
  21. [21]
    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.CrossRefGoogle Scholar
  22. [22]
    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

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Simon Peyton Jones
    • 1
  • Thomas Nordin
    • 2
  • Dino Oliva
    • 2
  1. 1.Department of Computing ScienceUniversity of GlasgowUK
  2. 2.Pacific Software Research CentreOregon Graduate InstituteUK

Personalised recommendations