Enhanced Bitwidth-Aware Register Allocation

  • Rajkishore Barik
  • Vivek Sarkar
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)

Abstract

Embedded processors depend on register files for performance, just like general-purpose processors in desktop and server systems. However, unlike general-purpose processors, the power consumption of register files poses a significant challenge for embedded processors, making it desirable for embedded processors to use as few registers as possible. Past research has indicated the potential for leveraging bitwidth analysis and bitwidth-aware register allocation to reduce register usage in embedded applications.

This paper makes the following contributions in evaluating and enhancing bitwidth-aware register allocation for embedded applications. First, we compare the Tallam-Gupta bitwidth analysis with an idealized limit study, and show significant opportunities for enhancements. Second, we show how bitwidth-aware register allocation can be enhanced by enhanced bitwidth analysis for scalar and array variables, and also by enhanced coalescing of variables. Third, we use our prototype implementation of bitwidth-aware register allocation in gcc to compare the number of dynamic spill load/store instructions resulting from a) bitwidth-unaware allocation, b) bitwidth-aware allocation, c) enhanced bitwidth-aware allocation, and d) ideal profile-driven bitwidth-aware allocation. Our results show that our enhancements can reduce the number of dynamic spill load/store instructions to between 3% and 27% of the number obtained from the Tallam-Gupta algorithm.

References

  1. 1.
  2. 2.
    Gcc compiler (2004), http://gcc.gnu.org/
  3. 3.
    Berlin, D., Edelsohn, D., Pop, S.: High-level loop optimizations for gcc. In: The 2004 GCC Developers Summit (2004)Google Scholar
  4. 4.
    Briggs, P., Cooper, K.D., Torczon, L.: Improvements to graph coloring register allocation. ACM Transactions on Programming Languages and Systems 16(3), 428–455 (1994)CrossRefGoogle Scholar
  5. 5.
    Brooks, D., Martonosi, M.: Dynamically exploiting narrow width operands to improve processor power and performance. In: HPCA 1999: Proceedings of the The Fifth International Symposium on High Performance Computer Architecture, p. 13. IEEE Computer Society, Los Alamitos (1999)Google Scholar
  6. 6.
    Budiu, M., Sakr, M., Walker, K., Goldstein, S.C.: Bitvalue inference: Detecting and exploiting narrow bitwidth computations. In: Bode, A., Ludwig, T., Karl, W.C., Wismüller, R. (eds.) Euro-Par 2000. LNCS, vol. 1900, pp. 969–979. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  7. 7.
    Chaitin, G.J.: Register allocation and spilling via graph coloring. In: Proceedings of the ACM SIGPLAN 1982 Symposium on Compiler Construction, June 1982, pp. 98–105 (1982)Google Scholar
  8. 8.
    Davidson, J.W., Jinturkar, S.: Memory access coalescing: a technique for eliminating redundant memory accesses. In: PLDI 1994: Proceedings of the ACM SIGPLAN 1994 conference on Programming language design and implementation, pp. 186–195. ACM Press, New York (1994)CrossRefGoogle Scholar
  9. 9.
    Gupta, R., Mehofer, E., Zhang, Y.: A representation for bit section based analysis and optimization. In: Horspool, R.N. (ed.) CC 2002 and ETAPS 2002. LNCS, vol. 2304, pp. 62–77. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  10. 10.
    Harrison, W.: Compiler analysis of the value ranges for variables. IEEE Transactions on Software Engineering (3) (May 1977)Google Scholar
  11. 11.
    Kin, J., Gupta, M., Mangione-Smith, W.H.: The filter cache: an energy efficient memory structure. In: MICRO 30: Proceedings of the 30th annual ACM/IEEE international symposium on Microarchitecture, pp. 184–193. IEEE Computer Society, Los Alamitos (1997)Google Scholar
  12. 12.
    Knobe, K., Sarkar, V.: Array ssa form and its use in parallelization. In: POPL 1998: Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 107–120. ACM Press, New York (1998)Google Scholar
  13. 13.
    Sarkar, V., Knobe, K.: Conditional constant propagation of scalar and array references using array SSA form. In: Levi, G. (ed.) SAS 1998. LNCS, vol. 1503, pp. 33–56. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  14. 14.
    Larsen, S., Amarasinghe, S.: Exploiting superword level parallelism with multimedia instruction sets. In: PLDI 2000: Proceedings of the ACM SIGPLAN 2000 conference on Programming language design and implementation, pp. 145–156. ACM Press, New York (2000)CrossRefGoogle Scholar
  15. 15.
    Li, B., Gupta, R.: Bit section instruction set extension of arm for embedded applications. In: Proceedings of the international conference on Compilers, architecture, and synthesis for embedded systems, pp. 69–78. ACM Press, New York (2002)Google Scholar
  16. 16.
    Li, B., Zhang, Y., Gupta, R.: Speculative subword register allocation in embedded processors. In: Eigenmann, R., Li, Z., Midkiff, S.P. (eds.) LCPC 2004. LNCS, vol. 3602, pp. 56–71. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  17. 17.
    Unsal, O.S., Wang, Z., Koren, I., Krishna, C.M., Moritz, C.A.: On memory behavior of scalars in embedded multimedia systems. In: MPI Workshop, ISCA (2001)Google Scholar
  18. 18.
    Poletto, M., Sarkar, V.: Linear scan register allocation. ACM Transactions on Programming Languages and Systems 21(5), 895–913 (1999)CrossRefGoogle Scholar
  19. 19.
    Stephenson, M., Babb, J., Amarasinghe, S.: Bitwidth analysis with application to silicon compilation. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, Vancouver, British Columbia (June 2000)Google Scholar
  20. 20.
    Tallam, S., Gupta, R.: Bitwidth aware global register allocation. In: POPL 2003: Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 85–96. ACM Press, New York (2003)Google Scholar
  21. 21.
    Traub, O., Holloway, G.H., Smith, M.D.: Quality and speed in linear-scan register allocation. In: SIGPLAN Conference on Programming Language Design and Implementation, pp. 142–151 (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Rajkishore Barik
    • 1
  • Vivek Sarkar
    • 1
  1. 1.IBM T.J. Watson Research CenterUSA

Personalised recommendations