Nearly Optimal Register Allocation with PBQP

  • Lang Hames
  • Bernhard Scholz
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4228)


In this work we present a new heuristic for PBQP which significantly improves the quality of its register allocations and extends the range of viable target architectures. We also introduce a new branch-and-bound technique for PBQP that is able to find optimal register allocations.

We evaluate each of these methods, as well as a state of the art graph colouring method, using SPEC2000 and IA-32 as a testbed. Spill costs are used as a metric for comparison. We provide experimental evidence that our new heuristic allows PBQP to remain effective even for relatively regular architectures such as IA-32, generating results equal to those of a start-of-the-art graph colouring technique. Our method is shown to run 3–4 times slower than graph colouring, however it supports a wide range of irregularities.

Using our branch-and-bound solver for PBQP we were able to solve 97.4% of the functions in SPEC2000 optimally. These results are used as a yardstick to show that both PBQP and graph colouring produce results which are very close to optimal.


Cost Vector Register Allocation Register Exclusion Exhaustive Enumeration Interference Graph 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Moore, G.: 40th Anniversary of Moore’s Law. In: Press Conference (2005)Google Scholar
  2. 2.
    Chaitin, G.J., Auslander, M.A., Chandra, A.K., Cocke, J., Hopkins, M.E., Markstein, P.W.: Register allocation via coloring. Computer Languages 6, 47–57 (1981)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.
    Briggs, P., Cooper, K.D., Torczon, L.: Coloring register pairs. ACM Lett. Program. Lang. Syst. 1(1), 3–13 (1992)CrossRefGoogle Scholar
  5. 5.
    Smith, M.D., Ramsey, N., Holloway, G.: A generalized algorithm for graph-coloring register allocation. In: PLDI 2004: Proceedings of the ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation, pp. 277–288. ACM Press, New York (2004)CrossRefGoogle Scholar
  6. 6.
    Kong, T., Wilken, K.D.: Precise register allocation for irregular architectures. In: MICRO 31: Proceedings of the 31st annual ACM/IEEE international symposium on Microarchitectures, pp. 297–307. IEEE Computer Society Press, Los Alamitos, CA, USA (1998)CrossRefGoogle Scholar
  7. 7.
    Koes, D., Goldstein, S.C.: A progressive register allocator for irregular architectures. In: CGO 2005: Proceedings of the international symposium on Code generation and optimization, Washington, DC, USA, pp. 269–280. IEEE Computer Society, Los Alamitos (2005)Google Scholar
  8. 8.
    Scholz, B., Eckstein, E.: Register allocation for irregular architectures. In: LCTES/SCOPES 2002: Proceedings of the joint conference on Languages, compilers and tools for embedded systems, pp. 139–148. ACM Press, New York (2002)CrossRefGoogle Scholar
  9. 9.
    Eckstein, E.: Code Optimizations for Digital Signal Processors. Ph.D thesis, Institute of Computer Languages, Compilers and Languages Group, Vienna University of Technology (2003)Google Scholar
  10. 10.
    Murty, K.G.: Operations Research: Deterministic Optimization Models. Prentice-Hall, Englewood Cliffs (1995)MATHGoogle Scholar
  11. 11.
    Hirnschrott, U., Krall, A., Scholz, B.: Graph -coloring vs.optimal register allocation for optimizing compilers. In: Proceedings of the Joint Modular Language Conference, pp. 202–213 (2003)Google Scholar
  12. 12.
    Briggs, P.: Register allocation via graph coloring. Technical Report TR92-183, Department of Computer Science, Rice University (1998)Google Scholar
  13. 13.
    Runeson, J., Nyström, S.: Retargetable Graph-Coloring Register Allocation for Irregular Architectures. In: Krall, A. (ed.) SCOPES 2003. LNCS, vol. 2826, pp. 240–254. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  14. 14.
    Koseki, A., Komatsu, H., Nakatani, T.: Preference-directed graph coloring. In: PLDI 2002: Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation, pp. 33–44. ACM Press, New York (2002)CrossRefGoogle Scholar
  15. 15.
    Goodwin, D.W., Wilken, K.D.: Optimal and near-optimal global register allocations using 0–1 integer programming. Softw. Pract. Exper. 26(8), 929–965 (1996)CrossRefGoogle Scholar
  16. 16.
    Koes, D., Goldstein, S.C.: A global progressive register allocator. In: PLDI 2006: Proceedings of the ACM SIGPLAN 1990 conference on Programming language design and implementation, Ottawa, ON, Canada. ACM Press, New York (to appear, 2006)Google Scholar
  17. 17.
    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

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Lang Hames
    • 1
  • Bernhard Scholz
    • 1
  1. 1.School of Information TechnologiesThe University of SydneyAustralia

Personalised recommendations