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.
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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.Google Scholar
- Standard Performance Evaluation Corporation. SPEC CPU2000 V1.3. http://www.spec.org/cpu2000/.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- Lal George and Andrew W. Appel. Iterated Register Coalescing. ACM Transactions on Programming Languages and Systems, 18(3):300--324, 1996. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- Sebastian Hack. Register Allocation for Programs in SSA Form. PhD thesis, Universität Karlsruhe, October 2007.Google Scholar
- 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. Google Scholar
Digital Library
- The libFirm Compiler. http://www.libfirm.org.Google Scholar
- 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. Google Scholar
Digital Library
- Dániel Marx. Graph Coloring with Local and Global Constraints. PhD thesis, Budapest University of Technology and Economics, 2004.Google Scholar
- Robert Morgan. Building an Optimizing Compiler. Digital Press, Newton, MA, USA, 1998. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- Jinpyo Park and Soo-Mook Moon. Optimistic Register Coalescing. ACM Transactions on Programming Languages and Systems, 26(4):735--765, 2004. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
Index Terms
Copy coalescing by graph recoloring
Recommendations
Copy coalescing by graph recoloring
PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and ImplementationRegister 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 ...
Optimistic register coalescing
Graph-coloring register allocators eliminate copies by coalescing the source and target nodes of a copy if they do not interfere in the interference graph. Coalescing, however, can be harmful to the colorability of the graph because it tends to yield a ...
Iterated register coalescing
An important function of any register allocator is to target registers so as to eliminate copy instructions. Graph-coloring register allocation is an elegant approach to this problem. If the source and destination of a move instruction do not interfere, ...









Comments