ABSTRACT
Graph coloring register allocation tries to minimize the total cost of spilled live ranges of variables. Live-range splitting and coalescing are often performed before the coloring to further reduce the total cost. Coalescing of split live ranges, called sub-ranges, can decrease the total cost by lowering the interference degrees of their common interference neighbors. However, it can also increase the total cost because the coalesced sub-ranges can become uncolorable. In this paper, we propose coloring-based coalescing, which first performs trial coloring and next coalesces all copyrelated sub-ranges that were assigned the same color. The coalesced graph is then colored again with the graph coloring register allocation. The rationale is that coalescing of differently colored sub-ranges could result in spilling because there are some interference neighbors that prevent them from being assigned the same color. Experiments on Java programs show that the combination of live-range splitting and coloring-based coalescing reduces the static spill cost by more than 6% on average, comparing to the baseline coloring without splitting. In contrast, well-known iterated and optimistic coalescing algorithms, when combined with splitting, increase the cost by more than 20%. Coloring-based coalescing improves the execution time by up to 15% and 3% on average, while the existing algorithms improve by up to 12% and 1% on average.
- Appel, A. W. and George, L. Optimal spilling for CISC machines with few registers. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, pages 243--253, June 2001. Google ScholarDigital Library
- Bernstein, D., Golumbic, M. C., Mansour, Y., Pinter, R. Y., Goldin, D. Q., Krawczyk, H., and Nahshon, I. Spill code minimization techniques for optimizing compliers, In Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation, pages 258--263, July 1989 Google ScholarDigital Library
- Bouchez, F., Darte, A., and Rastello, F. Advanced conservative and optimistic register coalescing. In Proceedings of the 2008 International Conference on Compilers, Architectures and Synthesis for Embedded Systems, pages 147--156, 2008. Google ScholarDigital Library
- Bouchez, F., Darte, A., and Rastello, F. On the complexity of register coalescing. In Proceedings of the International Symposium on Code Generation and Optimization 2007, pages 102--114, March 2007. Google ScholarDigital Library
- Briggs, P. Register Allocation via Graph Coloring. PhD thesis, Rice University, April 1992. Google ScholarDigital Library
- Briggs, P., Cooper, K. D., and Torczon, L. Improvements to graph coloring register allocation. ACM Transactions on Programming Languages and Systems, Vol. 16, No. 3, pages 428--455, May 1994. Google ScholarDigital Library
- Chaitin, G. J. Register allocation and spilling via graph coloring. In Proceedings of the ACM SIGPLAN 1982 Symposium on Compiler Construction, pages 201--207, SIGPLAN Notices Vol. 17, No. 6, pages 98--105, June 1982. Google ScholarDigital Library
- Chaitin, G. J., Auslander, M. A., Chandra, A. K., Cocke, J., Hopkins, M. E., and Markstein, P. W. Register allocation via coloring. Computer Languages, Vol. 6, No. 1, pages 47--57, January 1981.Google Scholar
- DaCapo Benchmarks, http://dacapobench.org/.Google Scholar
- George, L. and Appel, A. W. Iterated register coalescing. ACM Transactions on Programming Languages and Systems, Vol. 18, No. 3, pages 300--324, May 1996. Google ScholarDigital Library
- Grcevski, N., Kilstra, A., Stoodley, K., Stoodley, M., and Sundaresan, V. Java just-in-time compiler and virtual machine improvements for server and middleware applications. In Proceedings of the 3rd Virtual Machine Research and Technology Symposium, pages 151--162, May, 2004. Google ScholarDigital Library
- Hack, S. and Goos, G. Copy coalescing by graph recoloring. In Proceedings of the ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation, pages 227--237, June 2008. Google ScholarDigital Library
- Hack, S., Grund, D., and Goos, G. Register allocation for programs in SSA-form. In International Conference on Compiler Construction (CC'06), Vol. 3923 of LNCS, pages 247--262, Springer Verlag, 2006. Google ScholarDigital Library
- Hailperin, M. Comparing conservative coalescing criteria. ACM Transactions on Programming Languages and Systems, Vol. 27, No. 3, pages 571--582, May 2005. Google ScholarDigital Library
- IBM System z9. IBM Journal of Research and Development Vol. 51, Number 1/2, 2007.Google Scholar
- Kolte, P. and Harrold, M. J. Load/store range analysis for global register allocation. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, pages 268--277, June 1993. Google ScholarDigital Library
- Leung, A. and George, L. A new MLRISC register allocator. Standard ML of New Jersey compiler implementation notes, 1998.Google Scholar
- Nakaike, T., Inagaki, T., Komatsu, H., and Nakatani, T. Profile-based global live-range splitting. In Proceedings the ACM SIGPLAN 2006 Conference on Programming Language Design and Implementation, pages 216--227, June 2006. Google ScholarDigital Library
- Park, J. and Moon, S. Optimistic Register Coalescing. ACM Transactions on Programming Languages and Systems, Vol. 26, No. 4, pages 735--765, July 2004. Google ScholarDigital Library
- Vegdahl, S. R. Using node merging to enhance graph coloring. In Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation, pages 150--154, May 1999. Google ScholarDigital Library
- Standard Performance Evaluation Corporation. SPECjvm98 Benchmarks, http://www.spec.org/osg/jvm98/.Google Scholar
Index Terms
- Coloring-based coalescing for graph coloring register allocation
Recommendations
A generalized algorithm for graph-coloring register allocation
PLDI '04: Proceedings of the ACM SIGPLAN 2004 conference on Programming language design and implementationGraph-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 ...
Improvements to graph coloring register allocation
We describe two improvements to Chaitin-style graph coloring register allocators. The first, optimistic coloring, uses a stronger heuristic to find a k-coloring for the interference graph. The second extends Chaitin's treatment of rematerialization to ...
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