Abstract
A joint application of four optimizing transformations for purging imperative programs—elimination of useless statements, unwinding of degenerate loops, removal from loops, and removal from branch statements—is considered. A model of regular schemes is introduced in terms of which the transformations and their context conditions are formulated. In the class of regular schemes, a subclass of irredundant schemes, which correspond to program fragments without redundant calculations, is separated. For the irredundant schemes, the context conditions of the transformations for removal from loops and branch statements are formulated, which are simpler than the standard context conditions. Algorithms for the elimination of useless statements, unwinding of degenerate loops, and removal from loops and hammocks are described. The correctness of the algorithms constructed is noted, and estimates of the time and memory required for their operation are given. The algorithms are shown to be optimal in terms of the number of the transformations used: the algorithms of elimination of useless statements and unwinding of degenerate loops are optimal in the whole class of regular schemes, and the algorithm of removal from loops and hammocks is optimal in the class of irredundant schemes without degenerate subloops. The practical implementation of the algorithms constructed is described.
Similar content being viewed by others
REFERENCES
Babetskii, G.I., Bezhanova, M.M., Voloshin, Yu.M., Ershov, A.P., Zagatskii, B.A., Zmievskaya, L.L., Kozhukhin, G.I., Kozhukhina, S.K., Mikhailevich, Yu.I., Mishkovich, R.D., Pottosin, I.V., and Trokhan, L.K., Al'fa-sistema avtomatizatsii programmirovaniya (Alpha: A System for Programming Automation), Novosibirsk: Nauka, 1967.
Kas'yanov, V.N., Optimiziruyushchie preobrazovaniya programm (Optimizing Transformations of Programs), Moscow: Nauka, 1988.
Pottosin, I.V., Justification of Algorithms for Program Optimization, Programmirovanie, 1979, no. 2, pp. 3–13.
Pottosin, I.V. and Yugrinova, O.V., Justification of Purging Transformations for Loops, Programmirovanie, 1980, no. 5, pp. 8–16.
Pottosin, I.V., A “Good Program:” An Attempt of an Exact Definition of the Term, Programmirovanie, 1997, no. 2, pp. 3–17.
Uvarov, D.L., Purging of Regular Hammocks, in Programmnye sistemy (Programming Systems), Novosibirsk: Institute of Information Systems, Siberian Division, Russian Acad. Sci., 1995, pp. 149–162.
Uvarov, D.L., An Optimal Algorithm for Purging Regular Hammocks, Programmirovanie, 1998, no. 2, pp. 62–80.
Shelekhov, V.I., Graph as a Data Type, in Sreda programmirovaniya: metody i instrumenty (Programming Environment: Methods and Tools), Novosibirsk: Institute of Information Systems, Siberian Division, Russian Acad. Sci., 1992.
Shelekhov, V.I., Structure of a Program in a Language-Oriented Flow Analysis, Programmirovanie, 1996, no. 3, pp. 47–59.
Dharmhere, D.M., Rosen, B.K., and Zadeck, F.K., How to Analyze Large Programs Efficiently and Informatively, Proc. of the ACM SIGPLAN Conf. on Programming Language Design and Implementation'92, ACM SIGPLAN Notices, 1992, vol. 27, no. 7, pp. 212–233.
Drechsler, K.H. and Stadel, M.P., A Solution to a Problem with Morel and Renvoice's “Global Optimization by Suppression of Partial Redundancies,” ACM Trans. Programming Languages and Systems, 1988, vol. 10, no. 4, pp. 635–640.
Knoop, J., Ruthing, O., and Steffen, B., The Power of Assignment Motion, Proc. of the ACM SIGPLAN Conf. on Programming Language Design and Implementation'95, ACM SIGPLAN Notices, 1995, vol. 30, no. 6, pp. 233–243.
Morel, E. and Renvoice, C., Global Optimization by Suppression of Partial Redundancies, Commun. ACM, 1979, vol. 22, no. 2, pp. 96–103.
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Uvarov, D.L. An Optimal Algorithm for Purging Regular Schemes. Programming and Computer Software 26, 306–325 (2000). https://doi.org/10.1023/A:1026652406001
Issue Date:
DOI: https://doi.org/10.1023/A:1026652406001