Abstract
The paper considers methods of program transformation equivalent to optimizing the cycle invariant, applied to the functional data-flow model implemented in the Pifagor programming language. Optimization of the cycle invariant in imperative programming languages is reduced to a displacement from the cycle of computations that do not depend on variables that are changes in the loop. A feature of the functional data flow parallel programming language Pifagor is the absence of explicitly specified cyclic computations (the loop operator). However, recurring calculations in this language can be specified recursively or by applying specific language constructs (parallel lists). Both mechanisms provide the possibility of parallel execution. In the case of optimizing a recursive function, repeated calculations are carried out into an auxiliary function, the main function performing only the calculation of the invariant. When optimizing the invariant in computations over parallel lists, the calculation of the invariant moves from the function that executes over the list items to the function containing the call. The paper provides a definition of “invariant” applied to the Pifagor language, algorithms for its optimization, and examples of program source codes, their graph representations (the program dependence graph) before and after optimization. The algorithm shown for computations over parallel lists is applicable only to the Pifagor language, because it rests upon specific data structures and the computational model of this language. However, the algorithm for transforming recursive functions may be applied to other programming languages.
Similar content being viewed by others
REFERENCES
Aho, A.V., Lam, M.S., Ravi Sethi, and Ullman, J.D., Compilers: Principles, Techniques, and Tools, 2006, Addison Wesley, 2nd ed.
Dortman, P.A., Program optimization in SFP, in Programmnye sredstva i matematicheskie osnovy informatiki (Software Tools and Mathematical Foundations of Informatics), Novosibirsk, 2004, pp. 43–49.
Legalov, A.I., Matkovsky, I.V., Kropacheva, M.S., Udalova, Y.V., and Vasilev, V.M., Technological aspects of creating, converting and executing functional data-flow parallel programs, Scientific Service on the Internet: All Facets of Parallelism: Proceedings of the International Supercomputer Conference, Moscow, 2013, pp. 443–447.
Legalov, A.I., Vasilyev, V.S., Matkovskii, I.V., and Ushakova, M.S., Support tools for creation and transformation of functional-dataflow parallel programs, Tr. Inst. Sist. Progr. Ross. Akad. Nauk, 2017, vol. 29, no. 5, pp. 165–184.
Legalov, A.I., Functional language for creating of architectural independent parallel programs Comput. Technol., 2005, vol. 10, no. 1, pp. 71–89.
ACKNOWLEDGMENTS
The research is supported by RFBR (research project no. 17-07-00288).
Author information
Authors and Affiliations
Corresponding authors
Additional information
The article was translated by the authors.
About this article
Cite this article
Vasilev, V.S., Legalov, A.I. Loop-invariant Optimization in the Pifagor Language. Aut. Control Comp. Sci. 52, 843–849 (2018). https://doi.org/10.3103/S0146411618070295
Received:
Published:
Issue Date:
DOI: https://doi.org/10.3103/S0146411618070295