An Analysis of Graph Coloring Register Allocation

Abstract : Graph coloring is the de facto standard technique for register allocation within a compiler. In this paper we examine the importance of the quality of the coloring algorithm and various extensions of the basic graph coloring technique by replacing the coloring phase of the GNU compiler s register allocator with an optimal coloring algorithm. We then extend this optimal algorithm to incorporate various extensions such as coalescing and preferential register assignment. We find that using an optimal coloring algorithm has surprisingly little benefit and empirically demonstrate the benefit of the various extensions.

[1]  Matthew T. O'Keefe,et al.  Spill code minimization via interference region spilling , 1997, PLDI '97.

[2]  David Ryan Koes,et al.  A progressive register allocator for irregular architectures , 2005, International Symposium on Code Generation and Optimization.

[3]  Preston Briggs,et al.  Register allocation via graph coloring , 1992 .

[4]  Andrew W. Appel,et al.  Iterated register coalescing , 1996, POPL '96.

[5]  Gregory J. Chaitin,et al.  Register allocation & spilling via graph coloring , 1982, SIGPLAN '82.

[6]  Keith D. Cooper,et al.  Improvements to graph coloring register allocation , 1994, TOPL.

[7]  Timothy Kong,et al.  Precise register allocation for irregular architectures , 1998, Proceedings. 31st Annual ACM/IEEE International Symposium on Microarchitecture.

[8]  Keith D. Cooper,et al.  Live Range Splitting in a Graph Coloring Register Allocator , 1998, International Conference on Compiler Construction.

[9]  Mark Scott Johnson,et al.  Effectiveness of a machine-level, global optimizer , 1986, SIGPLAN '86.

[10]  Jens Palsberg,et al.  Compiling with code-size constraints , 2004, TECS.

[11]  Ron Y. Pinter,et al.  Spill code minimization techniques for optimizing compliers , 1989, PLDI '89.

[12]  Bernhard Scholz,et al.  Register allocation for irregular architectures , 2002, LCTES/SCOPES '02.

[13]  Andrew W. Appel Modern Compiler Implementation in Java: Basic Techniques , 1997 .

[14]  Jens Palsberg,et al.  Compiling with code-size constraints , 2002, LCTES/SCOPES '02.

[15]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[16]  Michael D. Smith,et al.  A generalized algorithm for graph-coloring register allocation , 2004, PLDI '04.

[17]  Andrew W. Appel,et al.  Optimal spilling for CISC machines with few registers , 2001, PLDI '01.

[18]  Bernhard Scholz,et al.  Graph Coloring vs. Optimal Register Allocation for Optimizing Compilers , 2003, JMLC.