Fine-Grain Register Allocation Based on a Global Spill Costs Analysis

  • Dae-Hwan Kim
  • Hyuk-Jae Lee
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2826)


A graph-coloring approach is widely used for register allocation, but its efficiency is limited because its formulation is too abstracted to use information about program context. This paper proposes a new register allocation technique that improves the efficiency by using information about the flow of variable references of a program. In the new approach, register allocation is performed at every reference of a variable in the order of the variable reference flow. For each reference, the costs of various possible register allocations are estimated by tracing a possible instruction sequence resulting from register allocations. A cost model is formulated to reduce the scope of the trace. Experimental results show that the proposed approach reduces spill code by an average of 34.3% and 17.8% in 8 benchmarks when compared to the Briggs’ allocator and the interference region spilling allocator, respectively.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley Publishing Company, Reading Mass (1986)Google Scholar
  2. 2.
    Advanced RISC Machines Ltd: ARM Architecture Reference Manual. Document Number: ARM DDI 0100B, Advanced RISC Machines Ltd., (ARM) (1996)Google Scholar
  3. 3.
    Bergner, P., Dahl, P., Engebretsen, D., O’Keefe, M.: Spill code minimization via interference region spilling. In: Proceedings of the ACM PLDI 1997, June 1997, pp. 287–295 (1997)Google Scholar
  4. 4.
    Briggs, P., Cooper, K.D., Torczon, L.: Rematerialization. In: Proceedings of the ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation, SIGPLAN Notices, June 1992, vol. 27(7), pp. 311–321 (1992)Google Scholar
  5. 5.
    Briggs, P., Cooper, K.D., Kennedy, K., Torczon, L.: Coloring heuristics for register allocation. In: Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation, SIGPLAN Notices, June 1989, vol. 24(6), pp. 275–284 (1989)Google Scholar
  6. 6.
    Chaitin, G.J.: Register allocation and spilling via coloring. In: Proceedings of the ACM SIGPLAN 1982 Symposium on Compiler Construction, SIGPLAN Notices, June 1982, vol. 17(6), pp. 98–105 (1982)Google Scholar
  7. 7.
    Chaitin, G.J., Auslander, M.A., Chandra, A.K., Cocke, J., Hopkins, M., Markstein, P.W.: Register allocation via coloring. Computer Languages 6, 47–57 (1981)CrossRefGoogle Scholar
  8. 8.
    Fraser, C.W., Hanson, D.R.: A Retargetable C Compiler: Design and Implementation. Benjamin/Cummings, Redwood City CA (1995)zbMATHGoogle Scholar
  9. 9.
    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
  10. 10.
    Goodwin, D.W., Wilken, K.D.: Optimal and near-optimal global register allocation using 0-1 integer programming. Software-Practice and Experience 26(8), 929–965 (1996)CrossRefGoogle Scholar
  11. 11.
    Hsu, W.-C., Fischer, C.N., Goodman, J.R.: On the minimization of loads/stores in local register allocation. IEEE Transactions on Software Engineering 15(10), 1252–1260 (1989)CrossRefGoogle Scholar
  12. 12.
    Kim, D.H.: Advanced compiler optimization for CalmRISC8 low-end embedded processor. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, pp. 173–188. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  13. 13.
    Kolte, P., Harrold, M.J.: Load/store range analysis for global register allocation. In: Proceedings of the ACM PLDI 1993, June 1993, pp. 268–277 (1993)Google Scholar
  14. 14.
    Mushnick, S.S.: Advanced compiler design and implementation. Morgan Kaufmann, SanFrancisco (1997)Google Scholar
  15. 15.
    Proebsting, T.A., Fischer, C.N.: Demand-driven register allocation. ACM Transactions on Programming Languages and Systems 18(6), 683–710 (1996)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Dae-Hwan Kim
    • 1
  • Hyuk-Jae Lee
    • 1
  1. 1.School of Electrical Engineering and Computer ScienceSeoul National UniversitySeoulKorea

Personalised recommendations