Abstract
Graph coloring is the dominant paradigm for global register allocation [8, 7, 4]. Coloring allocators use an interference graph, I,to model conflicts that prevent two values from sharing a register. Nodes in I represent live ranges. An edge between two nodes indicates that they are simultaneously live and thus, cannot share a register. The allocator tries to construct a k-coloring of Z, for k equal to the number of registers on the target machine. If it succeeds, it maps the colors onto the machine registers to produce an allocation. Unfortunately, it may not discover a k-coloring. In that case, it spills some live ranges by saving their values to memory. Early coloring allocators spilled live ranges completely - at each definition and use. This approach often introduces more spill code than necessary. This paper presents a global approach that avoids some spill code by splitting the live range, breaking it into smaller pieces. We are not the first to study this problem. Bergner et al. describe a heuristic called interference region spilling that reduces the amount of code needed to spill a live range [1]. Briggs experimented with an aggressive form of live range splitting; he saw mixed results [3, see Chapter 6]. This paper presents a passive form of live range splitting that uses splitting as an alternative to spilling. The allocator funds regions where splitting breaks the interferences that cause a spill; it uses estimated costs to choose between splitting the live range and spilling it. We present experimental evidence that this technique is effective. We have seen reductions in the amount of dynamic spill overhead as high as 78% for non-trivial routines. Our technique can easily be coupled with Bergner's to create an allocator that makes a cost-based choice between splitting, interference region spilling, and spilling completely for each spilled live range.
This work was supported by DARPA through contract DABT63-95-C-0115 and by the Trilogy Development Group.
Chapter PDF
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Peter Bergner, Peter Dahl, David Engebretsen, and Matthew O'Keefe. Spill code minimization via interference region spilling. SIGPLAN Notices, 32(6):287–295, June 1997. Proceedings of the ACM SIGPLAN '97 Conference on Programming Language Design and Implementation.
David Bernstein, Dina Q. Goldin, Martin C. Golumbic, Hugo Krawczyk, Yishay Mansour, Itai Nahshon, and Ron Y. Pinter. Spill code minimization techniques for optimizing compilers. SIGPLAN Notices, 24(7):258–263, July 1989. Proceedings of the ACM SIGPLAN '89 Conference on Programming Language Design and Implementation.
Preston Briggs. Register Allocation via Graph Coloring. PhD thesis, Rice University, April 1992.
Preston Briggs, Keith D. Cooper, Ken Kennedy, and Linda Torczon. Coloring heuristics for register allocation. SIGPLAN Notices, 24(7):275–284, July 1989. Proceedings of the ACM SIGPLAN '89 Conference on Programming Language Design and Implementation.
Preston Briggs, Keith D. Cooper, and Linda Torczon. Rematerialization. SIGPLAN Notices, 27(7):311–321, July 1992. Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation.
Steve Carr. Memory-Hierarchy Management. PhD thesis, Rice University, Department of Computer Science, September 1992.
Gregory J. Chaitin. Register allocation and spilling via graph coloring. SIGPLAN Notices, 17(6):98–105, June 1982. Proceedings of the ACM SIGPLAN '82 Symposium on Compiler Construction.
Gregory J. Chaitin, Marc A. Auslander, Ashok K. Chandra, John Cocke, Martin E. Hopkins, and Peter W. Markstein. Register allocation via coloring. Computer Languages, 6(1):47–57, January 1981.
Fred C. Chow and John L. Hennessy. Register allocation by priority-based coloring. SIGPLAN Notices, 19(6):222–232, June 1984. Proceedings of the ACM SIGPLAN '84 Symposium on Compiler Constructions
Keith D. Cooper, Mary W. Hall, and Linda Torczon. An experiment with inline substitution. Software — Practice and Experience, 21(6):581–601, June 1991.
Keith D. Cooper, Timothy J. Harvey, and Linda Torczon. How to build an interference graph. Software-Practice and Experience (to appear), 1998. Available on the web at http://softlib.rice. edu/MSCP/publications. html.
Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. An efficient method of computing static single assignment form. In Conference Record of the Sixteenth Annual ACM Symposium on Principles of Programming Languages, pages 25–35, Austin, Texas, January 1989.
Janet Fabri. Automatic storage optimization. SIGPLAN Notices, 14(8):83–91, August 1979. Proceedings of the ACM SIGPLAN '79 Symposium on Compiler Construction.
Todd C. Mowry, Monica S. Lam, and Anoop Gupta. Design and evaluation of a compiler algorithm for prefetching. SIGPLAN Notices, 27(9):62–75, September 1992. In Proceedings of the Fifth International Conference on Architectural Support for Programming Languages and Operating Systems.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Cooper, K.D., Taylor Simpson, L. (1998). Live range splitting in a graph coloring register allocator. In: Koskimies, K. (eds) Compiler Construction. CC 1998. Lecture Notes in Computer Science, vol 1383. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0026430
Download citation
DOI: https://doi.org/10.1007/BFb0026430
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64304-3
Online ISBN: 978-3-540-69724-4
eBook Packages: Springer Book Archive