An Optimal Algorithm for Purging Regular Schemes

  • Authors:
  • D. L. Uvarov

  • Affiliations:
  • Ershov Institute of Information Systems, Siberian Division, Russian Academy of Sciences, pr. Akademika Lavrent'eva 6, Novosibirsk, 630090 Russia

  • Venue:
  • Programming and Computing Software
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

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.