Evaluation of Algorithms for Local Register Allocation

  • Vincenzo Liberatore
  • Martin Farach-Colton
  • Ulrich Kremer
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1575)


Local register allocation (LRA) assigns pseudo-registers to actual registers in a basic block so as to minimize the spill cost. In this paper, four different LRA algorithms are compared with respect to the quality of their generated allocations and the execution times of the algorithms themselves. The evaluation is based on a framework that views register allocation as the combination of boundary conditions, LRA, and register assignment. Our study does not address the problem of instruction scheduling in conjunction with register allocation, and we assume that the spill cost depends only on the number and type of load and store operations, but not on their positions within the instruction stream. The paper discusses the first optimum algorithm based on integer linear programming as one of the LRA algorithms. The optimal algorithm also serves as the base line for the quality assessment of generated allocations. In addition, two known heuristics, namely Furthest-First (FF) and Clean-First (CF), and a new heuristic (MIX) are discussed and evaluated. The evaluation is based on thirteen Fortran programs from the fmm, Spec, and Spec95X benchmark suites. An advanced compiler infrastructure (ILOC) was used to generated aggressively optimized, intermediate pseudo-register code for each benchmark program. Each local register allocation method was implemented, and evaluated by simulating the execution of the generated code on a machine with N registers and an instruction set where loads and stores are C times as expensive as any other instruction. Experiments were performed for different values of N and C. The results show that only for large basic blocks the allocation quality gap between the different algorithms is significant. When basic blocks are large, the difference was up to 23%. Overall, the new heuristic (MIX) performed best as compared to the other heuristics, producing allocations within 1% of optimum. All heuristics had running times comparable to live variable analysis, or lower, i.e., were very reasonable. More work will be needed to evaluate the LRA algorithms in the context of more sophisticated global register allocators and source level transformations that potentially increase basic block sizes, including loop unrolling, inlining, and speculative execution (superblocks).


Basic Block Lagrangian Relaxation Register Allocation Instruction Schedule Store Operation 
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.


  1. 1.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)Google Scholar
  2. 2.
    Backus, J.: The history of FORTRAN I, II, and III. In: Wexelblat, R. (ed.) History of Programming Languages, ACM Monographs Series, pp. 25–45. Academic Press, New York (1981)Google Scholar
  3. 3.
    Beatty, J.C.: Register assignment algorithm for generation of highly optimized code. IBM J. Res. Develop. 18, 20–39 (1974)zbMATHCrossRefMathSciNetGoogle Scholar
  4. 4.
    Belady, L.A.: A study of replacement algorithms for a virtual storage computer. IBM Systems Journal 5(2), 78–101 (1966)CrossRefGoogle Scholar
  5. 5.
    Briggs, P., Cooper, K., Torczon, L.: Improvements to graph coloring register allocation. ACM Trans. on Programming Lang. and Sys. 16(3), 428–455 (1994)CrossRefGoogle Scholar
  6. 6.
    Chaitin, G.J.: Register allocation & spilling via graph coloring. In: Proceedings of the ACM SIGPLAN Symposium on Compiler Construction, pp. 98–105 (1982)Google Scholar
  7. 7.
    Farach, M., Liberatore, V.: On local register allocation. In: Proceedings of the 9th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 564–573 (1998)Google Scholar
  8. 8.
    Fischer, C.N., LeBlanc Jr., R.J.: Crafting a Compiler. Benjamin/Cummings, Menlo Park (1988)Google Scholar
  9. 9.
    Garey, M.R., Johnson, D.S.: Computers and Intractability. A Guide to the Theory of NP-Completeness., Freeman, San Francisco (1979)Google Scholar
  10. 10.
    Held, M., Karp, R.: The traveling salesman problem and minimum spanning trees. Operations Research 18, 1138–1162 (1970)zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Hochbaum, D.S. (ed.): Approximation Algorithms for NP-hard Problems. PWS Publishing Company, Boston (1997)Google Scholar
  12. 12.
    Horwitz, L.P., Karp, R.M., Miller, R.E., Winograd, S.: Index register allocation. Journal of the Association for Computing Machinery 13(1), 43–61 (1966)zbMATHGoogle Scholar
  13. 13.
    Hsu, W.-C., Fischer, C.N., Goodman, J.R.: On the minimization of load/stores in local register allocation. IEEE Transactions on Software Engineering 15(10), 1252–1260 (1989)CrossRefGoogle Scholar
  14. 14.
    Kennedy, K.: Index register allocation in straight line code and simple loops. In: Rustin, R. (ed.) Design and Optimization of Compilers, pp. 51–63. Prentice-Hall, Englewood Cliffs (1972)Google Scholar
  15. 15.
    Kremer, U.: Optimal and near-optimal solutions for hard compilation problems. Parallel Processing Letters 7(2), 371–378 (1997)CrossRefMathSciNetGoogle Scholar
  16. 16.
    Kurlander, S.M., Fischer, C.N.: Minimum cost interprocedural register allocation. In: Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (1996)Google Scholar
  17. 17.
    Liberatore, V.: Uniform multipaging reduces to paging. Information Processing Letters 67, 9–12 (1998)CrossRefMathSciNetGoogle Scholar
  18. 18.
    Liberatore, V., Farach-Colton, M., Kremer, U.: Evaluation of algorithms for local register allocation. Technical Report TR98-376, Laboratory for Computer Science Research, Rutgers University (1998)Google Scholar
  19. 19.
    Luccio, F.: A comment on index register allocation. Communications of the ACM 10(9), 572–574 (1967)zbMATHCrossRefGoogle Scholar
  20. 20.
    Proebsting, T.A., Fischer, C.N.: Demand-driven register allocation. ACM Trans. on Programming Lang. and Sys. 18(6), 683–710 (1996)CrossRefGoogle Scholar
  21. 21.
    Ruttenberg, J., Gao, G.R., Stoutchinin, A., Lichtenstein, W.: Software pipelining showdown: Optimal vs. heuristics methods in production compilers. In: Proc. SIGPLAN 1996 Conf. on Programming Language Design and Implementation, May 1996, pp. 1–11 (1996)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • Vincenzo Liberatore
    • 1
  • Martin Farach-Colton
    • 2
  • Ulrich Kremer
    • 2
  1. 1.UMIACSUniversity of Maryland College ParkUSA
  2. 2.Dept. of Comp. Sc.Rutgers University New BrunswickUSA

Personalised recommendations