Abstract
We show that register allocation can be viewed as solving a collection of puzzles. We model the register file as a puzzle board and the program variables as puzzle pieces; pre-coloring and register aliasing fit in naturally. For architectures such as PowerPC, x86, and StrongARM, we can solve the puzzles in polynomial time, and we have augmented the puzzle solver with a simple heuristic for spilling. For SPEC CPU2000, the compilation time of our implementation is as fast as that of the extended version of linear scan used by LLVM, which is the JIT compiler in the openGL stack of Mac OS 10.5. Our implementation produces x86 code that is of similar quality to the code produced by the slower, state-of-the-art iterated register coalescing of George and Appel with the extensions proposed by Smith, Ramsey, and Holloway in 2004.
- Scott Ananian. The static single information form. Master's thesis, MIT, September 1999.]]Google Scholar
- Andrew W. Appel and Lal George. Optimal spilling for CISC machines with few registers. In PLDI, pages 243--253. ACM Press, 2001.]] Google Scholar
Digital Library
- L. Belady. A study of the replacement of algorithms of a virtual storage computer. IBM System Journal, 5:78--101, 1966.]]Google Scholar
Digital Library
- M Biró, M Hujter, and Zs Tuza. Precoloring extension. I:Iinterval graphs. In Discrete Mathematics, pages 267 -- 279. ACM Press, 1992.]] Google Scholar
Digital Library
- Rastislav Bodik, Rajiv Gupta, and Vivek Sarkar. ABCD: eliminating array bounds checks on demand. In PLDI, pages 321--333. ACM Press, 2000.]] Google Scholar
Digital Library
- Florent Bouchez. Allocation de registres et vidage en mémoire. Master's thesis, ENS Lyon, 2005.]]Google Scholar
- 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 LCPC, pages 283--298. Springer, 2006.]] 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. SPE, 28(8):859--881, 1998.]] Google Scholar
Digital Library
- Philip Brisk, Foad Dabiri, Jamie Macbeth, and Majid Sarrafzadeh. Polynomial-time graph coloring register allocation. In IWLS, pages 447--454. 2005.]]Google Scholar
- Philip Brisk and Majid Sarrafzadeh. Interference graphs for procedures in static single information form are interval graphs. In SCOPES, pages 101--110. ACM Press, 2007.]] Google Scholar
Digital Library
- Zoran Budimlic, Keith D. Cooper, Timothy J. Harvey, Ken Kennedy, Timothy S. Oberg, and Steven W. Reeves. Fast copy coalescing and live-range identification. In PLDI, pages 25--32. ACM Press, 2002.]] Google Scholar
Digital Library
- Gregory J. Chaitin, Mark A. Auslander, Ashok K. Chandra, John Cocke, Martin E. Hopkins, and Peter W. Markstein. Register allocation via coloring. Computer Languages, 6:47--57, 1981.]]Google Scholar
Digital Library
- Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. Efficiently computing static single assignment form and the control dependence graph. TOPLAS, 13(4):451--490, 1991.]] Google Scholar
Digital Library
- Alkis Evlogimenos. Improvements to linear scan register allocation. Technical report, University of Illinois, Urbana-Champaign, 2004.]]Google Scholar
- Martin Farach and Vincenzo Liberatore. On local register allocation. In SODA, pages 564--573. ACM Press, 1998.]] Google Scholar
Digital Library
- Fanica Gavril. The intersection graphs of subtrees of a tree are exactly the chordal graphs. Journal of Combinatorial Theory, Series B, 16(1):47 -- 56, 1974.]]Google Scholar
Cross Ref
- Lal George and Andrew W. Appel. Iterated register coalescing. TOPLAS, 18(3):300--324, 1996.]] Google Scholar
Digital Library
- Martin Charles Golumbic. Trivially perfect graphs. Discrete Mathematics, 24:105 -- 107, 1978.]]Google Scholar
- Daniel Grund and Sebastian Hack. A fast cutting-plane algorithm for optimal coalescing. In CC, volume 4420, pages 111--115. Springer, 2007.]] Google Scholar
Digital Library
- Sebastian Hack, Daniel Grund, and Gerhard Goos. Register allocation for programs in SSA-form. In CC, pages 247--262. Springer, 2006.]] Google Scholar
Digital Library
- Lang Hames and Bernhard Scholz. Nearly optimal register allocation with PBQP. In JMLC, pages 346--361. Springer, 2006.]] Google Scholar
Digital Library
- Corporate SPARC International Inc. The SPARC Architecture Manual, Version 8. Prentice Hall, 1st edition, 1992.]]Google Scholar
- Richard Johnson and Keshav Pingali. Dependence-based program analysis. In PLDI, pages 78--89. ACM Press, 1993.]] Google Scholar
Digital Library
- Richard M Karp. Reducibility among combinatorial problems. In Complexity of Computer Computations, pages 85--103. Plenum, 1972.]]Google Scholar
Cross Ref
- David Ryan Koes and Seth Copen Goldstein. A global progressive register allocator. In PLDI, pages 204--215. ACM Press, 2006.]] Google Scholar
Digital Library
- Chris Lattner and Vikram Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO, pages 75--88. IEEE, 2004.]] Google Scholar
Digital Library
- Jonathan K. Lee, Jens Palsberg, and Fernando M. Q. Pereira. Aliased register allocation for straight-line programs is NP-complete. In ICALP, pages 680--691. Springer, 2007.]] Google Scholar
Digital Library
- Daniel Marx. Precoloring extension on unit interval graphs. Discrete Applied Mathematics, 154(6):995 -- 1002, 2006.]]Google Scholar
Digital Library
- Clyde L. Monma and V. K. Wei. Intersection graphs of paths in a tree. Journal of Combinatorial Theory, Series B, 41(2):141 -- 181, 1986.]] Google Scholar
Digital Library
- Fernando Magno Quintao Pereira and Jens Palsberg. Register allocation via coloring of chordal graphs. In APLAS, pages 315--329. Springer, 2005.]] Google Scholar
Digital Library
- Fernando Magno Quintao Pereira and Jens Palsberg. Register allocation after classic SSA elimination is NP-complete. In FOSSACS, pages 79--93. Springer, 2006.]] Google Scholar
Digital Library
- Fernando Magno Quintao Pereira and Jens Palsberg. Register allocation by puzzle solving, 2008. http://compilers.cs.ucla.edu/ fernando/projects/puzzles/.]]Google Scholar
- Massimiliano Poletto and Vivek Sarkar. Linear scan register allocation. TOPLAS, 21(5):895--913, 1999.]] Google Scholar
Digital Library
- Vivek Sarkar and Rajkishore Barik. Extended linear scan: an alternate foundation for global register allocation. In CC, pages 141--155. Springer, 2007.]] Google Scholar
Digital Library
- Bernhard Scholz and Erik Eckstein. Register allocation for irregular architectures. SIGPLAN Notices, 37(7):139--148, 2002.]] Google Scholar
Digital Library
- Michael D. Smith, Norman Ramsey, and Glenn Holloway. A generalized algorithm for graph-coloring register allocation. In PLDI, pages 277--288. ACM Press, 2004.]] Google Scholar
Digital Library
- Vugranam C. Sreedhar, Roy Dz ching Ju, David M. Gillies, and Vatsa Santhanam. Translating out of static single assignment form. In SAS, pages 194--210. Springer, 1999.]] Google Scholar
Digital Library
- Omri Traub, Glenn H. Holloway, and Michael D. Smith. Quality and speed in linear-scan register allocation. In PLDI, pages 142--151. ACM Press, 1998.]] Google Scholar
Digital Library
- David L. Weaver and Tom Germond. The SPARC Architecture Manual, Version 9. Prentice Hall, 1st edition, 1994.]] Google Scholar
Digital Library
- Christian Wimmer and Hanspeter Mossenbock. Optimized interval splitting in a linear scan register allocator. In VEE, pages 132--141. ACM Press, 2005.]] Google Scholar
Digital Library
- Mihalis Yannakakis and Fanica Gavril. The maximum k-colorable subgraph problem for chordal graphs. Information Processing Letters, 24(2):133 -- 137, 1987.]] Google Scholar
Digital Library
Index Terms
Register allocation by puzzle solving
Recommendations
Register allocation by puzzle solving
PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and ImplementationWe show that register allocation can be viewed as solving a collection of puzzles. We model the register file as a puzzle board and the program variables as puzzle pieces; pre-coloring and register aliasing fit in naturally. For architectures such as ...
Bytewise Register Allocation
SCOPES '15: Proceedings of the 18th International Workshop on Software and Compilers for Embedded SystemsTraditionally, variables have been considered as atoms by register allocation: Each variable was to be placed in one register, or spilt (placed in main memory) or rematerialized (recalculated as needed). Some flexibility arose from what would be ...
Differential register allocation
PLDI '05: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementationMicro-architecture designers are very cautious about expanding the number of architected registers (also the register field), because increasing the register field adds to the code size, raises I-cache and memory pressure, complicates processor ...







Comments