Register Allocation for Programs in SSA-Form

  • Sebastian Hack
  • Daniel Grund
  • Gerhard Goos
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)

Abstract

As register allocation is one of the most important phases in optimizing compilers, much work has been done to improve its quality and speed. We present a novel register allocation architecture for programs in SSA-form which simplifies register allocation significantly. We investigate certain properties of SSA-programs and their interference graphs, showing that they belong to the class of chordal graphs. This leads to a quadratic-time optimal coloring algorithm and allows for decoupling the tasks of coloring, spilling and coalescing completely. After presenting heuristic methods for spilling and coalescing, we compare our coalescing heuristic to an optimal method based on integer linear programming.

References

  1. 1.
    Chaitin, G.J., Auslander, M.A., Chandra, A.K., Cocke, J., Hopkins, M.E., Markstein, P.W.: Register allocation via graph coloring. Journal of Computer Languages 6, 45–57 (1981)Google Scholar
  2. 2.
    Briggs, P., Cooper, K.D., Torczon, L.: Improvements to graph coloring register allocation. ACM Trans. Program. Lang. Syst. 16, 428–455 (1994)CrossRefGoogle Scholar
  3. 3.
    Golumbic, M.C.: Algorithmic Graph Theory And Perfect Graphs. Academic Press, London (1980)MATHGoogle Scholar
  4. 4.
    Budimlić, Z., Cooper, K.D., Harvey, T.J., Kennedy, K., Oberg, T.S., Reeves, S.W.: Fast copy coalescing and live-range identification. In: Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation, pp. 25–32. ACM Press, New York (2002)CrossRefGoogle Scholar
  5. 5.
    Bouchez, F.: Allocation de registres et vidage en mémoire. Master’s thesis, ÉNS Lyon (2005)Google Scholar
  6. 6.
    Diestel, R.: Graph Theory, Graduate Texts in Mathematics, 3rd edn., vol. 173. Springer, Heidelberg (2005)Google Scholar
  7. 7.
    Bergner, P., Dahl, P., Engebretsen, D., O’Keefe, M.: Spill code minimization via interference region spilling. In: PLDI 1997: Proceedings of the ACM SIGPLAN 1997 conference on Programming language design and implementation, pp. 287–295. ACM Press, New York (1997)CrossRefGoogle Scholar
  8. 8.
    Chow, F.C., Hennessy, J.L.: The priority-based coloring approach to register allocation. ACM Trans. Program. Lang. Syst. 12, 501–536 (1990)CrossRefGoogle Scholar
  9. 9.
    Hsu, W.C., Fisher, C.N., Goodman, J.R.: On the Minimization of Loads/Stores in Local Register Allocation. IEEE Trans. Softw. Eng. 15, 1252–1260 (1989)CrossRefGoogle Scholar
  10. 10.
    Guo, J., Garzaran, M.J., Padua, D.: The Power of Belady’s Algorithm in Register Allocation for Long Basic Blocks. In: Rauchwerger, L. (ed.) LCPC 2003. LNCS, vol. 2958. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  11. 11.
    Belady, L.: A Study of Replacement of Algorithms for a Virtual Storage Computer. IBM Systems Journal 5, 78–101 (1966)CrossRefGoogle Scholar
  12. 12.
    Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadek, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13, 451–490 (1991)CrossRefGoogle Scholar
  13. 13.
    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, 859–881 (1998)Google Scholar
  14. 14.
    Hack, S., Grund, D., Goos, G.: Towards Register Allocation for Programs in SSA-form. Technical Report 2005-27, Universität Karlsruhe (2005)Google Scholar
  15. 15.
    Lindenmaier, G., Beck, M., Boesler, B., Geiß, R.: Firm, an intermediate language for compiler research. Technical Report 2005-8, University of Karlsruhe (2005)Google Scholar
  16. 16.
    George, L., Appel, A.W.: Iterated register coalescing. ACM Trans. Program. Lang. Syst. 18, 300–324 (1996)CrossRefGoogle Scholar
  17. 17.
    Park, J., Moon, S.M.: Optimistic register coalescing. ACM Trans. Program. Lang. Syst. 26, 735–765 (2004)CrossRefGoogle Scholar
  18. 18.
    Andersson, C.: Register Allocation by Optimal Graph Coloring. In: Hedin, G. (ed.) CC 2003. LNCS, vol. 2622, pp. 33–45. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  19. 19.
    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)CrossRefGoogle Scholar
  20. 20.
    Hack, S.: Interference Graphs of Programs in SSA-form. Technical Report 2005-15, Universität Karlsruhe (2005)Google Scholar
  21. 21.
    Brisk, P., Dabiri, F., Macbeth, J., Sarrafzadeh, M.: Polynomial time graph coloring register allocation. In: 14th International Workshop on Logic and Synthesis. ACM Press, New York (2005)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Sebastian Hack
    • 1
  • Daniel Grund
    • 1
  • Gerhard Goos
    • 1
  1. 1.Fakultät für InformatikUniversität KarlsruheGermany

Personalised recommendations