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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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)
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)
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)
Fraser, C., Myers, E., Wendt, A.: Analyzing and compressing assembly code. In: Proc. SIGPLAN symposium on Compiler Construction, pp. 117–121 (1984)
Cooper, K., McIntosh, N.: Enhanced code compression for embedded risc processors. In: Proc. Programming Language Design and Implementation (PLDI), pp. 139–149 (1999)
Debray, S., Evans, W., Muth, R., Sutter, B.D.: Compiler techniques for code compaction. ACM Trans. Programming Languages and Systems 22, 378–415 (2000)
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)
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)
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)
Hedayat, A., Sloane, N., Stufken, J.: Orthogonal Arrays: Theory and Applications. Series in Statistics. Springer, Heidelberg (1999)
Sloane, N.: A library of orthogonal arrays, http://www.research.att.com/~njas/
Hollander, M., Wolfe, D.A.: Nonparametric Statistical Methods. Wiley Series in Probability and Statistics (1999)
GNU Consortium: GCC online documentation, http://gcc.gnu.org/onlinedocs/
Mediabench, http://cares.icsl.ucla.edu/MediaBench
Haneda, M., Knijnenburg, P., Wijshoff, H.: Code size reduction by compiler tuning. Technical report, LIACS, Leiden Univeresity (2005)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)