Program optimization focuses usually on improving the runtime efficiency of a program. Its impact on the code size is typically not considered a concern. In fact, classical optimizations often cause code replication without providing any means allowing a user to control this. This limits their adequacy for applications, where code size is critical, too, like embedded systems or smart cards. In this article, we demonstrate this by means of partial redundancy elimination (PRE), one of the most powerful und widespread optimizations in contemporay compilers, which intuitively aims at avoiding multiple computations of a value at runtime. By modularly extending the classical PRE-approaches we develop a family of code-size sensitive PRE-transformations, whose members in addition to the two traditional goals of PRE (1) reducing the number of computations and (2) avoiding unnecessary register pressure, are unique for taking also (3) code size as a third optimization goal into account. Each of them optimally captures a predefined choice of priority between these three goals. The flexibility and aptitude of these techniques for size-critical applications is demonstrated by various examples.
[1]
Richard M. Karp,et al.
A n^5/2 Algorithm for Maximum Matchings in Bipartite Graphs
,
1971,
SWAT.
[2]
Bernhard Steffen,et al.
Lazy code motion
,
1992,
PLDI '92.
[3]
Bernhard Steffen,et al.
Partial dead code elimination
,
1994,
PLDI '94.
[4]
John Beidler,et al.
Data Structures and Algorithms
,
1996,
Wiley Encyclopedia of Computer Science and Engineering.
[5]
Bernhard Steffen,et al.
Sparse code motion
,
2000,
POPL '00.
[6]
Bernhard Steffen,et al.
Optimal code motion: theory and practice
,
1994,
TOPL.
[7]
Etienne Morel,et al.
Global optimization by suppression of partial redundancies
,
1979,
CACM.
[8]
Bernhard Steffen,et al.
The power of assignment motion
,
1995,
PLDI '95.
[9]
Oliver Rüthing.
Interacting Code Motion Transformations: Their Impact and Their Complexity
,
2000,
Lecture Notes in Computer Science.