skip to main content
10.1145/1375657.1375663acmconferencesArticle/Chapter ViewAbstractPublication PagescpsweekConference Proceedingsconference-collections
research-article

Generalized instruction selection using SSA-graphs

Published:12 June 2008Publication History

ABSTRACT

Instruction selection is a well-studied compiler phase that translates the compiler's intermediate representation of programs to a sequence of target-dependent machine instructions optimizing for various compiler objectives (e.g. speed and space). Most existing instruction selection techniques are limited to the scope of a single statement or a basic block and cannot cope with irregular instruction sets that are frequently found in embedded systems.

We consider an optimal technique for instruction selection that uses Static Single Assignment (SSA) graphs as an intermediate representation of programs and employs the Partitioned Boolean Quadratic Problem (PBQP) for finding an optimal instruction selection. While existing approaches are limited to instruction patterns that can be expressed in a simple tree structure, we consider complex patterns producing multiple results at the same time including pre/post increment addressing modes, div-mod instructions, and SIMD extensions frequently found in embedded systems. Although both instruction selection on SSA-graphs and PBQP are known to be NP-complete, the problem can be solved efficiently - even for very large instances.

Our approach has been implemented in LLVM for an embedded ARMv5 architecture. Extensive experiments show speedups of up to 57% on typical DSP kernels and up to 10% on SPECINT 2000 and MiBench benchmarks. All of the test programs could be compiled within less than half a minute using a heuristic PBQP solver that solves 99.83% of all instances optimally.

References

  1. Warren P. Adams and Richard J. Forrester. A simple recipe for concise mixed 0-1 linearizations. Oper. Res. Lett., 33(1):55--61, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. V. Aho and S. C. Johnson. Optimal code generation for expression trees. J. ACM, 23(3):488--501, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. A. Balachandran, D. M. Dhamdhere, and S. Biswas. Efficient retargetable code generation using bottom-up tree pattern matching. Computer Languages, 15(3):127--140, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, October 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. João Dias and Norman Ramsey. Converting intermediate code to assembly code using declarative machine descriptions. In Alan Mycroft and Andreas Zeller, editors, CC, volume 3923 of Lecture Notes in Computer Science, pages 217--231. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Erik Eckstein. Code Optimization for Digital Signal Processors. PhD Thesis. TU Wien, November 2003.Google ScholarGoogle Scholar
  7. Erik Eckstein, Oliver König, and Bernhard Scholz. Code Instruction Selection Based on SSA-Graphs. In Andreas Krall, editor, SCOPES, volume 2826 of Lecture Notes in Computer Science, pages 49--65. Springer, 2003.Google ScholarGoogle Scholar
  8. M. Anton Ertl. Optimal Code Selection in DAGs. In Principles of Programming Languages (POPL '99), 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Anton Ertl, Kevin Casey, and David Gregg. Fast and flexible instruction selection with on-demand tree-parsing automata. In PLDI '06: Proceedings of the 2006 ACM SIGPLAN conference on Programming language design and implementation, pages 52--60, New York, NY, USA, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Robert W. Floyd. Algorithm 97: Shortest path. Commun. ACM, 5(6):345, 1962. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Fraser, R. Henry, and T. Proebsting. BURG - Fast Optimal Instruction Selection and Tree Parsing. ACM SIGPLAN Notices, 27(4):68--76, April 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Christopher W. Fraser, David R. Hanson, and Todd A. Proebsting. Engineering a simple, efficient code-generator generator. ACM Letters on Programming Languages and Systems, 1(3):213--226, September 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Michael P. Gerlek, Eric Stoltz, and Michael Wolfe. Beyond Induction Variables: Detecting and Classifying Sequences Using a Demand-Driven SSA Form. ACM Transactions on Programming Languages and Systems, 17(1):85--122, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Guo, T. Limberg, E. Matus, B. Mennenga, R. Klemm, and G. Fettweis. Code generation for STA architecture. In Proc. of the 12th European Conference on Parallel Computing (Euro-Par'06). Springer LNCS, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Lang Hames and Bernhard Scholz. Nearly optimal register allocation with PBQP. In David E. Lightfoot and Clemens A. Szyperski, editors, JMLC, volume 4228 of Lecture Notes in Computer Science, pages 346--361. Springer, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Hannes Jakschitsch. "Befehlsauswahl auf SSA-Graphen". Master's thesis, Fakultät für Informatik, Universität Karlsruhe (TH),Germany, 2004.Google ScholarGoogle Scholar
  17. SPEC2000 Website. http://www.spec.org.Google ScholarGoogle Scholar
  18. Chris Lattner and Vikram S. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In Code Generation and Optimization, CGO 2004, pages 75--88, Palo Alto, CA, March 2004. IEEE Computer Society. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Rainer Leupers and Steven Bashford. Graph-based code selection techniques for embedded processors. ACM Transactions on Design Automation of Electronic Systems., 5(4):794--814, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Stan Liao, Srinivas Devadas, Kurt Keutzer, and Steve Tjiang. Instruction selection using binate covering for code size optimization. In Proc. Int'l Conf. on Computer-Aided Design, pages 393--399, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. MiBench Website. http://www.eecs.umich.edu/mibench/.Google ScholarGoogle Scholar
  22. Albert Nymeyer and Joost-Pieter Katoen. Code generation based on formal BURS therory and heuristic search. Acta Inf., 34(8):597--635, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  23. Todd A. Proebsting. Least-Cost Instruction Selection in DAGs is NP-Complete. http://research.microsoft.com/~toddpro/papers/proof.htm, 1998.Google ScholarGoogle Scholar
  24. Stefan Schäfer and Bernhard Scholz. Optimal chain rule placement for instruction selection based on SSA graphs. In SCOPES '07: Proceedingsof the 10th international workshop on Software & compilers for embedded systems, pages 91--100, Nice, France, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Bernhard Scholz and Erik Eckstein. Register Allocation for Irregular Architectures. In LCTES-SCOPES '02: Proceedings of the Joint Conference on Languages, Compilers and Tools for Embedded Systems, pages 139--148, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Vojin živojnovi#263;, Juan M. Velarde, Christian Schläger, and Heinrich Meyr. DSPSTONE: A DSP-oriented benchmarking methodology. In Proceedings of the International Conference on Signal Processing and Technology (ICSPAT'94), 1994.Google ScholarGoogle Scholar

Index Terms

  1. Generalized instruction selection using SSA-graphs

    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
    • Published in

      cover image ACM Conferences
      LCTES '08: Proceedings of the 2008 ACM SIGPLAN-SIGBED conference on Languages, compilers, and tools for embedded systems
      June 2008
      180 pages
      ISBN:9781605581040
      DOI:10.1145/1375657
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 43, Issue 7
        LCTES '08
        July 2008
        167 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1379023
        Issue’s Table of Contents

      Copyright © 2008 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 12 June 2008

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate116of438submissions,26%

    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!