Abstract
We study the effect of an optimizing algorithm for straight–line code which first constructs a directed acyclic graph representing the given program and then generates code from it. We show that this algorithm produces optimal code with respect to the classical transformations known as Constant Folding, Common Subexpression Elimination, and Dead Code Elimination. In contrast to the former, the latter are also applicable to iterative code containing loops. We can show that the graph–based algorithm essentially corresponds to a combination of the three classical optimizations in conjunction with Copy Propagation. Thus, apart from its theoretical importance, this result is relevant for practical compiler design as it potentially allows to exploit the optimization potential of the graph–based algorithm for non–linear code as well.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Aho, A.V., Johnson, S.C.: Optimal code generation for expression trees. J. ACM 23(3), 488–501 (1976)
Aho, A.V., Johnson, S.C., Ullman, J.D.: Code generation for expressions with common subexpressions. J. ACM 24(1), 146–160 (1977)
Aho, A.V., Sethi, R., Ullman, J.D.: A formal approach to code optimization. ACM SIGPLAN Notices 5(7), 86–100 (1970)
Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison–Wesley, London, UK (1986)
Ibarra, O.H., Leininger, B.S.: The complexity of the equivalence problem for straight–line programs. In: STOC 1980. Proc. of the 12th Annual ACM Symp. on Theory of Computing, pp. 273–280. ACM Press, New York, NY, USA (1980)
Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis. Springer, Heidelberg (1999)
Noll, T., Rieger, S.: Optimization of straight–line code revisited. Technical Report 2005–21, RWTH Aachen University, Dept. of Computer Science, Germany (2005), http://sunsite.informatik.rwth-aachen.de/Publications/AIB/
Rieger, S.: SLC Optimizer - Web Interface (2005), http://aprove.informatik.rwth-aachen.de/~rieger/
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Noll, T., Rieger, S. (2007). Composing Transformations to Optimize Linear Code. In: Jones, C.B., Liu, Z., Woodcock, J. (eds) Theoretical Aspects of Computing – ICTAC 2007. ICTAC 2007. Lecture Notes in Computer Science, vol 4711. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-75292-9_29
Download citation
DOI: https://doi.org/10.1007/978-3-540-75292-9_29
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-75290-5
Online ISBN: 978-3-540-75292-9
eBook Packages: Computer ScienceComputer Science (R0)