SSA-Based Register Allocation with PBQP

  • Sebastian Buchwald
  • Andreas Zwinkau
  • Thomas Bersch
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6601)


Recent research shows that maintaining SSA form allows to split register allocation into separate phases: spilling, register assignment and copy coalescing. After spilling, register assignment can be done in polynomial time, but copy coalescing is NP-complete. In this paper we present an assignment approach with integrated copy coalescing, which maps the problem to the Partitioned Boolean Quadratic Problem (PBQP). Compared to the state-of-the-art recoloring approach, this reduces the relative number of swap and copy instructions for the SPEC CINT2000 benchmark to 99.6% and 95.2%, respectively, while taking 19% less time for assignment and coalescing.


register allocation copy coalescing PBQP 


  1. 1.
    Bouchez, F., Darte, A., Rastello, F.: On the complexity of register coalescing. In: CGO 2007: Proceedings of the International Symposium on Code Generation and Optimization, pp. 102–114 (2007)Google Scholar
  2. 2.
    Braun, M., Mallon, C., Hack, S.: Preference-guided register assignment. In: Gupta, R. (ed.) CC 2010. LNCS, vol. 6011, pp. 205–223. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  3. 3.
    Briggs, P., Cooper, K.D., Torczon, L.: Improvements to graph coloring register allocation. ACM Trans. Program. Lang. Syst. 16(3), 428–455 (1994)CrossRefGoogle Scholar
  4. 4.
    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
  5. 5.
    Buchwald, S., Zwinkau, A.: Instruction selection by graph transformation. In: Proceedings of the 2010 International Conference on Compilers, Architectures and Synthesis for Embedded Systems, CASES 2010, pp. 31–40. ACM, New York (2010)Google Scholar
  6. 6.
    Chaitin, G.J., Auslander, M.A., Chandra, A.K., Cocke, J., Hopkins, M.E., Markstein, P.W.: Register allocation via coloring. Computer Languages 6(1), 47–57 (1981)CrossRefGoogle Scholar
  7. 7.
    Dirac, G.: On rigid circuit graphs. Abhandlungen aus dem Mathematischen Seminar der Universität Hamburg 25, 71–76 (1961)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Ebner, D., Brandner, F., Scholz, B., Krall, A., Wiedermann, P., Kadlec, A.: Generalized instruction selection using SSA-graphs. In: LCTES 2008: Proceedings of the 2008 ACM SIGPLAN-SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, pp. 31–40. ACM, New York (2008)CrossRefGoogle Scholar
  9. 9.
    Eckstein, E., König, O., Scholz, B.: Code instruction selection based on SSA-graphs. In: Anshelevich, E. (ed.) SCOPES 2003. LNCS, vol. 2826, pp. 49–65. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  10. 10.
    Grund, D., Hack, S.: A fast cutting-plane algorithm for optimal coalescing. In: Adsul, B., Vetta, A. (eds.) CC 2007. LNCS, vol. 4420, pp. 111–125. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  11. 11.
    Hack, S.: Register allocation for programs in SSA form. Ph.D. thesis, Universität Karlsruhe (October 2007)Google Scholar
  12. 12.
    Hack, S., Goos, G.: Copy coalescing by graph recoloring. In: PLDI 2008: Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation (2008)Google Scholar
  13. 13.
    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)CrossRefGoogle Scholar
  14. 14.
    Hames, L., Scholz, B.: Nearly optimal register allocation with PBQP. In: Lightfoot, D.E., Ren, X.-M. (eds.) JMLC 2006. LNCS, vol. 4228, pp. 346–361. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  15. 15.
    Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. SIGPLAN Not. 42(6), 89–100 (2007)CrossRefGoogle Scholar
  16. 16.
    Scholz, B., Eckstein, E.: Register allocation for irregular architectures. In: LCTES-SCOPES, pp. 139–148 (2002)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Sebastian Buchwald
    • 1
  • Andreas Zwinkau
    • 1
  • Thomas Bersch
    • 1
  1. 1.Karlsruhe Institute of Technology (KIT)Germany

Personalised recommendations