A Spill Code Minimization Technique—Application in the Metrowerks StarCore C Compiler
- 66 Downloads
Graph coloring algorithms have been shown to be an efficient and effective means of performing register allocation. The power of these algorithms lies in their strong coloring heuristics and their ability to abstract away disparate allocation problems such as data-flow constraints, conforming to calling conventions, and target machine restrictions. However, even optimal algorithms cannot color every graph, and often some live ranges must be spilled to memory to make room for others. In this paper, we present a new approach of reducing spill code, which can be used to complement virtually any register allocation algorithm, and provides a good support to implement cheaper spill methods like spilling to another register (from a different class) and rematerialization (reloading the register from a constant or expression). This algorithm was partially implemented into the Metrowerks StarCore C compiler where it has proven its efficiency in terms of both cycle count and code size.
Unable to display preview. Download preview PDF.
- 1.SC140 DSP Core Reference Manual, http://e-www.motorola.com/.les/dsp/doc/ref_manual/MNSC140CORE.pdf.Google Scholar
- 2.G. J. Chaitin, Register Allocation and Spilling via Graph Coloring. SIGPLAN Notices, Proc. ACM SIGPLAN 1982 Symposium on Compiler Construction, 17(6), pp. 98–105 (June 1982).Google Scholar
- 3.D. Bernstein, D. Q. Goldin, M. C. Golumbic, H. Krawczyk, Y. Mansour, I. Nahshon, and R. Y. Pinter, Spill Code Minimization Techniques for Optimizing Compilers. SIGPLAN Notices, Proc. ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation, 24(7), pp. 258–263 (July 1989).Google Scholar
- 4.P. E. Bergner, Spill Code Minimization Techniques for Graph Coloring Register Allocators. PhD thesis, University of Minnesota (1997).Google Scholar
- 5.D. Callahan, B. Koblenz, Register Allocation via Hierarchical Graph Coloring. Proc. ACM SIGPLAN 1991 Conference on Programming Language Design and Implementation, Toronto, Ontario, Canada (June 26–28, 1991).Google Scholar
- 6.C. Click and K. D. Cooper, Combining Analyses, Combining Optimizations. ACM Transactions on Programming Languages and Systems, 17(2):181–196 (1995).Google Scholar
- 7.S. Muchnick, Advanced Compiler Design and Implementation, Morgan Kauufmann Publishers (1997).Google Scholar
- 8.R. A. Huff, Lifetime-Sensitive Modulo Scheduling, SIGPLAN Conference on Programming Language Design and Implementation (1993).Google Scholar
- 9.J. Llosa, A. Gonzalez, E. Ayguade, and M. Valero, Swing Modulo Scheduling: A Lifetime Sensitive Approach, International Conference on Parallel Architectures and Compilation Techniques (October 1996).Google Scholar
- 10.F. W. Chow and J. L. Hennesy, The Priority-Based Coloring Approach to Register Allocation, ACM Trans. Program. Languages Syst., 12(4):501–536 (October 1990).Google Scholar