10.1145/1772954.1772979acmconferencesArticle/Chapter ViewAbstractPublication PagescgoConference Proceedings
research-article

Linear scan register allocation on SSA form

ABSTRACT

The linear scan algorithm for register allocation provides a good register assignment with a low compilation overhead and is thus frequently used for just-in-time compilers. Although most of these compilers use static single assignment (SSA) form, the algorithm has not yet been applied on SSA form, i.e., SSA form is usually deconstructed before register allocation. However, the structural properties of SSA form can be used to simplify the algorithm.

With only one definition per variable, lifetime intervals (the main data structure) can be constructed without data flow analysis. During allocation, some tests of interval intersection can be skipped because SSA form guarantees non-intersection. Finally, deconstruction of SSA form after register allocation can be integrated into the resolution phase of the register allocator without much additional code.

We modified the linear scan register allocator of the Java HotSpot client compiler so that it operates on SSA form. The evaluation shows that our simpler and faster version generates equally good or slightly better machine code.

References

  1. B. Alpern, C. R. Attanasio, J. J. Barton, M. G. Burke, P.Cheng, J.-D. Choi, A. Cocchi, S. J. Fink, D. Grove, M. Hind, S. F. Hummel, D. Lieber, V. Litvinov, M. F. Mergen, T. Ngo, J. R. Russell, V. Sarkar, M. J. Serrano, J. C. Shepherd, S. E. Smith, V. C. Sreedhar, H. Srinivasan, and J. Whaley. The Jalapeno virtual machine. IBM Systems Journal, 39(1):211--238, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. S. M. Blackburn, R. Garner, C. Hoffman, A. M. Khan, K. S. McKinley, R. Bentzur, A. Diwan, D. Feinberg, D. Frampton, S. Z. Guyer, M. Hirzel, A. Hosking, M. Jump, H. Lee, J. E. B. Moss, A. Phansalkar, D. Stefanovic, T. VanDrunen, D. von Dincklage, and B. Wiedermann. The DaCapo benchmarks: Java benchmarking development and analysis. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 169--190. ACM Press, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. B. Boissinot, A. Darte, F. Rastello, B. D. de Dinechin, and C. Guillon. Revisiting out-of-SSA translation for correctness, code quality and efficiency. In Proceedings of the International Symposium on Code Generation and Optimization, pages 114--125. IEEE Computer Society, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. B. Boissinot, S. Hack, D. Grund, B. Dupont de Dinechin, and F. Rastello. Fast liveness checking for SSA-form programs. In Proceedings of the International Symposium on Code Generation and Optimization, pages 35--44. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. Briggs, K. D. Cooper, and L. Torczon. Improvements to graph coloring register allocation. ACM Transactions on Programming Languages and Systems, 16(3):428--455, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. Brisk, F. Dabiri, R. Jafari, and M. Sarrafzadeh. Optimal register sharing for high-level synthesis of SSA form programs. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 25(5):772--779, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Z. Budimlic, K. D. Cooper, T. J. Harvey, K. Kennedy, T. S. Oberg, and S. W. Reeves. Fast copy coalescing and live-range identification. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 25--32. ACM Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. G. J. Chaitin, M. A. Auslander, A. K. Chandra, J. Cocke, M. E. Hopkins, and P. W. Markstein. Register allocation via coloring. Computer Languages, 6:47--57, 1981.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. J. Fink and F. Qian. Design, implementation and evaluation of adaptive recompilation with on-stack replacement. In Proceedings of the International Symposium on Code Generation and Optimization, pages 241--252. IEEE Computer Society, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Griesemer and S. Mitrovic. A compiler for the Java HotSpot virtual machine. In The School of Niklaus Wirth: The Art of Simplicity, pages 133--152. dpunkt.verlag, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Hack and G. Goos. Optimal register allocation for SSA-form programs in polynomial time. Information Processing Letters, 98(4):150--155, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Hack and G. Goos. Copy coalescing by graph recoloring. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 227--237. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Hack, D. Grund, and G. Goos. Register allocation for programs in SSA-form. In Proceedings of the International Conference on Compiler Construction, pages 247--262. LNCS 3923, Springer Verlag, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. U. Hölzle and D. Ungar. Optimizing dynamically-dispatched calls with run-time type feedback. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 326--336. ACM Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. Kotzmann, C. Wimmer, H. Mössenböck, T. Rodriguez, K. Russell, and D. Cox. Design of the Java HotSpot client compiler for Java 6. ACM Transactions on Architecture and Code Optimization, 5(1):Article 7, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In Proceedings of the International Symposium on Code Generation and Optimization, pages 75--88. IEEE Computer Society, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. T. Lindholm and F. Yellin. The Java Virtual Machine Specification. Addison-Wesley, 2nd edition, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. H. Mössenböck and M. Pfeiffer. Linear scan register allocation in the context of SSA form and register constraints. In Proceedings of the International Conference on Compiler Construction, pages 229--246. LNCS 2304, Springer-Verlag, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. F. M. Q. Pereira and J. Palsberg. Register allocation by puzzle solving. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 216--226. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. F. M. Q. Pereira and J. Palsberg. SSA elimination after register allocation. In Proceedings of the International Conference on Compiler Construction, pages 158--173. LNCS 5501, Springer Verlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. M. Poletto and V. Sarkar. Linear scan register allocation. ACM Transactions on Programming Languages and Systems, 21(5):895--913, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Pozo and B. Miller. SciMark 2.0, 1999. http://math.nist.gov/scimark2/.Google ScholarGoogle Scholar
  24. V. Sarkar and R. Barik. Extended linear scan: An alternate foundation for global register allocation. In Proceedings of the International Conference on Compiler Construction, pages 141--155. LNCS 4420, Springer Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Standard Performance Evaluation Corporation. SPECjbb2005, 2005. http://www.spec.org/jbb2005/.Google ScholarGoogle Scholar
  26. Standard Performance Evaluation Corporation. SPECjvm2008, 2008. http://www.spec.org/jvm2008/.Google ScholarGoogle Scholar
  27. Sun Microsystems, Inc. OpenJDK, 2009. http://openjdk.java.net/.Google ScholarGoogle Scholar
  28. O. Traub, G. Holloway, and M. D. Smith. Quality and speed in linear-scan register allocation. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 142--151. ACM Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. C. Wimmer. Linear scan register allocation for the Java HotSpot client compiler. Master's thesis, Johannes Kepler University Linz, 2004.Google ScholarGoogle Scholar
  30. C. Wimmer and H. Mössenböck. Optimized interval splitting in a linear scan register allocator. In Proceedings of the ACM/USENIX International Conference on Virtual Execution Environments, pages 132--141. ACM Press, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Linear scan register allocation on SSA form

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!