Converting Intermediate Code to Assembly Code Using Declarative Machine Descriptions

  • João Dias
  • Norman Ramsey
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)


Writing an optimizing back end is expensive, in part because it requires mastery of both a target machine and a compiler’s internals. We separate these concerns by isolating target-machine knowledge in declarative machine descriptions. We then analyze these descriptions to automatically generate machine-specific components of the back end. In this work, we generate a recognizer; this component, which identifies register transfers that correspond to target-machine instructions, plays a key role in instruction selection in such compilers as vpo, gcc and Quick C. We present analyses and transformations that address the major challenge in generating a recognizer: accounting for compile-time abstractions not present in a machine description, including variables, pseudo-registers, stack slots, and labels.


  1. Benitez, M.E., Davidson, J.W.: The advantages of machine-dependent global optimization. In: Gutknecht, J. (ed.) Programming Languages and System Architectures. LNCS, vol. 782, pp. 105–124. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  2. Ceng, J., Hohenauer, M., Leupers, R., Ascheid, G., Meyr, H., Braun, G.: C Compiler Retargeting Based on Instruction Semantics Models. In: DATE 2005, March 2005, pp. 1150–1155 (2005)Google Scholar
  3. Chase, D.R.: An improvement to bottom-up tree pattern matching. In: POPL 1987, pp. 168–177 (1987)Google Scholar
  4. Davidson, J.W., Fraser, C.W.: Code selection through object code optimization. ACM TOPLAS 6(4), 505–526 (1984)CrossRefGoogle Scholar
  5. Eddy, J.: A continuation-passing operator tree for pattern matching. Senior Thesis, Division of Engineering and Applied Sciences, Harvard University (April 2002)Google Scholar
  6. Feigenbaum, L.D.: Automated translation: generating a code generator. Senior Thesis, Division of Engineering and Applied Sciences, Harvard University (April 2001)Google Scholar
  7. Fernández, M.F., Ramsey, N.: Automatic checking of instruction specifications. In: ICSE 1997, May 1997, pp. 326–336 (1997)Google Scholar
  8. Fraser, C.W., Hanson, D.R., Proebsting, T.A.: Engineering a simple, efficient code-generator generator. ACM LOPLAS 1(3), 213–226 (1992)CrossRefGoogle Scholar
  9. Fraser, C.W., Henry, R.R., Proebsting, T.A.: BURG—fast optimal instruction selection and tree parsing. SIGPLAN Notices 27(4), 68–76 (1992)CrossRefGoogle Scholar
  10. Steven Glanville, R., Graham, S.L.: A new method for compiler code generation. In: POPL 1978, January 1978, pp. 231–240 (1978)Google Scholar
  11. Hoffmann, C.M., O’Donnell, M.J.: Pattern matching in trees. JACM 29(1) (1982)Google Scholar
  12. Kane, G., Heinrich, J.: MIPS RISC Architectures. Prentice-Hall, Englewood Cliffs (1992)Google Scholar
  13. Lindig, C., Ramsey, N.: Declarative composition of stack frames. In: Duesterwald, E. (ed.) CC 2004. LNCS, vol. 2985, pp. 298–312. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  14. Proebsting, T.A.: Simple and efficient BURS table generation. PLDI 1992, SIGPLAN Notices 27(7), 331–340 (1992)CrossRefGoogle Scholar
  15. Ramsey, N., Davidson, J.W.: Machine descriptions to build tools for embedded systems. In: Müller, F., Bestavros, A. (eds.) LCTES 1998. LNCS, vol. 1474, pp. 172–188. Springer, Heidelberg (1998)Google Scholar
  16. Ramsey, N., Fernández, M.F.: Specifying representations of machine instructions. ACM TOPLAS 19(3), 492–524 (1997)CrossRefGoogle Scholar
  17. Scott, K., Ramsey, N.: When do match-compilation heuristics matter? Technical Report CS-2000-13, Department of Computer Science, University of Virginia (May 2000)Google Scholar
  18. Tröger, J.: Specification-Driven Dynamic Binary Translation. PhD thesis, Queensland University of Technology, Brisbane, Australia (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • João Dias
    • 1
  • Norman Ramsey
    • 1
  1. 1.Division of Engineering and Applied SciencesHarvard UniversityUSA

Personalised recommendations