Skip to main content

A Framework for Enhancing Code Quality in Limited Register Set Embedded Processors

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1985))

Abstract

Spill code generated during register allocation greatly influences the overall quality of compiled code, both in terms of speed as well as size. In embedded systems, where size of memory is often a major constraint, the size of compiled code is very important. In this paper we present a framework for better generation and placement of spill code for RISC-style embedded processors. Our framework attempts to achieve efficient execution and reduce spill-induced code growth. Traditional graph-coloring allocators often make spilling decisions which are not guided by program structure or path-sensitive control flow information. Quite often, allocation decisions get heavily influenced by the choice of candidates for register residency. Especially for systems with a limited number of registers, if one is not careful to contain register pressure, it could lead to generation of a lot of spill code. We propose a framework which selectively demotes variables in a contained manner and influences the formation of live ranges. The decisions for selective demotion are made through a flow-analytic approach such that fewer spill instructions are generated. Our approach tries to keep variables as candidates for register allocation only along the paths where it is profitable to do so. We attempt to identify good local candidates for demotion, however, decisions are taken only after their global demotion costs are captured. We have implemented our framework inside the SGI MIPSPRO compiler. Our results show improvement over a Briggs-style allocator in reducing code size upto 3:5% and upto 8:2% in reducing static loads in some cases for a register set of size 8. The results are very encouraging for other parameters as well for various sizes of register sets.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers Priciples, Techniques, and Tools. Addison-Wesley Publishing Company, 1986.

    Google Scholar 

  2. P. Bergner, P. Dahl, D. Engebretsen, and M. O’Keefe. Spill Code Minimization via Interference Region Spilling. In Proceedings of the 1997 ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 287–295, June 1997.

    Google Scholar 

  3. P. Briggs, K. Cooper, and L. Torczon. Improvements to Graph Coloring Register Allocation. ACM Transactions on Programming Languages and Systems, 16(3):428–455, May 1994.

    Article  Google Scholar 

  4. D. Callahan and B. Koblenz. Register Allocation via Hierarchical Graph Coloring. In Proceedings of the 1991 ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 192–203, June 1991.

    Google Scholar 

  5. G. Chaitin, M. Auslander, A. Chandra, J. Cocke, M. Hopkins, and P. Markstein. Register Allocation via Coloring. Computer Languages, 6:47–57, January 1981.

    Google Scholar 

  6. F. Chow and J. Hennessy. The Priority-based Coloring Approach to Register Allocation. ACM Transactions on Programming Languages and Systems, 12(4):501–536, October 1990.

    Article  Google Scholar 

  7. K. Cooper and N. McIntosh. Enhanced Code Compression for Embedded RISC Processors. In Proceedings of the 1999 ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 139–149, May 1999.

    Google Scholar 

  8. K. Cooper, P. Schielke, and D. Subramanian. Optimizing for Reduced Code Space using Genetic Algorithms. In Proceedings of the 1999ACM SIGPLAN Workshop on Languages, Compilers and Tools for Embdedded Systems, pages 1–9, July 1999.

    Google Scholar 

  9. J. Ernst, W. Evans, C. Fraser, S. Lucco, and T. Proebsting. Code Compression. In Proceedings of the 1997 ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 358–365, June 1997.

    Google Scholar 

  10. C. Fraser, E. Myers, and A. Wendt. Analyzing and Compressing Assembly Code. SIGPLAN Notices, 19(6):117–121, June 1984.

    Article  Google Scholar 

  11. P. Kolte and M. J. Harrold. Load/store Range Analysis for Global Register Allocation. In Proceedings of the 1993 ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 268–277, June 1993.

    Google Scholar 

  12. S. Liao, S. Devadas, K. Keutzer, S. Tijang, and A. Wang. Storage Assignment to Decrease Code Size. ACM Transactions on Programming Languages and Systems, 18(3):684–691, May 1996.

    Article  Google Scholar 

  13. S. Mantripragada, S. Jain, and J. Dehnert. A New Framework for Integrated Global Local Scheduling. In Proceedings of the 1998 International Conference on Parallel Architectures and Compilation Techniques, pages 167–175, October 1998.

    Google Scholar 

  14. C. Norris and L. L. Pollock. RAP: A PDG-based Register Allocator. Software-Practice and Experience, 28(4):401–424, April 1998.

    Article  Google Scholar 

  15. A. Rao and S. Pande. Storage Assignment Optimizations to Generate Compact and Efficient Code on Embedded DSPs. In Proceedings of the 1999 ACM SIGPLAN Conference on Programming Languages Design and Implementation, pages 128–138, May 1999.

    Google Scholar 

  16. A. Wolfe and A. Chanin. Executing Compressed Programs on an Embedded RISC Architecture. In Proceedings of the 25th IEEE/ACM International Symposium on Microarchitecture, pages 81–91, December 1992.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2001 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bairagi, D., Pande, S., Agrawal, D.P. (2001). A Framework for Enhancing Code Quality in Limited Register Set Embedded Processors. In: Davidson, J., Min, S.L. (eds) Languages, Compilers, and Tools for Embedded Systems. LCTES 2000. Lecture Notes in Computer Science, vol 1985. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45245-1_6

Download citation

  • DOI: https://doi.org/10.1007/3-540-45245-1_6

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-41781-1

  • Online ISBN: 978-3-540-45245-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics