Abstract
With the proliferation of embedded devices and systems, there is renewed interest in the generation of compact binaries. Code compaction techniques identify code sequences that repeatedly appear in a program and replace them by a single copy of the recurring sequence. In existing techniques such sequences are typically restricted to single-entry single-exit regions in the control flow graph. We have observed that in many applications recurring code sequences form single-entry multiple-exit (SEME) regions. In this paper we propose a generalized algorithm for code compaction that first decomposes a control flow graph into a hierarchy of SEME regions, computes signatures of SEME regions, and then uses the signatures to find pairs of matching SEME regions. Maximal sized matching SEME regions are found and transformed to achieve code compaction. Our transformation is able to compact matching SEME regions whose exits may lead to a combination of identical and differing targets. Our experiments show that this transformation can lead to substantial reduction in code size for many embedded applications.
Supported by grants from IBM, Intel, and NSF grants CCR-0105355, CCR-0208756, CCR-0220334, and EIA-0080123 to the Univ. of Arizona.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
K. Cooper and N. McIntosh, “Enhanced Code Compression for Embedded RISC Processors,” SIGPLAN Conference on Programming Language Design and Implementation (PLDI), May 1999.
S. Debray, W. Evans, R. Muth, and B. De Sutter, “Compiler Techniques for Code Compaction,” ACM Transactions on Programming Languages and Systems (TOPLAS), vol. 22, no. 2, pages 378–415, March 2000.
S. Debray and W. Evans, “Profile-Guided Code Compression,” SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 95–105, June 2002.
B. De Sutter, B. De Bus and K. De Bosschere, “Sifting out the Mud: low level C++ Code Reuse,” SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA), pages 275–291, Seattle, Wanshington, November 2002.
J. Ferrante, K.J. Ottenstein, and J.D. Warren, “The Program Dependence Graph and Its Use in Optimization,” ACM Transactions on Programming Languages and Systems (TOPLAS), vol. 9, no. 3, pages 319–349, 1987.
C. Fraser, “An Instruction for Direct Intepretation of LZ77-compressed Programs,” Technical Report, Microsoft Research, MSR-TR-2002-90, September 2002.
C. Fraser, E. Myers, and A. Wendt, “Analyzing and Compressing Assembly Code,” ACM SIGPLAN Symposium on Compiler Construction (CC), 1984.
M.R. Guthaus, J.S. Ringenberg, D. Ernst, T.M. Austin, T. Mudge, R.B. Brown, “MiBench: A Free, Commercially Representative Embedded Benchmark Suite,” IEEE 4th Annual Workshop on Workload Characterization (WWC), Austin, TX, December 2001.
R. Johnson, D. Pearson, and K. Pingali, “The Program Structure Tree: Computing Control Regions in Linear Time,” SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 171–185, 1994.
D. Kirovski, J. Kin, and W. H. Mangione-Smith, “Procedure Based Program Compression,” 30th Annual ACM/IEEE International Symposium on Microarchitecture (MICRO), pages 204–217, 1997.
R. Komondoor and S. Horwitz, “Using Slicing to Identify Duplication in Source Code,” International Static Analysis Symposium (SAS), pages 40–56, Paris, France, July 2001.
J. Krinke, “Identifying Similar Code with Program Dependence Graphs,” Working Conference on Reverse Engineering (WCRE), pages 301–309, Stuttgart, Germany, October 2001.
A. Krishnaswamy and R. Gupta, “Profile Guided Selection of ARM and Thumb Instructions,” ACM SIGPLAN Joint Conference on Languages Compilers and Tools for Embedded Systems & Software and Compilers for Embedded Systems (LCTES/SCOPES), pages 55–63, Berlin, Germany, June 2002.
C. Lee, M. Potkonjak, and W.H. Mangione-Smith, “Mediabench: A Tool for Evaluating and Synthesizing Multimedia and Communications Systems,” IEEE/ACM International Symposium on Microarchitecture (MICRO), Research Triangle Park, North Carolina, December 1997.
C. Lefurgy, P. Bird, I.-C. Chen, and T. Mudge, “Improving Code Density Using Compression Techniques,” 30th Annual ACM/IEEE International Symposium on Microarchitecture (MICRO), pages 194–203, 1997.
W. Wulf, R. Johnson, C. Weinstock, S. Hobbs, and C. Geschke, “The Design of an Optimizing Compiler,” American Elsevier, New York, 1975.
M. Zastre, “Compacting Object Code via Parameterized Procedural Abstraction,” MS Thesis, University of Victoria, 1995.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2003 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Chen, WK., Li, B., Gupta, R. (2003). Code Compaction of Matching Single-Entry Multiple-Exit Regions. In: Cousot, R. (eds) Static Analysis. SAS 2003. Lecture Notes in Computer Science, vol 2694. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44898-5_23
Download citation
DOI: https://doi.org/10.1007/3-540-44898-5_23
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-40325-8
Online ISBN: 978-3-540-44898-3
eBook Packages: Springer Book Archive