skip to main content
research-article

Resourceable, retargetable, modular instruction selection using a machine-independent, type-based tiling of low-level intermediate code

Published:26 January 2011Publication History
Skip Abstract Section

Abstract

We present a novel variation on the standard technique of selecting instructions by tiling an intermediate-code tree. Typical compilers use a different set of tiles for every target machine. By analyzing a formal model of machine-level computation, we have developed a single set of tiles that is machine-independent while retaining the expressive power of machine code. Using this tileset, we reduce the number of tilers required from one per machine to one per architectural family (e.g., register architecture or stack architecture). Because the tiler is the part of the instruction selector that is most difficult to reason about, our technique makes it possible to retarget an instruction selector with significantly less effort than standard techniques. Retargeting effort is further reduced by applying an earlier result which generates the machine-dependent implementation of our tileset automatically from a declarative description of instructions' semantics. Our design has the additional benefit of enabling modular reasoning about three aspects of code generation that are not typically separated: the semantics of the compiler's intermediate representation, the semantics of the target instruction set, and the techniques needed to generate good target code.

Skip Supplemental Material Section

Supplemental Material

52-mpeg-4.mp4

References

  1. Alfred V. Aho, Mahadevan Ganapathi, and Steven W. K. Tjiang. 1989 (October). Code generation using tree matching and dynamic programming. ACM Transactions on Programming Languages and Systems, 11 (4):491--516. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andrew W. Appel. 1998. Modern Compiler Implementation. Cambridge University Press, Cambridge, UK. Available in three editions: C, Java, and ML. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Manuel E. Benitez and Jack W. Davidson. 1988 (July). A portable global optimizer and linker. Proceedings of the ACM SIGPLAN '88 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 23(7):329--338. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Manuel E. Benitez and Jack W. Davidson. 1994 (March). The advantages of machine-dependent global optimization. In Programming Languages and System Architectures, LNCS volume 782, pages 105--124. Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Roderic G. G. Cattell. 1980 (April). Automatic derivation of code generators from machine descriptions. ACM Transactions on Programming Languages and Systems, 2(2):173--190. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Melvin E. Conway. 1958 (October). Proposal for an UNCOL. Communications of the ACM, 1(10):5--8. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jack W. Davidson and Christopher W. Fraser. 1984 (October). Code selection through object code optimization. ACM Transactions on Programming Languages and Systems, 6(4):505--526. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. João Dias and Norman Ramsey. 2006 (March). Converting intermediate code to assembly code using declarative machine descriptions. In 15th International Conference on Compiler Construction (CC 2006), LNCS volume 3923, pages 217--231. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. João Dias and Norman Ramsey. 2010 (January). Automatically generating back ends using declarative machine descriptions. In Proceedings of the 37th ACM Symposium on the Principles of Programming Languages, pages 403--416. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Christopher W. Fraser and David R. Hanson. 1995. A Retargetable C Compiler: Design and Implementation. Benjamin/Cummings. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Christopher W. Fraser, David R. Hanson, and Todd A. Proebsting. 1992 (September). Engineering a simple, efficient code-generator generator. ACM Letters on Programming Languages and Systems, 1(3):213--226. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Christopher W. Fraser, Robert R. Henry, and Todd A. Proebsting. 1992 (April). BURG---fast optimal instruction selection and tree parsing. SIGPLAN Notices, 27(4):68--76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Jean-Yves Girard. 1986. The System F of variable types, fifteen years later. Theoretical Computer Science, 45(2):159--192. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO '04: Proceedings of the International Symposium on Code Generation and Optimization, pages 75--86. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Tim Lindholm and Frank Yellin. 1999. Java Virtual Machine Specification. Addison-Wesley, second edition. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Robin Milner. 1978 (December). A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348--375.Google ScholarGoogle ScholarCross RefCross Ref
  17. Eduardo Pelegrí-Llopart and Susan L. Graham. 1988 (January). Optimal code generation for expression trees: An application of BURS theory. In Conference Record of the 15th Annual ACM Symposium on Principles of Programming Languages, pages 294--308. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Simon L. Peyton Jones, Norman Ramsey, and Fermin Reig. 1999 (September). C-: A portable assembly language that supports garbage collection. In International Conference on Principles and Practice of Declarative Programming, LNCS volume 1702, pages 1--28. Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Todd A. Proebsting. 1992 (June). Simple and efficient BURS table generation. Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 27 (7):331--340. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Norman Ramsey and Cristina Cifuentes. 2003 (March). A transformational approach to binary translation of delayed branches. ACM Transactions on Programming Languages and Systems, 25(2):210--224. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Norman Ramsey and Jack W. Davidson. 1998 (June). Machine descriptions to build tools for embedded systems. In ACM SIGPLAN Workshop on Languages, Compilers, and Tools for Embedded Systems (LCTES'98), LNCS volume 1474, pages 172--188. Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Norman Ramsey, Simon Peyton Jones, and Christian Lindig. 2005 (February). The C- language specification Version 2.0 (CVS revision 1.128). See http://www.cminusminus.org/code.html#spec.Google ScholarGoogle Scholar
  23. Norman Ramsey and Simon L. Peyton Jones. 2000 (May). A single intermediate language that supports multiple implementations of exceptions. Proceedings of the ACM SIGPLAN '00 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 35 (5):285--298. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Kevin Redwine and Norman Ramsey. 2004 (April). Widening integer arithmetic. In 13th International Conference on Compiler Construction (CC 2004), LNCS volume 2985, pages 232--249.Google ScholarGoogle ScholarCross RefCross Ref
  25. J. Strong, J. H.Wegstein, A. Tritter, J. Olsztyn, Owen R.Mock, and T. Steel. 1958. The problem of programming communication with changing machines: A proposed solution (Part 2). Communications of the ACM, 1 (9):9--16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Henry S. Warren. 2003. Hacker's Delight. Addison-Wesley. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Resourceable, retargetable, modular instruction selection using a machine-independent, type-based tiling of low-level intermediate code

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 46, Issue 1
        POPL '11
        January 2011
        624 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1925844
        Issue’s Table of Contents
        • cover image ACM Conferences
          POPL '11: Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
          January 2011
          652 pages
          ISBN:9781450304900
          DOI:10.1145/1926385

        Copyright © 2011 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 26 January 2011

        Check for updates

        Qualifiers

        • research-article
      • Article Metrics

        • Downloads (Last 12 months)6
        • Downloads (Last 6 weeks)1

        Other Metrics

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!