Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

Copy coalescing by graph recoloring

Published: 07 June 2008 Publication History

Abstract

Register allocation is always a trade-off between live-range splitting and coalescing. Live-range splitting generally leads to less spilling at the cost of inserting shuffle code. Coalescing removes shuffle code while potentially raising the register demand and causing spilling.
Recent research showed that the live-range splitting of the SSA form's Æ-functions leads to chordal interference graphs. This improves upon two long-standing inconveniences of graph coloring register allocation: First, chordal graphs are optimally colorable in quadratic time. Second, the number of colors needed to color the graph is equal to the maximal register pressure in the program. However, the inserted shuffle code incurred by the Æ-functions can slow down the program severely. Hence, to make such an approach work in practice, a coalescing technique is needed that removes most of the shuffle code without causing further spilling.
In this paper, we present a coalescing technique designed for, but not limited to, SSA-form register allocation. We exploit that a valid coloring can be easily obtained by an SSA-based register allocator. This initial coloring is then improved by recoloring the interference graph and assigning shuffle-code related nodes the same color. Thereby, we always keep the coloring of the graph valid. Hence, the coalescing is safe, i. e. no spill code will be caused by coalescing.
Comparing to iterated register coalescing, the state of the art in safe coalescing, our method is able to remove 22.5% of the costs and 44.3% of the copies iterated coalescing left over. The best solution possible, found by a colaescer using integer linear programming (ILP), was 35.9% of the costs and 51.9% of the copies iterated coalescing left over. The runtime of programs compiled with our heuristic matches that of the programs compiled with the ILP technique.

References

[1]
Andrew W. Appel and Lal George. Optimal Spilling for CISC Machines with Few Registers. In ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, pages 243--253, June 2001.
[2]
Florent Bouchez, Alain Darte, Christophe Guillon, and Fabrice Rastello. Register Allocation: What does the NP-Completeness Proof of Chaitin et al. really prove? or revisiting Register Allocation: Why and How? In 19th International Workshop on Languages and Compilers for Parallel Computing (LCPC'06), New Orleans, USA, Nov 2006.
[3]
Florent Bouchez, Alain Darte, and Fabrice Rastello. On the Complexity of Register Coalescing. In International Symposium on Code Generation and Optimization (CGO'07), San Jose, USA, March 2007. IEEE Computer Society Press.
[4]
Preston Briggs, Keith D. Cooper, and Linda Torczon. Improvements to Graph Coloring Register Allocation. ACM Transactions on Programming Languages and Systems, 16(3):428--455, 1994.
[5]
Preston Briggs, Keith D.Cooper, Timothy J. Harvey, and L. Taylor Simpson. Practical Improvements to the Construction and Destruction of Static Single Assignment Form. Software: Practice and Experience, 28(8):859--881, July 1998.
[6]
Philip Brisk, Foad Dabiri, Roozbeh Jafari, and Majid Sarrafzadeh. Optimal Register Sharing for High-Level Synthesis of SSA Form Programs. IEEE Trans. on CAD of Integrated Circuits and Systems, 25(5):772--779, 2006.
[7]
G. J. Chaitin, M. A. Auslander, A. K. Chandra, J. Cocke, M. E. Hopkins, and P. W. Markstein. Register allocation via graph coloring. Journal of Computer Languages, 6:45--57, 1981.
[8]
Standard Performance Evaluation Corporation. SPEC CPU2000 V1.3. http://www.spec.org/cpu2000/.
[9]
R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadek. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, October 1991.
[10]
Janet Fabri. Automatic Storage Optimization. In SIGPLAN '79: Proceedings of the 1979 SIGPLAN Symposium on Compiler Construction, pages 83--91, New York, NY, USA, 1979. ACM Press.
[11]
Lal George and Andrew W. Appel. Iterated Register Coalescing. ACM Transactions on Programming Languages and Systems, 18(3):300--324, 1996.
[12]
Daniel Grund and Sebastian Hack. A Fast Cutting-Plane Algorithm for Optimal Coalescing. In Shriram Krishnamurthi and Martin Odersky, editors, Compiler Construction, volume 4420 of Lecture Notes In Computer Science, pages 111--115, March 2007.
[13]
Sebastian Hack. Register Allocation for Programs in SSA Form. PhD thesis, Universität Karlsruhe, October 2007.
[14]
Sebastian Hack, Daniel Grund, and Gerhard Goos. Register Allocation for Programs in SSA Form. In Andreas Zeller and Alan Mycroft, editors, Compiler Construction, volume 3923, pages 247--262. Springer, March 2006.
[15]
The libFirm Compiler. http://www.libfirm.org.
[16]
Guei-Yuan Lueh, Thomas Gross, and Ali-Reza Adl-Tabatabai. Fusion-based Register Allocation. ACM Transactions on Programming Languages and Systems, 22(3):431--470, 2000.
[17]
Dániel Marx. Graph Coloring with Local and Global Constraints. PhD thesis, Budapest University of Technology and Economics, 2004.
[18]
Robert Morgan. Building an Optimizing Compiler. Digital Press, Newton, MA, USA, 1998.
[19]
Takuya Nakaike, Tatsushi Inagaki, Hideaki Komatsu, and Toshio Nakatani. Profile-based Global Live-Range Splitting. In PLDI '06: Proceedings of the 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 216--227, New York, NY, USA, 2006. ACM.
[20]
Michael Paleczny, Christopher Vick, and Cliff Click. The Java HotSpot? Server Compiler. In Proceedings of the Java Virtual Machine Research and Technology Symposium (JVM '01), April 2001.
[21]
Jinpyo Park and Soo-Mook Moon. Optimistic Register Coalescing. ACM Transactions on Programming Languages and Systems, 26(4):735--765, 2004.
[22]
Fernando Magno Quintão Pereira and Jens Palsberg. Register allocation via coloring of chordal graphs. In Proceedings of APLAS'05, volume 3780 of Lecture Notes In Computer Science, pages 315--329. Springer, November 2005.
[23]
Tim A. Wagner, Vance Maverick, Susan L. Graham, and Michael A. Harrison. Accurate Static Estimators for Program Optimization. In PLDI '94: Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, pages 85--96, New York, NY, USA, 1994. ACM.

Cited By

View all
  • (2015)Optimal Shuffle Code with Permutation InstructionsAlgorithms and Data Structures10.1007/978-3-319-21840-3_44(528-541)Online publication date: 28-Jul-2015
  • (2013)Hardware acceleration for programs in SSA formProceedings of the 2013 International Conference on Compilers, Architectures and Synthesis for Embedded Systems10.5555/2555729.2555743(1-10)Online publication date: 29-Sep-2013
  • (2013)Hardware acceleration for programs in SSA form2013 International Conference on Compilers, Architecture and Synthesis for Embedded Systems (CASES)10.1109/CASES.2013.6662518(1-10)Online publication date: Sep-2013
  • Show More Cited By

Recommendations

Reviews

Charles Robert Morgan

This paper is a continuation of a recent revolution in graph coloring register allocation based on the work of Chaitin and others. Chaitin's technique has two drawbacks: repeated building of an expensive data structure called the interference graph and determining which data to keep in registers when insufficient registers are available. Hack and a number of other authors determined that programs represented in static single assignment form can be colored without building the interference graph, since the interference graph is a chordal graph. Unfortunately, there is a drawback: the coloring may produce a number of register-to-register move instructions. This often occurs when two operands of an instruction must be in the same register or an operand must be in a fixed physical register. Removing these move instructions is called copy coalescing. This paper provides a more advanced algorithm for copy coalescing than was provided in Hack's thesis. It uses the move instructions to partition the set of symbolic registers. Ideally, all elements of each partition should be in the same physical register; of course, this is not always possible. It applies a recursive algorithm to adjust the color of each symbolic register. The algorithm has a number of limits built in, to avoid excessive computation. This is a promising algorithm. It was tested against the integer subset of the CPU2000 SPEC benchmark. Other programs, particularly floating-point intensive programs and machine-generated programs, have much larger basic blocks and heavier register usage. We need to see results indicating that the algorithms can realistically handle tens of thousands of symbolic registers and huge functions. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 43, Issue 6
PLDI '08
June 2008
382 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/1379022
Issue’s Table of Contents
  • cover image ACM Conferences
    PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation
    June 2008
    396 pages
    ISBN:9781595938602
    DOI:10.1145/1375581
    • General Chair:
    • Rajiv Gupta,
    • Program Chair:
    • Saman Amarasinghe
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: 07 June 2008
Published in SIGPLAN Volume 43, Issue 6

Check for updates

Author Tags

  1. graph coloring
  2. register allocation
  3. ssa form

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)46
  • Downloads (Last 6 weeks)7
Reflects downloads up to 13 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2015)Optimal Shuffle Code with Permutation InstructionsAlgorithms and Data Structures10.1007/978-3-319-21840-3_44(528-541)Online publication date: 28-Jul-2015
  • (2013)Hardware acceleration for programs in SSA formProceedings of the 2013 International Conference on Compilers, Architectures and Synthesis for Embedded Systems10.5555/2555729.2555743(1-10)Online publication date: 29-Sep-2013
  • (2013)Hardware acceleration for programs in SSA form2013 International Conference on Compilers, Architecture and Synthesis for Embedded Systems (CASES)10.1109/CASES.2013.6662518(1-10)Online publication date: Sep-2013
  • (2010)On minimizing register usage of linearly scheduled algorithms with uniform dependenciesComputer Languages, Systems and Structures10.1016/j.cl.2009.12.00136:3(250-267)Online publication date: 1-Oct-2010
  • (2009)Combinatorial optimization in system configuration designAutomation and Remote Control10.1134/S000511790903018770:3(519-561)Online publication date: 1-Mar-2009
  • (2019)IGC: the open source Intel graphics compilerProceedings of the 2019 IEEE/ACM International Symposium on Code Generation and Optimization10.5555/3314872.3314902(254-265)Online publication date: 16-Feb-2019
  • (2019)IGC: The Open Source Intel Graphics Compiler2019 IEEE/ACM International Symposium on Code Generation and Optimization (CGO)10.1109/CGO.2019.8661189(254-265)Online publication date: Feb-2019
  • (2016)OrionProceedings of the 17th International Middleware Conference10.1145/2988336.2988355(1-13)Online publication date: 28-Nov-2016
  • (2013)A decoupled non-SSA global register allocation using bipartite liveness graphsACM Transactions on Architecture and Code Optimization10.1145/254410110:4(1-24)Online publication date: 1-Dec-2013
  • (2013)Elimination of parallel copies using code motion on data dependence graphsComputer Languages, Systems and Structures10.1016/j.cl.2012.09.00139:1(25-47)Online publication date: 1-Apr-2013
  • 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

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media