Skip to main content

An optimizing compiler for CLP(ℛ)

  • Constraint Logic Programming
  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 976))

Abstract

The considerable expressive power and flexibility gained by combining constraint programming with logic programming is not without cost. Implementations of constraint logic programming (CLP) languages must include expensive constraint solving algorithms tailored to specific domains, such as trees, Booleans, or real numbers. The performance of many current CLP compilers and interpreters does not encourage the widespread use of CLP. We outline an optimizing compiler for CLP(ℛ), a CLP language which extends Prolog by allowing linear arithmetic constraints. The compiler uses sophisticated global analyses to determine the applicability of different program transformations. Two important components of the compiler, the analyzer and the optimizer, work in continual interaction in order to apply semantics-preserving transformations to the source program. A large suite of transformations are planned. Currently the compiler applies three powerful transformations, namely “solver bypass”, “dead variable elimination” and “nofail constraint detection”. We explain these optimizations and their place in the overall compiler design and show how they lead to performance improvements on a set of benchmark programs.

This is a preview of subscription content, log in via an institution.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. H. Aït-Kaci. Warren's Abstract Machine: A Tutorial Reconstruction. MIT Press, 1991.

    Google Scholar 

  2. T. Armstrong, K. Marriott, P. Schachte and H. Søndergaard. Boolean functions for dependency analysis: Algebraic properties and efficient representation. In B. Le Charlier, editor, Static Analysis: Proc. First Int. Symp. (Lecture Notes in Computer Science 864), pages 266–280. Springer-Verlag, 1994.

    Google Scholar 

  3. F. Bueno, M. García de la Banda and M. Hermenegildo. Effectiveness of global analysis in strict independence-based automatic parallelization. In Logic Programming: Proc. 1994 Int. Symp., pages 320–336. MIT Press, 1994.

    Google Scholar 

  4. P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proc. Fourth Ann. ACM Symp. Principles of Programming Languages, pages 238–252. ACM Press, 1977.

    Google Scholar 

  5. P. Cousot and R. Cousot. Abstract interpretation and application to logic programs. Journal of Logic Programming 13 (2 & 3): 103–179, 1992.

    Article  Google Scholar 

  6. S. Debray. Static inference of modes and data dependencies in logic programs. ACM Transactions on Programming Languages and Systems 11 (3): 418–450, 1989.

    Article  Google Scholar 

  7. J. Jaffar and M. Maher. Constraint logic programming: A survey. Journal of Logic Programming 19/20: 503–581, 1994.

    Article  Google Scholar 

  8. J. Jaffar, S. Michaylov, P. Stuckey and R. Yap. An abstract machine for CLP(ℛ). Proc. ACM Conf. Programming Language Design and Implementation, pages 128–139. ACM Press, 1992.

    Google Scholar 

  9. J. Jaffar, S. Michaylov, P. Stuckey and R. Yap. The CLP(ℛ) language and system. ACM Transactions on Programming Languages and Systems 14 (3): 339–395, 1992.

    Article  Google Scholar 

  10. N. Jørgensen, K. Marriott and S. Michaylov. Some global compile-time optimizations for CLP(ℛ). In V. Saraswat and K. Ueda, editors, Logic Programming: Proc. 1991 Int. Symp., pages 420–434. MIT Press, 1991.

    Google Scholar 

  11. B. Le Charlier and P. Van Hentenryck. Experimental evaluation of a generic abstract interpretation algorithm for Prolog. ACM Transactions on Programming Languages and Systems 16 (1): 35–101, 1994.

    Article  Google Scholar 

  12. A. Macdonald, P. Stuckey and R. Yap. Redundancy of variables in CLP(ℛ). In Logic Programming: Proc. 1993 Int. Symp., pages 75–93. MIT Press, 1993.

    Google Scholar 

  13. K. Marriott and H. Søndergaard. Analysis of constraint logic programs. In S. Debray and M. Hermenegildo, Logic Programming: Proc. North American Conf. 1990, pages 531–547. MIT Press, 1990.

    Google Scholar 

  14. K. Marriott, H. Søndergaard, P. Stuckey and R. Yap. Optimizing compilation for CLP(ℛ). In G. Gupta, editor, Proc. Seventeenth Australian Computer Science Conf., Australian Computer Science Comm. 16 (1): 551–560, 1994.

    Google Scholar 

  15. K. Marriott and P. Stuckey. The 3 R's of optimizing constraint logic programs: Refinement, removal and reordering. Proc. Twentieth ACM Symp. Principles of Programming Languages, pages 334–344. ACM Press, 1993.

    Google Scholar 

  16. K. Muthukumar and M. Hermenegildo. Compile-time derivation of variable dependency using abstract interpretation. Journal of Logic Programming 13 (2 & 3): 315–347, 1992.

    Article  Google Scholar 

  17. H. Søndergaard. An application of abstract interpretation of logic programs: Occur check reduction. In B. Robinet and R. Wilhelm, editors, Proc. ESOP 86 (Lecture Notes in Computer Science 213), pages 327–338. Springer-Verlag, 1986.

    Google Scholar 

  18. A. Taylor. LIPS on a MIPS: Results from a Prolog compiler for a RISC. In D. Warren and P. Szeredi, editors, Logic Programming: Proc. Seventh Int. Conf., pages 174–185. MIT Press, 1990.

    Google Scholar 

  19. P. van Roy and A. Despain. The benefits of global dataflow analysis for an optimizing Prolog compiler. In S. Debray and M. Hermenegildo, editors, Logic Programming: Proc. North American Conf. 1990, pages 501–515. MIT Press, 1990.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Ugo Montanari Francesca Rossi

Rights and permissions

Reprints and permissions

Copyright information

© 1995 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kelly, A.D., Macdonald, A., Marriott, K., Søndergaard, H., Stuckey, P.J., Yap, R.H.C. (1995). An optimizing compiler for CLP(ℛ). In: Montanari, U., Rossi, F. (eds) Principles and Practice of Constraint Programming — CP '95. CP 1995. Lecture Notes in Computer Science, vol 976. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60299-2_14

Download citation

  • DOI: https://doi.org/10.1007/3-540-60299-2_14

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-60299-6

  • Online ISBN: 978-3-540-44788-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics