Skip to main content

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4017))

Included in the following conference series:

Abstract

Code size is a main cost factor for many high volume electronic devices. It is therefore important to reduce the size of the applications in an embedded system. Several methods have been proposed to deal with this problem, mostly based on compressing the binaries. In this paper, we approach the problem from a different perspective. We try to exploit the back end code optimizations present in a production compiler to generate as few assembly instructions as possible. This approach is based on iterative compilation in which many different versions of the code are tested. We employ statistical analysis to identify the compiler options that have the largest effect on code size. We have applied this technique to gcc 3.3.4 using the MediaBench suite and four target architectures. We show that in almost all cases we produce shorter codes than the standard setting -Os does which is designed to optimize for size. In some cases, we generate code that is 30% shorter than -Os.

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

Access this chapter

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

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Beszédes, A., Ferenc, R., Gyimóthy, T., Dolenc, A., Karsisto, K.: Survey of code-size reduction methods. ACM Comput. Surv. 35, 223–267 (2003)

    Article  Google Scholar 

  2. Cooper, K., Hall, M., Torczon, L.: Unexpected side effects of inline substitution: A case study. ACM Letters on Programming Languages and Systems 1, 22–32 (1992)

    Article  Google Scholar 

  3. Pinkers, R.P.J., Knijnenburg, P.M.W., Haneda, M., Wijshoff, H.A.G.: Statistical selection of compiler options. In: Proc. Workshop on Modeling, Analysis, and Simulation of Computer and Telecommunication Systems (MASCOTS), pp. 494–501 (2004)

    Google Scholar 

  4. Fraser, C., Myers, E., Wendt, A.: Analyzing and compressing assembly code. In: Proc. SIGPLAN symposium on Compiler Construction, pp. 117–121 (1984)

    Google Scholar 

  5. Cooper, K., McIntosh, N.: Enhanced code compression for embedded risc processors. In: Proc. Programming Language Design and Implementation (PLDI), pp. 139–149 (1999)

    Google Scholar 

  6. Debray, S., Evans, W., Muth, R., Sutter, B.D.: Compiler techniques for code compaction. ACM Trans. Programming Languages and Systems 22, 378–415 (2000)

    Article  Google Scholar 

  7. Mathias, K., Eshelman, L., Schaffer, J., Augusteijn, L., Hoogendijk, P., van de Wiel, R.: Code compaction using genetic algorithms. In: Proc. Genetic and Evolutionary Computation Conference (GECCO), pp. 710–717 (2000)

    Google Scholar 

  8. Sutter, B.D., Vandierendonck, H., Bus, B.D., Bosschere, K.D.: On the side-effects of code abstraction. In: Proc. Language, Compiler, and Tool for Emebedded Systems (LCTES), pp. 244–253 (2003)

    Google Scholar 

  9. Cooper, K., Schielke, P., Subramanian, D.: Optimizing for reduced code space using genetic algorithms. In: Proc. Languages, Compilers, and Tools for Embedded Systems (LCTES), pp. 1–9 (1999)

    Google Scholar 

  10. Hedayat, A., Sloane, N., Stufken, J.: Orthogonal Arrays: Theory and Applications. Series in Statistics. Springer, Heidelberg (1999)

    MATH  Google Scholar 

  11. Sloane, N.: A library of orthogonal arrays, http://www.research.att.com/~njas/

  12. Hollander, M., Wolfe, D.A.: Nonparametric Statistical Methods. Wiley Series in Probability and Statistics (1999)

    Google Scholar 

  13. GNU Consortium: GCC online documentation, http://gcc.gnu.org/onlinedocs/

  14. Mediabench, http://cares.icsl.ucla.edu/MediaBench

  15. Haneda, M., Knijnenburg, P., Wijshoff, H.: Code size reduction by compiler tuning. Technical report, LIACS, Leiden Univeresity (2005)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Haneda, M., Knijnenburg, P.M.W., Wijshoff, H.A.G. (2006). Code Size Reduction by Compiler Tuning. In: Vassiliadis, S., Wong, S., Hämäläinen, T.D. (eds) Embedded Computer Systems: Architectures, Modeling, and Simulation. SAMOS 2006. Lecture Notes in Computer Science, vol 4017. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11796435_20

Download citation

  • DOI: https://doi.org/10.1007/11796435_20

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-36410-8

  • Online ISBN: 978-3-540-36411-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics