skip to main content
10.1145/1706299.1706346acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Automatically generating instruction selectors using declarative machine descriptions

Published: 17 January 2010 Publication History

Abstract

Despite years of work on retargetable compilers, creating a good, reliable back end for an optimizing compiler still entails a lot of hard work. Moreover, a critical component of the back end---the instruction selector---must be written by a person who is expert in both the compiler's intermediate code and the target machine's instruction set. By generating the instruction selector from declarative machine descriptions we have (a) made it unnecessary for one person to be both a compiler expert and a machine expert, and (b) made creating an optimizing back end easier than ever before.
Our achievement rests on two new results. First, finding a mapping from intermediate code to machine code is an undecidable problem. Second, using heuristic search, we can find mappings for machines of practical interest in at most a few minutes of CPU time.
Our most significant new idea is that heuristic search should be controlled by algebraic laws. Laws are used not only to show when a sequence of instructions implements part of an intermediate code, but also to limit the search: we drop a sequence of instructions not when it gets too long or when it computes too complicated a result, but when too much reasoning will be required to show that the result computed might be useful.

References

[1]
Alfred V. Aho, Mahadevan Ganapathi, and Steven W. K. Tjiang. 1989 (October). Code generation using tree matching and dynamic programming. phACM Transactions on Programming Languages and Systems, 11 (4): 491--516.
[2]
Joel Auslander, Matthai Philipose, Craig Chambers, Susan Eggers, and Brian Bershad. 1996 (May). Fast, effective dynamic compilation. phProceedings of the ACM SIGPLAN '96 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 31 (5): 149--159.
[3]
Mark W. Bailey and Jack W. Davidson. 2003 (November). Automatic detection and diagnosis of faults in generated code for procedure calls. phIEEE Transactions on Software Engineering, 29 (11): 1031--1042.
[4]
Manuel E. Benitez and Jack W. Davidson. 1994 (March). The advantages of machine-dependent global optimization. In phProgramming Languages and System Architectures, phLNCS volume 782, pages 105--124. Springer Verlag.
[5]
Mark Bezem, Jan Willem Klop, and Roel de Vrijer, editors. 2003. phTerm Rewriting Systems. Cambridge University Press, Cambridge, UK.
[6]
Roderic G. G. Cattell. 1980 (April). Automatic derivation of code generators from machine descriptions. phACM Transactions on Programming Languages and Systems, 2 (2): 173--190.
[7]
Jianjiang Ceng, Manuel Hohenauer, Rainer Leupers, Gerd Ascheid, Heinrich Meyr, and Gunnar Braun. 2005. C compiler retargeting based on instruction semantics models. In phDesign, Automation, and Test in Europe, pages 1150--1155. IEEE Computer Society.
[8]
Cristina Cifuentes, Mike Van Emmerik, and Norman Ramsey. 1999 (October). The design of a resourceable and retargetable binary translator. In Proceedings of the Sixth Working Conference on Reverse Engineering (WCRE'99), pages 280--291.
[9]
Christian S. Collberg. 1997 (May). Reverse interpretation + mutation analysis = automatic retargeting. Proceedings of the ACM SIGPLAN '97 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 32(5):57--70.
[10]
M. E. Conway. 1958 (October). Proposal for an UNCOL. Communications of the ACM, 1(10):5--8.
[11]
Jack W. Davidson. 2008. Personal communication, 14 November 2008.
[12]
Jack W. Davidson and Christopher W. Fraser. 1980 (April). The design and application of a retargetable peephole optimizer. ACM Transactions on Programming Languages and Systems, 2(2):191--202.
[13]
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.
[14]
João Dias. 2008 (December). Automatically Generating the Back End of a Compiler Using Declarative Machine Descriptions. PhD thesis, Harvard University, School of Engineering and Applied Sciences. As of July 2009, at http://tinyurl.com/lxhly5.
[15]
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.
[16]
Edsger W. Dijkstra. 1976. A Discipline of Programming. Prentice-Hall, Englewood Cliffs, NJ.
[17]
Helmut Emmelmann, Friedrich-Wilhelm Schröer, and Rudolf Landwehr. 1989 (July). BEG-a generator for efficient back ends. Proceedings of the ACM SIGPLAN '89 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 24(7):227--237.
[18]
Lee D. Feigenbaum. 2001 (April). Automated translation: generating a code generator. Technical Report TR-12-01, Computer Science, Harvard University.
[19]
Mary F. Fernández and Norman Ramsey. 1997 (May). Automatic checking of instruction specifications. In Proceedings of the International Conference on Software Engineering, pages 326--336.
[20]
Mary F. Fernández. 1995 (June). Simple and effective link-time optimization of Modula-3 programs. Proceedings of the ACM SIGPLAN '95 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 30(6):103--115.
[21]
Christopher W. Fraser. 1989 (July). A language for writing code generators. Proceedings of the ACM SIGPLAN '89 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 24(7):238--245.
[22]
Christopher W. Fraser and David R. Hanson. 1995. A Retargetable C Compiler: Design and Implementation. Benjamin/Cummings, Redwood City, CA.
[23]
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.
[24]
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.
[25]
Torbjoern Granlund and Richard Kenner. 1992. Eliminating branches using a superoptimizer and the GNU C compiler. Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 27(7):341--352.
[26]
Roger Hoover and Kenneth Zadeck. 1996. Generating machine specific optimizing compilers. In Conference Record of the 23rd Annual ACM Symposium on Principles of Programming Languages, pages 219--229.
[27]
Rajeev Joshi, Greg Nelson, and Yunhong Zhou. 2006. Denali: A practical algorithm for generating optimal code. ACM Transactions on Programming Languages and Systems, 28(6):967--989.
[28]
Xavier Leroy. 2006. Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In J. Gregory Morrisett and Simon L. Peyton Jones, editors, Conference Record of the 33rd Annual ACM Symposium on Principles of Programming Languages, pages 42--54.
[29]
Christian Lindig and Norman Ramsey. 2004 (April). Declarative composition of stack frames. In 13th International Conference on Compiler Construction (CC 2004), LNCS volume 2985, pages 298--312.
[30]
Henry Massalin. 1987 (October). Superoptimizer: A look at the smallest program. Proceedings of the 2nd International Conference on Architectural Support for Programming Languages and Operating System (ASPLOS II), in SIGPLAN Notices, 22(10):122--127.
[31]
Reuben Olinsky, Christian Lindig, and Norman Ramsey. 2006 (January). Staged allocation: A compositional technique for specifying and implementing procedure calling conventions. In Proceedings of the 33rd ACM Symposium on the Principles of Programming Languages, pages 409--421.
[32]
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.
[33]
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.
[34]
Norman Ramsey and Mary F. Fernández. 1995 (January). The New Jersey Machine-Code Toolkit. In Proceedings of the 1995 USENIX Technical Conference, pages 289--302.
[35]
Norman Ramsey and Mary F. Fernández. 1997 (May). Specifying representations of machine instructions. ACM Transactions on Programming Languages and Systems, 19(3):492--524.
[36]
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.
[37]
Michael D. Smith, Norman Ramsey, and Glenn Holloway. 2004 (June). A generalized algorithm for graph-coloring register allocation. ACM SIGPLAN '04 Conference on Programming Language Design and Implementation, in SIGPLAN Notices, 39(6):277--288.
[38]
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.
[39]
Henry S. Warren. 2003. Hacker's Delight. Addison-Wesley.

Cited By

View all
  • (2024)Application-level Validation of Accelerator Designs Using a Formal Software/Hardware InterfaceACM Transactions on Design Automation of Electronic Systems10.1145/363905129:2(1-25)Online publication date: 14-Feb-2024
  • (2024)Lightweight, Modular Verification for WebAssembly-to-Native Instruction SelectionProceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 110.1145/3617232.3624862(231-248)Online publication date: 27-Apr-2024
  • (2021)Rewrite rule inference using equality saturationProceedings of the ACM on Programming Languages10.1145/34854965:OOPSLA(1-28)Online publication date: 15-Oct-2021
  • Show More Cited By

Index Terms

  1. Automatically generating instruction selectors using declarative machine descriptions

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
      January 2010
      520 pages
      ISBN:9781605584799
      DOI:10.1145/1706299
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 45, Issue 1
        POPL '10
        January 2010
        500 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1707801
        Issue’s Table of Contents
      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Sponsors

      In-Cooperation

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 17 January 2010

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. declarative machine descriptions
      2. instruction selection
      3. retargetable compilers

      Qualifiers

      • Research-article

      Conference

      POPL '10
      Sponsor:

      Acceptance Rates

      Overall Acceptance Rate 860 of 4,328 submissions, 20%

      Upcoming Conference

      POPL '26

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)21
      • Downloads (Last 6 weeks)0
      Reflects downloads up to 07 Mar 2025

      Other Metrics

      Citations

      Cited By

      View all
      • (2024)Application-level Validation of Accelerator Designs Using a Formal Software/Hardware InterfaceACM Transactions on Design Automation of Electronic Systems10.1145/363905129:2(1-25)Online publication date: 14-Feb-2024
      • (2024)Lightweight, Modular Verification for WebAssembly-to-Native Instruction SelectionProceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 110.1145/3617232.3624862(231-248)Online publication date: 27-Apr-2024
      • (2021)Rewrite rule inference using equality saturationProceedings of the ACM on Programming Languages10.1145/34854965:OOPSLA(1-28)Online publication date: 15-Oct-2021
      • (2019)ISA semantics for ARMv8-a, RISC-v, and CHERI-MIPSProceedings of the ACM on Programming Languages10.1145/32903843:POPL(1-31)Online publication date: 2-Jan-2019
      • (2018)Synthesizing an instruction selection rule library from semantic specificationsProceedings of the 2018 International Symposium on Code Generation and Optimization10.1145/3168821(300-313)Online publication date: 24-Feb-2018
      • (2016)Modelling the ARMv8 architecture, operationally: concurrency and ISAACM SIGPLAN Notices10.1145/2914770.283761551:1(608-621)Online publication date: 11-Jan-2016
      • (2016)Modelling the ARMv8 architecture, operationally: concurrency and ISAProceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages10.1145/2837614.2837615(608-621)Online publication date: 11-Jan-2016
      • (2012)RockSaltACM SIGPLAN Notices10.1145/2345156.225411147:6(395-404)Online publication date: 11-Jun-2012
      • (2012)RockSaltProceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2254064.2254111(395-404)Online publication date: 11-Jun-2012
      • (2012)ACCGenProceedings of the 2012 IEEE 24th International Symposium on Computer Architecture and High Performance Computing10.1109/SBAC-PAD.2012.33(278-285)Online publication date: 24-Oct-2012
      • Show More Cited By

      View Options

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Figures

      Tables

      Media

      Share

      Share

      Share this Publication link

      Share on social media