Abstract
Compilers such as gcc use static-single-assignment (SSA) form as an intermediate representation and usually perform SSA elimination before register allocation. But the order could as well be the opposite: the recent approach of SSA-based register allocation performs SSA elimination after register allocation. SSA elimination before register allocation is straightforward and standard, while previously described approaches to SSA elimination after register allocation have shortcomings; in particular, they have problems with implementing copies between memory locations. We present spill-free SSA elimination, a simple and efficient algorithm for SSA elimination after register allocation that avoids increasing the number of spilled variables. We also present three optimizations of the core algorithm. Our experiments show that spill-free SSA elimination takes less than five percent of the total compilation time of a JIT compiler. Our optimizations reduce the number of memory accesses by more than 9% and improve the program execution time by more than 1.8%.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Appel, A.W.: SSA is functional programming. SIGPLAN Notices 33(4), 17–20 (1998)
Appel, A.W., Palsberg, J.: Modern Compiler Implementation in Java, 2nd edn. Cambridge University Press, Cambridge (2002)
Bouchez, F.: Allocation de registres et vidage en mémoire. Master’s thesis, ENS Lyon (October 2005)
Bouchez, F., Darte, A., Guillon, C., Rastello, F.: 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, pp. 283–298 (2006)
Briggs, P., Cooper, K.D., Harvey, T.J., Simpson, L.T.: Practical improvements to the construction and destruction of static single assignment form. Software Practice and Experience 28(8), 859–881 (1998)
Brisk, P.: Advances in Static Single Assignment Form and Register Allocation. PhD thesis, UCLA, University of California, Los Angeles (2006)
Brisk, P., Dabiri, F., Jafari, R., Sarrafzadeh, M.: 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)
Budimlic, Z., Cooper, K.D., Harvey, T.J., Kennedy, K., Oberg, T.S., Reeves, S.W.: Fast copy coalescing and live-range identification. In: PLDI, ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 25–32. ACM Press, New York (2002)
Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. TOPLAS 13(4), 451–490 (1991)
de Ferriére, F., Guillon, C., Rastello, F.: Optimizing the translation out-of-SSA with renaming constraints. ST Journal of Research Processor Architecture and Compilation for Embedded Systems 1(2), 81–96 (2004)
Gough, B.J.: An Introduction to GCC, 1st edn. Network Theory Ltd. (2005)
Hack, S., Goos, G.: Copy coalescing by graph recoloring. In: PLDI, ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 227–237 (2008)
Hack, S., Grund, D., Goos, G.: Register allocation for programs in SSA-form. In: Mycroft, A., Zeller, A. (eds.) CC 2006. LNCS, vol. 3923, pp. 247–262. Springer, Heidelberg (2006)
Koes, D.R., Goldstein, S.C.: A global progressive register allocator. In: PLDI, ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 204–215 (2006)
Lattner, C., Adve, V.: LLVM: A compilation framework for lifelong program analysis & transformation. In: CGO, International Symposium on Code Generation and Optimization, pp. 75–88 (2004)
May, C.: The parallel assignment problem redefined. IEEE Trans. Software Eng. 15(6), 821–824 (1989)
Nandivada, V.K., Pereira, F., Palsberg, J.: A framework for end-to-end verification and evaluation of register allocators. In: Proceedings of SAS, International Static Analysis Symposium, Kongens Lyngby, Denmark, August 2007, pp. 153–169 (2007)
Pereira, F.M.Q.: Register Allocation by Puzzle Solving. PhD thesis, UCLA, University of California, Los Angeles (2008)
Pereira, F.M.Q., Palsberg, J.: Register allocation via coloring of chordal graphs. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 315–329. Springer, Heidelberg (2005)
Pereira, F.M.Q., Palsberg, J.: Register allocation after classical SSA elimination is NP-complete. In: Aceto, L., Ingólfsdóttir, A. (eds.) FOSSACS 2006. LNCS, vol. 3921, pp. 79–93. Springer, Heidelberg (2006)
Pereira, F.M.Q., Palsberg, J.: Register allocation by puzzle solving. In: PLDI, ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 216–226 (2008)
Poletto, M., Sarkar, V.: Linear scan register allocation. Transactions on Programming Languages and Systems (TOPLAS) 21(5), 895–913 (1999)
Rideau, L., Serpette, B.P., Leroy, X.: Tilting at windmills with Coq: formal verification of a compilation algorithm for parallel moves (2008)
Rosen, B.K., Zadeck, F.K., Wegman, M.N.: Global value numbers and redundant computations. In: POPL, ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 12–27. ACM Press, New York (1988)
Sagonas, K., Stenman, E.: Experimental evaluation and improvements to linear scan register allocation. Software, Practice and Experience 33, 1003–1034 (2003)
Sarkar, V., Barik, R.: Extended linear scan: An alternate foundation for global register allocation. In: Krishnamurthi, S., Odersky, M. (eds.) CC 2007. LNCS, vol. 4420, pp. 141–155. Springer, Heidelberg (2007)
Sethi, R.: Complete register allocation problems. In: STOC, 5th Annual ACM Symposium on Theory of Computing, pp. 182–195. ACM Press, New York (1973)
Sreedhar, V.C., Ju, R.D.-C., Gillies, D.M., Santhanam, V.: Translating out of static single assignment form. In: Cortesi, A., Filé, G. (eds.) SAS 1999. LNCS, vol. 1694, pp. 194–210. Springer, Heidelberg (1999)
JVM Team. The java HotSpot virtual machine. Technical Report Technical White Paper, Sun Microsystems (2006)
The Jikes Team. Jikes RVM home page (2007), http://jikesrvm.sourceforge.net/
Traub, O., Holloway, G.H., Smith, M.D.: Quality and speed in linear-scan register allocation. In: PLDI, ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 142–151 (1998)
Welch, P.H.: Parallel assignment revisited. Software Practice and Experience 13(12), 1175–1180 (1983)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pereira, F.M.Q., Palsberg, J. (2009). SSA Elimination after Register Allocation. In: de Moor, O., Schwartzbach, M.I. (eds) Compiler Construction. CC 2009. Lecture Notes in Computer Science, vol 5501. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-00722-4_12
Download citation
DOI: https://doi.org/10.1007/978-3-642-00722-4_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-00721-7
Online ISBN: 978-3-642-00722-4
eBook Packages: Computer ScienceComputer Science (R0)