The Power of Belady’s Algorithm in Register Allocation for Long Basic Blocks

  • Jia Guo
  • María Jesús Garzarán
  • David Padua
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2958)


Optimization techniques such as loop-unrolling and trace-scheduling can result in long straight-line codes. It is, however, unclear how well the register allocation algorithms of current compilers perform on these codes. Compilers may well have been optimized for human written codes, which are likely to have short basic blocks. To evaluate how the state of the art compilers behave on long straight-line codes, we wrote a compiler that implements the simple Belady’s MIN algorithm.

The main contribution of this paper is the evaluation of Belady’s MIN algorithm when used for register allocation for long straight-line codes. These codes were executed on a MIPS R12000 processor. Our results show that applications compiled using Belady’s MIN algorithm run faster than when compiled with the MIPSPro or GCC compiler. In particular, Fast Fourier Transforms (FFTs) of size 32 and 64 run 12% and 33% faster than when compiled using the MIPSPro compiler.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Puschel, M., et al.: SPIRAL: A Generator for Platform-Adapted Libraries of Signal Processing Algorithms. Journal of HPCA (2002)Google Scholar
  2. 2.
    Xiong, J., Johnson, J., Johnson, R., Padua, D.: SPL: A Language and a Compiler for DSP Algorithms. In: Proc. of PLDI, pp. 298-308 (2001)Google Scholar
  3. 3.
    Whaley, R., Dongarra, J.: Automatically Tuned Linear Algebra Software. Technical Report UT CS-97-366, University of Tenessee (1997)Google Scholar
  4. 4.
    Hennessy, J.L., Patterson, D.A.: Computer Architecture: A Quantitative Approach. Morgan Kaufmann Publishers, San Francisco (1996)MATHGoogle Scholar
  5. 5.
    Chaitin, G.: Register Allocation and Spilling Via Graph Coloring. In: Proc. of the SIGPLAN Symp. On Compiler Construction, pp. 98–105 (1982)Google Scholar
  6. 6.
    Garey, M., Johnson, D.: Computers and Intracdtability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, New York (1989)Google Scholar
  7. 7.
    Bergner, P., Dahl, P., Engebretsen, D., Keefe, O.M.T.: Spill code minimization via interference region spilling. In: SIGPLAN Conf. on PLDI, pp. 287-295 (1997) Google Scholar
  8. 8.
    Briggs, P., et al.: Improvements to Graph Coloring Register Allocation. ACM Trans. on Programming Languages and Systems 6, 428–455 (1994)CrossRefGoogle Scholar
  9. 9.
    George, L., Appel, L.: Iterated Register Coalescing. ACM Trans. on Programming Languages and Systems 18, 300–324 (1996)CrossRefGoogle Scholar
  10. 10.
    Hsu, W., Fischer, C., Goodman, J.: On the Minimization of Load/Stores in Local Register Allocation. IEEE TSE 15, 1252–1260 (1989)Google Scholar
  11. 11.
    Horwitz, L., karp, R.M., Miller, R.E., Winograd, S.: Index Register Allocation. Journal of the ACM 13, 43–61 (1966)MATHCrossRefGoogle Scholar
  12. 12.
    Kennedy, K.: Index Register Allocation in Straight Line Code and Simple Loops. In: Design and Optimization of Compilers. Prentice Hall, Englewood Cliffs (1972)Google Scholar
  13. 13.
    Luccio, F.: A Comment on Index Register Allocation. CACM 10, 572–574 (1967)MATHGoogle Scholar
  14. 14.
    Belady, L.: A Study of Replacement of Algorithms for a Virtual Storage Computer. IBM Systems Journal 5, 78–101 (1966)CrossRefGoogle Scholar
  15. 15.
    Yotov, K., et al.: A Comparison of Empirical and Model-driven Optimization. In: Proc. of PLDI, pp. 63-76 (2003)Google Scholar
  16. 16.
    Fischer, C., LeBlanc, T.: Crafting a Compiler. Benjamin Cummings (1987)Google Scholar
  17. 17.
    Aho, A., Sethi, R., Ullman, J.D.: Compilers, Principles, Techniques, and Tools. Addison-Wesley Publishing Comapny, Reading (1985)Google Scholar
  18. 18.
    Goodman, J.R., Hsu, W.C.: Code Scheduling and Register Allocation in Large Basic Blocks. In: Proc. of the 2nd ICS, pp. 442–452. ACM Press, New York (1988)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Jia Guo
    • 1
  • María Jesús Garzarán
    • 1
  • David Padua
    • 1
  1. 1.Department of Computer ScienceUniversity of Illinois at Urbana-Champaign 

Personalised recommendations