skip to main content
10.1145/996841.996875acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article

A generalized algorithm for graph-coloring register allocation

Published:09 June 2004Publication History

ABSTRACT

Graph-coloring register allocation is an elegant and extremely popular optimization for modern machines. But as currently formulated, it does not handle two characteristics commonly found in commercial architectures. First, a single register name may appear in multiple register classes, where a class is a set of register names that are interchangeable in a particular role. Second, multiple register names may be aliases for a single hardware register. We present a generalization of graph-coloring register allocation that handles these problematic characteristics while preserving the elegance and practicality of traditional graph coloring. Our generalization adapts easily to a new target machine, requiring only the sets of names in the register classes and a map of the register aliases. It also drops easily into a well-known graph-coloring allocator, is efficient at compile time, and produces high-quality code.

References

  1. Andrew W. Appel and Lal George. 2001 (May). Optimal spilling for CISC machines with few registers. In 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 243--253. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andrew W. Appel and Jens Palsberg. 2002. Modern Compiler Implementation in Java. Cambridge University Press, 2nd edition. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Preston Briggs. 1992 (April). Register allocation via graph coloring. Technical Report TR92-183, Rice University, Department of Computer Science.Google ScholarGoogle Scholar
  4. Preston Briggs, Keith Cooper, and Linda Torczon. 1992 (March). Coloring register pairs. ACM Letters on Programming Languages and Systems, 1(1):3--13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Preston Briggs, Keith Cooper, and Linda Torczon. 1994 (May). Improvements to graph coloring register allocation. ACM Transactions on Programming Languages and Systems, 16(3): 428--455. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Gregory J. Chaitin. 1982. Register allocation and spilling via graph coloring. In 1982 SIGPLAN Symposium on Compiler Construction, pages 98--105. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Gregory J. Chaitin, Marc A. Auslander, Ashok K. Chandra, John Cocke, Martin E. Hopkins, and Peter W. Markstein. 1981. Register allocation via coloring. Computer Languages, 6(1):47--57.Google ScholarGoogle ScholarCross RefCross Ref
  8. Keith Cooper and Linda Torczon. 2003. Engineering a Compiler. Morgan Kaufmann.Google ScholarGoogle Scholar
  9. Changqing Fu and Kent D. Wilken. 2002 (November). A faster optimal register allocator. In 35th ACM/IEEE International Symposium on Microarchitecture, pages 245--256. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Lal George and Andrew W. Appel. 1996 (May). Iterated register coalescing. ACMTransactions on Programming Languages and Systems, 18(3):300--324. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. David W. Goodwin and Kent D. Wilken. 1996 (August). Optimal and near-optimal global register allocations using 0-1 integer programming. Software-Practice & Experience, 26(8):929--965. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Ulrich Hirnschrott, Andreas Krall, and Bernhard Scholz. 2003 (August). Graph coloring vs. optimal register allocation for optimizing compilers. In Joint Modular Languages Conference, volume 2789 of Lecture Notes in Computer Science, pages 202--213. Springer Press, Klagenfurt, Austria.Google ScholarGoogle Scholar
  13. Richard E. Kessler, Edward J. McLellan, and David A. Webb. 1998 (October). The Alpha 21264 microprocessor architecture. In International Conference on Computer Design, pages 90--95. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Timothy Kong and Kent D. Wilken. 1998 (December). Precise register allocation for irregular architectures. In 31st ACM/IEEE International Symposium on Microarchitecture, pages 297--307. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Akira Koseki, Hideaki Komatsu, and Toshio Nakatani. 2002 (June). Preference-directed graph coloring. In 2002 ACM SIG-PLAN Conference on Programming Language Design and Implementation, pages 33--44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Chunho Lee, Miodrag Potkonjak, and William H. Mangione-Smith. 1997 (December). MediaBench: a tool for evaluating and synthesizing multimedia and communications systems. In 30th ACM/IEEE International Symposium on Microarchitecture, pages 330--335. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Allen Leung and Lal George. 1998. A new MLRISC register allocator. Standard ML of New Jersey compiler implementation notes.Google ScholarGoogle Scholar
  18. Michael Matz. 2003 (May). Design and implementation of a graph coloring register allocator for GCC. In GCC Developers Summit, pages 151--170.Google ScholarGoogle Scholar
  19. Steven S. Muchnick. 1997. Advanced Compiler Design and Implementation. Morgan Kaufmann. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Brian R. Nickerson. 1990 (June). Graph coloring register allocation for processors with multi-register operands. In 1990 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 40--52. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Johan Runeson and Sven-Olof Nystrom. 2003 (September). Re-targetable graph-coloring register allocation for irregular archi-tectures. In Software and Compilers for Embedded Systems (SCOPES), volume 2826 of Lecture Notes in Computer Science, pages 240--254. Springer Press, Klagenfurt, Austria.Google ScholarGoogle Scholar
  22. Bernhard Scholz and Erik Eckstein. 2002 (June). Register allocation for irregular architectures. In Proceedings of the Joint Conference on Languages, Compilers and Tools for Embedded Systems, pages 139--148. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A generalized algorithm for graph-coloring register allocation

        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
          PLDI '04: Proceedings of the ACM SIGPLAN 2004 conference on Programming language design and implementation
          June 2004
          310 pages
          ISBN:1581138075
          DOI:10.1145/996841
          • cover image ACM SIGPLAN Notices
            ACM SIGPLAN Notices  Volume 39, Issue 6
            PLDI '04
            May 2004
            299 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/996893
            Issue’s Table of Contents

          Copyright © 2004 ACM

          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]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 9 June 2004

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • Article

          Acceptance Rates

          Overall Acceptance Rate406of2,067submissions,20%

          Upcoming Conference

          PLDI '24

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader