From 33ad93b9f4cb21a19b8cf60c77344bc1c9bdff6d Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Mon, 2 Jul 2012 11:43:46 +0000 Subject: [PATCH] cloog.m4: Set up to work against ISL only. 2012-07-02 Richard Guenther Michael Matz Tobias Grosser Sebastian Pop config/ * cloog.m4: Set up to work against ISL only. * isl.m4: New file. * Makefile.def: Add ISL host module, remove PPL host module. Adjust ClooG host module to use the proper ISL. * Makefile.tpl: Pass ISL include flags instead of PPL ones. * configure.ac: Include config/isl.m4. Add ISL host library, remove PPL. Remove PPL configury, add ISL configury, adjust ClooG configury. * Makefile.in: Regenerated. * configure: Likewise. gcc/ * Makefile.in: Remove PPL flags in favor of ISL ones. (BACKENDLIBS): Remove PPL libs. (INCLUDES): Remove PPL includes in favor of ISL ones. (graphite-clast-to-gimple.o): Remove graphite-dependences.h and graphite-cloog-compat.h dependencies. (graphite-dependences.o): Likewise. (graphite-poly.o): Likewise. * configure.ac: Declare ISL vars instead of PPL ones. * configure: Regenerated. * doc/install.texi: Replace PPL requirement documentation with ISL one. * graphite-blocking.c: Remove PPL code, add ISL equivalent. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-poly.h: Likewise. * graphite-poly.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * graphite-scop-detection.c: Re-arrange includes. * graphite-cloog-util.c: Remove. * graphite-cloog-util.h: Likewise. * graphite-ppl.h: Likewise. * graphite-ppl.c: Likewise. * graphite-dependences.h: Likewise. libgomp/ * testsuite/libgomp.graphite/force-parallel-4.c: Adjust. * testsuite/libgomp.graphite/force-parallel-5.c: Likewise. * testsuite/libgomp.graphite/force-parallel-7.c: Likewise. * testsuite/libgomp.graphite/force-parallel-8.c: Likewise. Co-Authored-By: Michael Matz Co-Authored-By: Sebastian Pop Co-Authored-By: Tobias Grosser From-SVN: r189156 --- ChangeLog | 14 + Makefile.def | 19 +- Makefile.in | 1158 +++++++------- Makefile.tpl | 8 +- config/ChangeLog | 8 + config/cloog.m4 | 71 +- configure | 404 +++-- configure.ac | 112 +- gcc/ChangeLog | 31 + gcc/Makefile.in | 37 +- gcc/configure | 12 +- gcc/configure.ac | 4 +- gcc/doc/install.texi | 16 +- gcc/graphite-blocking.c | 81 +- gcc/graphite-clast-to-gimple.c | 365 +++-- gcc/graphite-clast-to-gimple.h | 2 - gcc/graphite-cloog-util.c | 409 ----- gcc/graphite-cloog-util.h | 41 - gcc/graphite-dependences.c | 1377 +++++++---------- gcc/graphite-dependences.h | 64 - gcc/graphite-interchange.c | 391 ++--- gcc/graphite-poly.c | 1033 +++---------- gcc/graphite-poly.h | 251 ++- gcc/graphite-ppl.c | 566 ------- gcc/graphite-ppl.h | 176 --- gcc/graphite-scop-detection.c | 13 +- gcc/graphite-sese-to-poly.c | 1227 +++++++-------- gcc/graphite.c | 38 +- libgomp/ChangeLog | 10 + .../libgomp.graphite/force-parallel-4.c | 1 + .../libgomp.graphite/force-parallel-5.c | 2 +- .../libgomp.graphite/force-parallel-7.c | 21 +- .../libgomp.graphite/force-parallel-8.c | 16 +- 33 files changed, 2752 insertions(+), 5226 deletions(-) delete mode 100644 gcc/graphite-cloog-util.c delete mode 100644 gcc/graphite-cloog-util.h delete mode 100644 gcc/graphite-dependences.h delete mode 100644 gcc/graphite-ppl.c delete mode 100644 gcc/graphite-ppl.h diff --git a/ChangeLog b/ChangeLog index 1231a3dd41d..f32899f37be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2012-07-02 Richard Guenther + Michael Matz + Tobias Grosser + Sebastian Pop + + * Makefile.def: Add ISL host module, remove PPL host module. + Adjust ClooG host module to use the proper ISL. + * Makefile.tpl: Pass ISL include flags instead of PPL ones. + * configure.ac: Include config/isl.m4. Add ISL host library, + remove PPL. Remove PPL configury, add ISL configury, adjust + ClooG configury. + * Makefile.in: Regenerated. + * configure: Likewise. + 2012-07-02 Richard Guenther Merge from graphite branch diff --git a/Makefile.def b/Makefile.def index 24aadc93bc8..3969bf6a4d2 100644 --- a/Makefile.def +++ b/Makefile.def @@ -61,13 +61,15 @@ host_modules= { module= mpfr; lib_path=.libs; bootstrap=true; host_modules= { module= mpc; lib_path=.libs; bootstrap=true; extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@'; no_install= true; }; -host_modules= { module= ppl; lib_path=src/.libs; bootstrap=true; - extra_configure_flags='--disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/'; +host_modules= { module= isl; lib_path=.libs; bootstrap=true; + extra_configure_flags='--disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp'; + extra_exports='CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; '; + extra_make_flags='CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"'; no_install= true; }; host_modules= { module= cloog; lib_path=.libs; bootstrap=true; - extra_configure_flags='--disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl'; - extra_exports='CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; '; - extra_make_flags='CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"'; + extra_configure_flags='--disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system'; + extra_exports='CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; '; + extra_make_flags='CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"'; no_install= true; }; host_modules= { module= libelf; lib_path=.libs; bootstrap=true; extra_configure_flags='--disable-shared'; @@ -295,7 +297,6 @@ dependencies = { module=all-gcc; on=all-gmp; }; dependencies = { module=all-gcc; on=all-intl; }; dependencies = { module=all-gcc; on=all-mpfr; }; dependencies = { module=all-gcc; on=all-mpc; }; -dependencies = { module=all-gcc; on=all-ppl; }; dependencies = { module=all-gcc; on=all-cloog; }; dependencies = { module=all-gcc; on=all-build-texinfo; }; dependencies = { module=all-gcc; on=all-build-bison; }; @@ -332,9 +333,9 @@ dependencies = { module=all-utils; on=all-libiberty; }; dependencies = { module=configure-mpfr; on=all-gmp; }; dependencies = { module=configure-mpc; on=all-mpfr; }; -dependencies = { module=configure-ppl; on=all-gmp; }; -dependencies = { module=configure-ppl; on=all-mpfr; }; -dependencies = { module=configure-cloog; on=all-ppl; }; +dependencies = { module=configure-isl; on=all-gmp; }; +dependencies = { module=configure-cloog; on=all-isl; }; +dependencies = { module=configure-cloog; on=all-gmp; }; // Host modules specific to gdb. dependencies = { module=configure-gdb; on=all-intl; }; diff --git a/Makefile.in b/Makefile.in index f66791b457a..0be7e479a78 100644 --- a/Makefile.in +++ b/Makefile.in @@ -219,8 +219,7 @@ HOST_EXPORTS = \ HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \ GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \ - PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \ - PPLINC="$(HOST_PPLINC)"; export PPLINC; \ + ISLINC="$(HOST_ISLINC)"; export ISLINC; \ CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \ CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \ LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \ @@ -310,9 +309,8 @@ NORMAL_TARGET_EXPORTS = \ HOST_GMPLIBS = @gmplibs@ HOST_GMPINC = @gmpinc@ -# Where to find PPL -HOST_PPLLIBS = @ppllibs@ -HOST_PPLINC = @pplinc@ +# Where to find ISL +HOST_ISLINC = @islinc@ # Where to find CLOOG HOST_CLOOGLIBS = @clooglibs@ @@ -629,7 +627,7 @@ TARGET_LIB_PATH_libatomic = $$r/$(TARGET_SUBDIR)/libatomic/.libs: # This is the list of directories that may be needed in RPATH_ENVVAR # so that programs built for the host machine work. -HOST_LIB_PATH = $(HOST_LIB_PATH_bfd)$(HOST_LIB_PATH_opcodes)$(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_ppl)$(HOST_LIB_PATH_cloog)$(HOST_LIB_PATH_libelf) +HOST_LIB_PATH = $(HOST_LIB_PATH_bfd)$(HOST_LIB_PATH_opcodes)$(HOST_LIB_PATH_gmp)$(HOST_LIB_PATH_mpfr)$(HOST_LIB_PATH_mpc)$(HOST_LIB_PATH_isl)$(HOST_LIB_PATH_cloog)$(HOST_LIB_PATH_libelf) # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch @if gcc @@ -662,10 +660,10 @@ HOST_LIB_PATH_mpc = \ $$r/$(HOST_SUBDIR)/mpc/.libs:$$r/$(HOST_SUBDIR)/prev-mpc/.libs: @endif mpc -@if ppl -HOST_LIB_PATH_ppl = \ - $$r/$(HOST_SUBDIR)/ppl/src/.libs:$$r/$(HOST_SUBDIR)/prev-ppl/src/.libs: -@endif ppl +@if isl +HOST_LIB_PATH_isl = \ + $$r/$(HOST_SUBDIR)/isl/.libs:$$r/$(HOST_SUBDIR)/prev-isl/.libs: +@endif isl @if cloog HOST_LIB_PATH_cloog = \ @@ -915,7 +913,7 @@ configure-host: \ maybe-configure-gmp \ maybe-configure-mpfr \ maybe-configure-mpc \ - maybe-configure-ppl \ + maybe-configure-isl \ maybe-configure-cloog \ maybe-configure-libelf \ maybe-configure-gold \ @@ -1034,9 +1032,9 @@ all-host: maybe-all-mpfr @if mpc-no-bootstrap all-host: maybe-all-mpc @endif mpc-no-bootstrap -@if ppl-no-bootstrap -all-host: maybe-all-ppl -@endif ppl-no-bootstrap +@if isl-no-bootstrap +all-host: maybe-all-isl +@endif isl-no-bootstrap @if cloog-no-bootstrap all-host: maybe-all-cloog @endif cloog-no-bootstrap @@ -1146,7 +1144,7 @@ info-host: maybe-info-gcc info-host: maybe-info-gmp info-host: maybe-info-mpfr info-host: maybe-info-mpc -info-host: maybe-info-ppl +info-host: maybe-info-isl info-host: maybe-info-cloog info-host: maybe-info-libelf info-host: maybe-info-gold @@ -1225,7 +1223,7 @@ dvi-host: maybe-dvi-gcc dvi-host: maybe-dvi-gmp dvi-host: maybe-dvi-mpfr dvi-host: maybe-dvi-mpc -dvi-host: maybe-dvi-ppl +dvi-host: maybe-dvi-isl dvi-host: maybe-dvi-cloog dvi-host: maybe-dvi-libelf dvi-host: maybe-dvi-gold @@ -1304,7 +1302,7 @@ pdf-host: maybe-pdf-gcc pdf-host: maybe-pdf-gmp pdf-host: maybe-pdf-mpfr pdf-host: maybe-pdf-mpc -pdf-host: maybe-pdf-ppl +pdf-host: maybe-pdf-isl pdf-host: maybe-pdf-cloog pdf-host: maybe-pdf-libelf pdf-host: maybe-pdf-gold @@ -1383,7 +1381,7 @@ html-host: maybe-html-gcc html-host: maybe-html-gmp html-host: maybe-html-mpfr html-host: maybe-html-mpc -html-host: maybe-html-ppl +html-host: maybe-html-isl html-host: maybe-html-cloog html-host: maybe-html-libelf html-host: maybe-html-gold @@ -1462,7 +1460,7 @@ TAGS-host: maybe-TAGS-gcc TAGS-host: maybe-TAGS-gmp TAGS-host: maybe-TAGS-mpfr TAGS-host: maybe-TAGS-mpc -TAGS-host: maybe-TAGS-ppl +TAGS-host: maybe-TAGS-isl TAGS-host: maybe-TAGS-cloog TAGS-host: maybe-TAGS-libelf TAGS-host: maybe-TAGS-gold @@ -1541,7 +1539,7 @@ install-info-host: maybe-install-info-gcc install-info-host: maybe-install-info-gmp install-info-host: maybe-install-info-mpfr install-info-host: maybe-install-info-mpc -install-info-host: maybe-install-info-ppl +install-info-host: maybe-install-info-isl install-info-host: maybe-install-info-cloog install-info-host: maybe-install-info-libelf install-info-host: maybe-install-info-gold @@ -1620,7 +1618,7 @@ install-pdf-host: maybe-install-pdf-gcc install-pdf-host: maybe-install-pdf-gmp install-pdf-host: maybe-install-pdf-mpfr install-pdf-host: maybe-install-pdf-mpc -install-pdf-host: maybe-install-pdf-ppl +install-pdf-host: maybe-install-pdf-isl install-pdf-host: maybe-install-pdf-cloog install-pdf-host: maybe-install-pdf-libelf install-pdf-host: maybe-install-pdf-gold @@ -1699,7 +1697,7 @@ install-html-host: maybe-install-html-gcc install-html-host: maybe-install-html-gmp install-html-host: maybe-install-html-mpfr install-html-host: maybe-install-html-mpc -install-html-host: maybe-install-html-ppl +install-html-host: maybe-install-html-isl install-html-host: maybe-install-html-cloog install-html-host: maybe-install-html-libelf install-html-host: maybe-install-html-gold @@ -1778,7 +1776,7 @@ installcheck-host: maybe-installcheck-gcc installcheck-host: maybe-installcheck-gmp installcheck-host: maybe-installcheck-mpfr installcheck-host: maybe-installcheck-mpc -installcheck-host: maybe-installcheck-ppl +installcheck-host: maybe-installcheck-isl installcheck-host: maybe-installcheck-cloog installcheck-host: maybe-installcheck-libelf installcheck-host: maybe-installcheck-gold @@ -1857,7 +1855,7 @@ mostlyclean-host: maybe-mostlyclean-gcc mostlyclean-host: maybe-mostlyclean-gmp mostlyclean-host: maybe-mostlyclean-mpfr mostlyclean-host: maybe-mostlyclean-mpc -mostlyclean-host: maybe-mostlyclean-ppl +mostlyclean-host: maybe-mostlyclean-isl mostlyclean-host: maybe-mostlyclean-cloog mostlyclean-host: maybe-mostlyclean-libelf mostlyclean-host: maybe-mostlyclean-gold @@ -1936,7 +1934,7 @@ clean-host: maybe-clean-gcc clean-host: maybe-clean-gmp clean-host: maybe-clean-mpfr clean-host: maybe-clean-mpc -clean-host: maybe-clean-ppl +clean-host: maybe-clean-isl clean-host: maybe-clean-cloog clean-host: maybe-clean-libelf clean-host: maybe-clean-gold @@ -2015,7 +2013,7 @@ distclean-host: maybe-distclean-gcc distclean-host: maybe-distclean-gmp distclean-host: maybe-distclean-mpfr distclean-host: maybe-distclean-mpc -distclean-host: maybe-distclean-ppl +distclean-host: maybe-distclean-isl distclean-host: maybe-distclean-cloog distclean-host: maybe-distclean-libelf distclean-host: maybe-distclean-gold @@ -2094,7 +2092,7 @@ maintainer-clean-host: maybe-maintainer-clean-gcc maintainer-clean-host: maybe-maintainer-clean-gmp maintainer-clean-host: maybe-maintainer-clean-mpfr maintainer-clean-host: maybe-maintainer-clean-mpc -maintainer-clean-host: maybe-maintainer-clean-ppl +maintainer-clean-host: maybe-maintainer-clean-isl maintainer-clean-host: maybe-maintainer-clean-cloog maintainer-clean-host: maybe-maintainer-clean-libelf maintainer-clean-host: maybe-maintainer-clean-gold @@ -2228,7 +2226,7 @@ check-host: \ maybe-check-gmp \ maybe-check-mpfr \ maybe-check-mpc \ - maybe-check-ppl \ + maybe-check-isl \ maybe-check-cloog \ maybe-check-libelf \ maybe-check-gold \ @@ -2333,7 +2331,7 @@ install-host-nogcc: \ maybe-install-gmp \ maybe-install-mpfr \ maybe-install-mpc \ - maybe-install-ppl \ + maybe-install-isl \ maybe-install-cloog \ maybe-install-libelf \ maybe-install-gold \ @@ -2379,7 +2377,7 @@ install-host: \ maybe-install-gmp \ maybe-install-mpfr \ maybe-install-mpc \ - maybe-install-ppl \ + maybe-install-isl \ maybe-install-cloog \ maybe-install-libelf \ maybe-install-gold \ @@ -2478,7 +2476,7 @@ install-strip-host: \ maybe-install-strip-gmp \ maybe-install-strip-mpfr \ maybe-install-strip-mpc \ - maybe-install-strip-ppl \ + maybe-install-strip-isl \ maybe-install-strip-cloog \ maybe-install-strip-libelf \ maybe-install-strip-gold \ @@ -13019,276 +13017,276 @@ maintainer-clean-mpc: -.PHONY: configure-ppl maybe-configure-ppl -maybe-configure-ppl: +.PHONY: configure-isl maybe-configure-isl +maybe-configure-isl: @if gcc-bootstrap -configure-ppl: stage_current +configure-isl: stage_current @endif gcc-bootstrap -@if ppl -maybe-configure-ppl: configure-ppl -configure-ppl: +@if isl +maybe-configure-isl: configure-isl +configure-isl: @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - $(HOST_EXPORTS) \ - echo Configuring in $(HOST_SUBDIR)/ppl; \ - cd "$(HOST_SUBDIR)/ppl" || exit 1; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + $(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring in $(HOST_SUBDIR)/isl; \ + cd "$(HOST_SUBDIR)/isl" || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} $${srcdiroption} --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ \ + --target=${target_alias} $${srcdiroption} --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp \ || exit 1 -@endif ppl +@endif isl -.PHONY: configure-stage1-ppl maybe-configure-stage1-ppl -maybe-configure-stage1-ppl: -@if ppl-bootstrap -maybe-configure-stage1-ppl: configure-stage1-ppl -configure-stage1-ppl: +.PHONY: configure-stage1-isl maybe-configure-stage1-isl +maybe-configure-stage1-isl: +@if isl-bootstrap +maybe-configure-stage1-isl: configure-stage1-isl +configure-stage1-isl: @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start - @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE1_TFLAGS)"; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ $(HOST_EXPORTS) \ CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; \ - echo Configuring stage 1 in $(HOST_SUBDIR)/ppl ; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - cd $(HOST_SUBDIR)/ppl || exit 1; \ + LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring stage 1 in $(HOST_SUBDIR)/isl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + cd $(HOST_SUBDIR)/isl || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ -@endif ppl-bootstrap + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp +@endif isl-bootstrap -.PHONY: configure-stage2-ppl maybe-configure-stage2-ppl -maybe-configure-stage2-ppl: -@if ppl-bootstrap -maybe-configure-stage2-ppl: configure-stage2-ppl -configure-stage2-ppl: +.PHONY: configure-stage2-isl maybe-configure-stage2-isl +maybe-configure-stage2-isl: +@if isl-bootstrap +maybe-configure-stage2-isl: configure-stage2-isl +configure-stage2-isl: @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start - @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE2_TFLAGS)"; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ $(HOST_EXPORTS) \ $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; \ - echo Configuring stage 2 in $(HOST_SUBDIR)/ppl ; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - cd $(HOST_SUBDIR)/ppl || exit 1; \ + LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring stage 2 in $(HOST_SUBDIR)/isl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + cd $(HOST_SUBDIR)/isl || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ -@endif ppl-bootstrap + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp +@endif isl-bootstrap -.PHONY: configure-stage3-ppl maybe-configure-stage3-ppl -maybe-configure-stage3-ppl: -@if ppl-bootstrap -maybe-configure-stage3-ppl: configure-stage3-ppl -configure-stage3-ppl: +.PHONY: configure-stage3-isl maybe-configure-stage3-isl +maybe-configure-stage3-isl: +@if isl-bootstrap +maybe-configure-stage3-isl: configure-stage3-isl +configure-stage3-isl: @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start - @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE3_TFLAGS)"; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ $(HOST_EXPORTS) \ $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE3_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; \ - echo Configuring stage 3 in $(HOST_SUBDIR)/ppl ; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - cd $(HOST_SUBDIR)/ppl || exit 1; \ + LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring stage 3 in $(HOST_SUBDIR)/isl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + cd $(HOST_SUBDIR)/isl || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ -@endif ppl-bootstrap + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp +@endif isl-bootstrap -.PHONY: configure-stage4-ppl maybe-configure-stage4-ppl -maybe-configure-stage4-ppl: -@if ppl-bootstrap -maybe-configure-stage4-ppl: configure-stage4-ppl -configure-stage4-ppl: +.PHONY: configure-stage4-isl maybe-configure-stage4-isl +maybe-configure-stage4-isl: +@if isl-bootstrap +maybe-configure-stage4-isl: configure-stage4-isl +configure-stage4-isl: @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start - @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE4_TFLAGS)"; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ $(HOST_EXPORTS) \ $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE4_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; \ - echo Configuring stage 4 in $(HOST_SUBDIR)/ppl ; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - cd $(HOST_SUBDIR)/ppl || exit 1; \ + LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring stage 4 in $(HOST_SUBDIR)/isl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + cd $(HOST_SUBDIR)/isl || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ -@endif ppl-bootstrap + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp +@endif isl-bootstrap -.PHONY: configure-stageprofile-ppl maybe-configure-stageprofile-ppl -maybe-configure-stageprofile-ppl: -@if ppl-bootstrap -maybe-configure-stageprofile-ppl: configure-stageprofile-ppl -configure-stageprofile-ppl: +.PHONY: configure-stageprofile-isl maybe-configure-stageprofile-isl +maybe-configure-stageprofile-isl: +@if isl-bootstrap +maybe-configure-stageprofile-isl: configure-stageprofile-isl +configure-stageprofile-isl: @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start - @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGEprofile_TFLAGS)"; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ $(HOST_EXPORTS) \ $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGEprofile_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; \ - echo Configuring stage profile in $(HOST_SUBDIR)/ppl ; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - cd $(HOST_SUBDIR)/ppl || exit 1; \ + LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring stage profile in $(HOST_SUBDIR)/isl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + cd $(HOST_SUBDIR)/isl || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ -@endif ppl-bootstrap + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp +@endif isl-bootstrap -.PHONY: configure-stagefeedback-ppl maybe-configure-stagefeedback-ppl -maybe-configure-stagefeedback-ppl: -@if ppl-bootstrap -maybe-configure-stagefeedback-ppl: configure-stagefeedback-ppl -configure-stagefeedback-ppl: +.PHONY: configure-stagefeedback-isl maybe-configure-stagefeedback-isl +maybe-configure-stagefeedback-isl: +@if isl-bootstrap +maybe-configure-stagefeedback-isl: configure-stagefeedback-isl +configure-stagefeedback-isl: @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start - @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl + @$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGEfeedback_TFLAGS)"; \ - test ! -f $(HOST_SUBDIR)/ppl/Makefile || exit 0; \ + test ! -f $(HOST_SUBDIR)/isl/Makefile || exit 0; \ $(HOST_EXPORTS) \ $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGEfeedback_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; \ - echo Configuring stage feedback in $(HOST_SUBDIR)/ppl ; \ - $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/ppl ; \ - cd $(HOST_SUBDIR)/ppl || exit 1; \ + LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + echo Configuring stage feedback in $(HOST_SUBDIR)/isl ; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/isl ; \ + cd $(HOST_SUBDIR)/isl || exit 1; \ case $(srcdir) in \ /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ - *) topdir=`echo $(HOST_SUBDIR)/ppl/ | \ + *) topdir=`echo $(HOST_SUBDIR)/isl/ | \ sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ esac; \ - srcdiroption="--srcdir=$${topdir}/ppl"; \ - libsrcdir="$$s/ppl"; \ + srcdiroption="--srcdir=$${topdir}/isl"; \ + libsrcdir="$$s/isl"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/ -@endif ppl-bootstrap + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp +@endif isl-bootstrap -.PHONY: all-ppl maybe-all-ppl -maybe-all-ppl: +.PHONY: all-isl maybe-all-isl +maybe-all-isl: @if gcc-bootstrap -all-ppl: stage_current +all-isl: stage_current @endif gcc-bootstrap -@if ppl -TARGET-ppl=all -maybe-all-ppl: all-ppl -all-ppl: configure-ppl +@if isl +TARGET-isl=all +maybe-all-isl: all-isl +all-isl: configure-isl @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) \ - (cd $(HOST_SUBDIR)/ppl && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) \ - $(TARGET-ppl)) -@endif ppl + $(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + (cd $(HOST_SUBDIR)/isl && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ + $(TARGET-isl)) +@endif isl -.PHONY: all-stage1-ppl maybe-all-stage1-ppl -.PHONY: clean-stage1-ppl maybe-clean-stage1-ppl -maybe-all-stage1-ppl: -maybe-clean-stage1-ppl: -@if ppl-bootstrap -maybe-all-stage1-ppl: all-stage1-ppl -all-stage1: all-stage1-ppl -TARGET-stage1-ppl = $(TARGET-ppl) -all-stage1-ppl: configure-stage1-ppl +.PHONY: all-stage1-isl maybe-all-stage1-isl +.PHONY: clean-stage1-isl maybe-clean-stage1-isl +maybe-all-stage1-isl: +maybe-clean-stage1-isl: +@if isl-bootstrap +maybe-all-stage1-isl: all-stage1-isl +all-stage1: all-stage1-isl +TARGET-stage1-isl = $(TARGET-isl) +all-stage1-isl: configure-stage1-isl @[ $(current_stage) = stage1 ] || $(MAKE) stage1-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE1_TFLAGS)"; \ - $(HOST_EXPORTS) \ - cd $(HOST_SUBDIR)/ppl && \ + $(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE1_CFLAGS)" \ CXXFLAGS="$(STAGE1_CXXFLAGS)" \ @@ -13296,41 +13294,41 @@ all-stage1-ppl: configure-stage1-ppl CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) \ + $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE1_TFLAGS)" \ - $(TARGET-stage1-ppl) + $(TARGET-stage1-isl) -maybe-clean-stage1-ppl: clean-stage1-ppl -clean-stage1: clean-stage1-ppl -clean-stage1-ppl: +maybe-clean-stage1-isl: clean-stage1-isl +clean-stage1: clean-stage1-isl +clean-stage1-isl: @if [ $(current_stage) = stage1 ]; then \ - [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \ else \ - [ -f $(HOST_SUBDIR)/stage1-ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/stage1-isl/Makefile ] || exit 0; \ $(MAKE) stage1-start; \ fi; \ - cd $(HOST_SUBDIR)/ppl && \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ - clean -@endif ppl-bootstrap + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean +@endif isl-bootstrap -.PHONY: all-stage2-ppl maybe-all-stage2-ppl -.PHONY: clean-stage2-ppl maybe-clean-stage2-ppl -maybe-all-stage2-ppl: -maybe-clean-stage2-ppl: -@if ppl-bootstrap -maybe-all-stage2-ppl: all-stage2-ppl -all-stage2: all-stage2-ppl -TARGET-stage2-ppl = $(TARGET-ppl) -all-stage2-ppl: configure-stage2-ppl +.PHONY: all-stage2-isl maybe-all-stage2-isl +.PHONY: clean-stage2-isl maybe-clean-stage2-isl +maybe-all-stage2-isl: +maybe-clean-stage2-isl: +@if isl-bootstrap +maybe-all-stage2-isl: all-stage2-isl +all-stage2: all-stage2-isl +TARGET-stage2-isl = $(TARGET-isl) +all-stage2-isl: configure-stage2-isl @[ $(current_stage) = stage2 ] || $(MAKE) stage2-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE2_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) \ - cd $(HOST_SUBDIR)/ppl && \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE2_CFLAGS)" \ CXXFLAGS="$(STAGE2_CXXFLAGS)" \ @@ -13338,42 +13336,42 @@ all-stage2-ppl: configure-stage2-ppl CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE2_TFLAGS)" \ - $(TARGET-stage2-ppl) + $(TARGET-stage2-isl) -maybe-clean-stage2-ppl: clean-stage2-ppl -clean-stage2: clean-stage2-ppl -clean-stage2-ppl: +maybe-clean-stage2-isl: clean-stage2-isl +clean-stage2: clean-stage2-isl +clean-stage2-isl: @if [ $(current_stage) = stage2 ]; then \ - [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \ else \ - [ -f $(HOST_SUBDIR)/stage2-ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/stage2-isl/Makefile ] || exit 0; \ $(MAKE) stage2-start; \ fi; \ - cd $(HOST_SUBDIR)/ppl && \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - clean -@endif ppl-bootstrap + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean +@endif isl-bootstrap -.PHONY: all-stage3-ppl maybe-all-stage3-ppl -.PHONY: clean-stage3-ppl maybe-clean-stage3-ppl -maybe-all-stage3-ppl: -maybe-clean-stage3-ppl: -@if ppl-bootstrap -maybe-all-stage3-ppl: all-stage3-ppl -all-stage3: all-stage3-ppl -TARGET-stage3-ppl = $(TARGET-ppl) -all-stage3-ppl: configure-stage3-ppl +.PHONY: all-stage3-isl maybe-all-stage3-isl +.PHONY: clean-stage3-isl maybe-clean-stage3-isl +maybe-all-stage3-isl: +maybe-clean-stage3-isl: +@if isl-bootstrap +maybe-all-stage3-isl: all-stage3-isl +all-stage3: all-stage3-isl +TARGET-stage3-isl = $(TARGET-isl) +all-stage3-isl: configure-stage3-isl @[ $(current_stage) = stage3 ] || $(MAKE) stage3-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE3_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) \ - cd $(HOST_SUBDIR)/ppl && \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE3_CFLAGS)" \ CXXFLAGS="$(STAGE3_CXXFLAGS)" \ @@ -13381,42 +13379,42 @@ all-stage3-ppl: configure-stage3-ppl CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE3_TFLAGS)" \ - $(TARGET-stage3-ppl) + $(TARGET-stage3-isl) -maybe-clean-stage3-ppl: clean-stage3-ppl -clean-stage3: clean-stage3-ppl -clean-stage3-ppl: +maybe-clean-stage3-isl: clean-stage3-isl +clean-stage3: clean-stage3-isl +clean-stage3-isl: @if [ $(current_stage) = stage3 ]; then \ - [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \ else \ - [ -f $(HOST_SUBDIR)/stage3-ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/stage3-isl/Makefile ] || exit 0; \ $(MAKE) stage3-start; \ fi; \ - cd $(HOST_SUBDIR)/ppl && \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - clean -@endif ppl-bootstrap + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean +@endif isl-bootstrap -.PHONY: all-stage4-ppl maybe-all-stage4-ppl -.PHONY: clean-stage4-ppl maybe-clean-stage4-ppl -maybe-all-stage4-ppl: -maybe-clean-stage4-ppl: -@if ppl-bootstrap -maybe-all-stage4-ppl: all-stage4-ppl -all-stage4: all-stage4-ppl -TARGET-stage4-ppl = $(TARGET-ppl) -all-stage4-ppl: configure-stage4-ppl +.PHONY: all-stage4-isl maybe-all-stage4-isl +.PHONY: clean-stage4-isl maybe-clean-stage4-isl +maybe-all-stage4-isl: +maybe-clean-stage4-isl: +@if isl-bootstrap +maybe-all-stage4-isl: all-stage4-isl +all-stage4: all-stage4-isl +TARGET-stage4-isl = $(TARGET-isl) +all-stage4-isl: configure-stage4-isl @[ $(current_stage) = stage4 ] || $(MAKE) stage4-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE4_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) \ - cd $(HOST_SUBDIR)/ppl && \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE4_CFLAGS)" \ CXXFLAGS="$(STAGE4_CXXFLAGS)" \ @@ -13424,42 +13422,42 @@ all-stage4-ppl: configure-stage4-ppl CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE4_TFLAGS)" \ - $(TARGET-stage4-ppl) + $(TARGET-stage4-isl) -maybe-clean-stage4-ppl: clean-stage4-ppl -clean-stage4: clean-stage4-ppl -clean-stage4-ppl: +maybe-clean-stage4-isl: clean-stage4-isl +clean-stage4: clean-stage4-isl +clean-stage4-isl: @if [ $(current_stage) = stage4 ]; then \ - [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \ else \ - [ -f $(HOST_SUBDIR)/stage4-ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/stage4-isl/Makefile ] || exit 0; \ $(MAKE) stage4-start; \ fi; \ - cd $(HOST_SUBDIR)/ppl && \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - clean -@endif ppl-bootstrap + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean +@endif isl-bootstrap -.PHONY: all-stageprofile-ppl maybe-all-stageprofile-ppl -.PHONY: clean-stageprofile-ppl maybe-clean-stageprofile-ppl -maybe-all-stageprofile-ppl: -maybe-clean-stageprofile-ppl: -@if ppl-bootstrap -maybe-all-stageprofile-ppl: all-stageprofile-ppl -all-stageprofile: all-stageprofile-ppl -TARGET-stageprofile-ppl = $(TARGET-ppl) -all-stageprofile-ppl: configure-stageprofile-ppl +.PHONY: all-stageprofile-isl maybe-all-stageprofile-isl +.PHONY: clean-stageprofile-isl maybe-clean-stageprofile-isl +maybe-all-stageprofile-isl: +maybe-clean-stageprofile-isl: +@if isl-bootstrap +maybe-all-stageprofile-isl: all-stageprofile-isl +all-stageprofile: all-stageprofile-isl +TARGET-stageprofile-isl = $(TARGET-isl) +all-stageprofile-isl: configure-stageprofile-isl @[ $(current_stage) = stageprofile ] || $(MAKE) stageprofile-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGEprofile_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) \ - cd $(HOST_SUBDIR)/ppl && \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGEprofile_CFLAGS)" \ CXXFLAGS="$(STAGEprofile_CXXFLAGS)" \ @@ -13467,42 +13465,42 @@ all-stageprofile-ppl: configure-stageprofile-ppl CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGEprofile_TFLAGS)" \ - $(TARGET-stageprofile-ppl) + $(TARGET-stageprofile-isl) -maybe-clean-stageprofile-ppl: clean-stageprofile-ppl -clean-stageprofile: clean-stageprofile-ppl -clean-stageprofile-ppl: +maybe-clean-stageprofile-isl: clean-stageprofile-isl +clean-stageprofile: clean-stageprofile-isl +clean-stageprofile-isl: @if [ $(current_stage) = stageprofile ]; then \ - [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \ else \ - [ -f $(HOST_SUBDIR)/stageprofile-ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/stageprofile-isl/Makefile ] || exit 0; \ $(MAKE) stageprofile-start; \ fi; \ - cd $(HOST_SUBDIR)/ppl && \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - clean -@endif ppl-bootstrap + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean +@endif isl-bootstrap -.PHONY: all-stagefeedback-ppl maybe-all-stagefeedback-ppl -.PHONY: clean-stagefeedback-ppl maybe-clean-stagefeedback-ppl -maybe-all-stagefeedback-ppl: -maybe-clean-stagefeedback-ppl: -@if ppl-bootstrap -maybe-all-stagefeedback-ppl: all-stagefeedback-ppl -all-stagefeedback: all-stagefeedback-ppl -TARGET-stagefeedback-ppl = $(TARGET-ppl) -all-stagefeedback-ppl: configure-stagefeedback-ppl +.PHONY: all-stagefeedback-isl maybe-all-stagefeedback-isl +.PHONY: clean-stagefeedback-isl maybe-clean-stagefeedback-isl +maybe-all-stagefeedback-isl: +maybe-clean-stagefeedback-isl: +@if isl-bootstrap +maybe-all-stagefeedback-isl: all-stagefeedback-isl +all-stagefeedback: all-stagefeedback-isl +TARGET-stagefeedback-isl = $(TARGET-isl) +all-stagefeedback-isl: configure-stagefeedback-isl @[ $(current_stage) = stagefeedback ] || $(MAKE) stagefeedback-start @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGEfeedback_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) \ - cd $(HOST_SUBDIR)/ppl && \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS"; export LDFLAGS; \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGEfeedback_CFLAGS)" \ CXXFLAGS="$(STAGEfeedback_CXXFLAGS)" \ @@ -13510,80 +13508,80 @@ all-stagefeedback-ppl: configure-stagefeedback-ppl CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGEfeedback_TFLAGS)" \ - $(TARGET-stagefeedback-ppl) + $(TARGET-stagefeedback-isl) -maybe-clean-stagefeedback-ppl: clean-stagefeedback-ppl -clean-stagefeedback: clean-stagefeedback-ppl -clean-stagefeedback-ppl: +maybe-clean-stagefeedback-isl: clean-stagefeedback-isl +clean-stagefeedback: clean-stagefeedback-isl +clean-stagefeedback-isl: @if [ $(current_stage) = stagefeedback ]; then \ - [ -f $(HOST_SUBDIR)/ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/isl/Makefile ] || exit 0; \ else \ - [ -f $(HOST_SUBDIR)/stagefeedback-ppl/Makefile ] || exit 0; \ + [ -f $(HOST_SUBDIR)/stagefeedback-isl/Makefile ] || exit 0; \ $(MAKE) stagefeedback-start; \ fi; \ - cd $(HOST_SUBDIR)/ppl && \ + cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - clean -@endif ppl-bootstrap + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean +@endif isl-bootstrap -.PHONY: check-ppl maybe-check-ppl -maybe-check-ppl: -@if ppl -maybe-check-ppl: check-ppl +.PHONY: check-isl maybe-check-isl +maybe-check-isl: +@if isl +maybe-check-isl: check-isl -check-ppl: +check-isl: @: $(MAKE); $(unstage) @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - (cd $(HOST_SUBDIR)/ppl && \ - $(MAKE) $(FLAGS_TO_PASS) check) + (cd $(HOST_SUBDIR)/isl && \ + $(MAKE) $(FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" check) -@endif ppl +@endif isl -.PHONY: install-ppl maybe-install-ppl -maybe-install-ppl: -@if ppl -maybe-install-ppl: install-ppl +.PHONY: install-isl maybe-install-isl +maybe-install-isl: +@if isl +maybe-install-isl: install-isl -install-ppl: +install-isl: -@endif ppl +@endif isl -.PHONY: install-strip-ppl maybe-install-strip-ppl -maybe-install-strip-ppl: -@if ppl -maybe-install-strip-ppl: install-strip-ppl +.PHONY: install-strip-isl maybe-install-strip-isl +maybe-install-strip-isl: +@if isl +maybe-install-strip-isl: install-strip-isl -install-strip-ppl: +install-strip-isl: -@endif ppl +@endif isl # Other targets (info, dvi, pdf, etc.) -.PHONY: maybe-info-ppl info-ppl -maybe-info-ppl: -@if ppl -maybe-info-ppl: info-ppl +.PHONY: maybe-info-isl info-isl +maybe-info-isl: +@if isl +maybe-info-isl: info-isl -info-ppl: \ - configure-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +info-isl: \ + configure-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing info in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing info in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13591,24 +13589,24 @@ info-ppl: \ info) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-dvi-ppl dvi-ppl -maybe-dvi-ppl: -@if ppl -maybe-dvi-ppl: dvi-ppl +.PHONY: maybe-dvi-isl dvi-isl +maybe-dvi-isl: +@if isl +maybe-dvi-isl: dvi-isl -dvi-ppl: \ - configure-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +dvi-isl: \ + configure-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing dvi in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing dvi in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13616,24 +13614,24 @@ dvi-ppl: \ dvi) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-pdf-ppl pdf-ppl -maybe-pdf-ppl: -@if ppl -maybe-pdf-ppl: pdf-ppl +.PHONY: maybe-pdf-isl pdf-isl +maybe-pdf-isl: +@if isl +maybe-pdf-isl: pdf-isl -pdf-ppl: \ - configure-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +pdf-isl: \ + configure-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing pdf in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing pdf in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13641,24 +13639,24 @@ pdf-ppl: \ pdf) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-html-ppl html-ppl -maybe-html-ppl: -@if ppl -maybe-html-ppl: html-ppl +.PHONY: maybe-html-isl html-isl +maybe-html-isl: +@if isl +maybe-html-isl: html-isl -html-ppl: \ - configure-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +html-isl: \ + configure-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing html in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing html in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13666,24 +13664,24 @@ html-ppl: \ html) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-TAGS-ppl TAGS-ppl -maybe-TAGS-ppl: -@if ppl -maybe-TAGS-ppl: TAGS-ppl +.PHONY: maybe-TAGS-isl TAGS-isl +maybe-TAGS-isl: +@if isl +maybe-TAGS-isl: TAGS-isl -TAGS-ppl: \ - configure-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +TAGS-isl: \ + configure-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing TAGS in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing TAGS in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13691,25 +13689,25 @@ TAGS-ppl: \ TAGS) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-install-info-ppl install-info-ppl -maybe-install-info-ppl: -@if ppl -maybe-install-info-ppl: install-info-ppl +.PHONY: maybe-install-info-isl install-info-isl +maybe-install-info-isl: +@if isl +maybe-install-info-isl: install-info-isl -install-info-ppl: \ - configure-ppl \ - info-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +install-info-isl: \ + configure-isl \ + info-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing install-info in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing install-info in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13717,25 +13715,25 @@ install-info-ppl: \ install-info) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-install-pdf-ppl install-pdf-ppl -maybe-install-pdf-ppl: -@if ppl -maybe-install-pdf-ppl: install-pdf-ppl +.PHONY: maybe-install-pdf-isl install-pdf-isl +maybe-install-pdf-isl: +@if isl +maybe-install-pdf-isl: install-pdf-isl -install-pdf-ppl: \ - configure-ppl \ - pdf-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +install-pdf-isl: \ + configure-isl \ + pdf-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing install-pdf in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing install-pdf in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13743,25 +13741,25 @@ install-pdf-ppl: \ install-pdf) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-install-html-ppl install-html-ppl -maybe-install-html-ppl: -@if ppl -maybe-install-html-ppl: install-html-ppl +.PHONY: maybe-install-html-isl install-html-isl +maybe-install-html-isl: +@if isl +maybe-install-html-isl: install-html-isl -install-html-ppl: \ - configure-ppl \ - html-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +install-html-isl: \ + configure-isl \ + html-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing install-html in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing install-html in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13769,24 +13767,24 @@ install-html-ppl: \ install-html) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-installcheck-ppl installcheck-ppl -maybe-installcheck-ppl: -@if ppl -maybe-installcheck-ppl: installcheck-ppl +.PHONY: maybe-installcheck-isl installcheck-isl +maybe-installcheck-isl: +@if isl +maybe-installcheck-isl: installcheck-isl -installcheck-ppl: \ - configure-ppl - @[ -f ./ppl/Makefile ] || exit 0; \ +installcheck-isl: \ + configure-isl + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing installcheck in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing installcheck in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13794,23 +13792,23 @@ installcheck-ppl: \ installcheck) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-mostlyclean-ppl mostlyclean-ppl -maybe-mostlyclean-ppl: -@if ppl -maybe-mostlyclean-ppl: mostlyclean-ppl +.PHONY: maybe-mostlyclean-isl mostlyclean-isl +maybe-mostlyclean-isl: +@if isl +maybe-mostlyclean-isl: mostlyclean-isl -mostlyclean-ppl: - @[ -f ./ppl/Makefile ] || exit 0; \ +mostlyclean-isl: + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing mostlyclean in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing mostlyclean in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13818,23 +13816,23 @@ mostlyclean-ppl: mostlyclean) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-clean-ppl clean-ppl -maybe-clean-ppl: -@if ppl -maybe-clean-ppl: clean-ppl +.PHONY: maybe-clean-isl clean-isl +maybe-clean-isl: +@if isl +maybe-clean-isl: clean-isl -clean-ppl: - @[ -f ./ppl/Makefile ] || exit 0; \ +clean-isl: + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing clean in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing clean in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13842,23 +13840,23 @@ clean-ppl: clean) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-distclean-ppl distclean-ppl -maybe-distclean-ppl: -@if ppl -maybe-distclean-ppl: distclean-ppl +.PHONY: maybe-distclean-isl distclean-isl +maybe-distclean-isl: +@if isl +maybe-distclean-isl: distclean-isl -distclean-ppl: - @[ -f ./ppl/Makefile ] || exit 0; \ +distclean-isl: + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing distclean in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing distclean in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13866,23 +13864,23 @@ distclean-ppl: distclean) \ || exit 1 -@endif ppl +@endif isl -.PHONY: maybe-maintainer-clean-ppl maintainer-clean-ppl -maybe-maintainer-clean-ppl: -@if ppl -maybe-maintainer-clean-ppl: maintainer-clean-ppl +.PHONY: maybe-maintainer-clean-isl maintainer-clean-isl +maybe-maintainer-clean-isl: +@if isl +maybe-maintainer-clean-isl: maintainer-clean-isl -maintainer-clean-ppl: - @[ -f ./ppl/Makefile ] || exit 0; \ +maintainer-clean-isl: + @[ -f ./isl/Makefile ] || exit 0; \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) ; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ - echo "Doing maintainer-clean in ppl" ; \ - (cd $(HOST_SUBDIR)/ppl && \ + echo "Doing maintainer-clean in isl" ; \ + (cd $(HOST_SUBDIR)/isl && \ $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ "RANLIB=$${RANLIB}" \ @@ -13890,7 +13888,7 @@ maintainer-clean-ppl: maintainer-clean) \ || exit 1 -@endif ppl +@endif isl @@ -13906,7 +13904,7 @@ configure-cloog: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ test ! -f $(HOST_SUBDIR)/cloog/Makefile || exit 0; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ - $(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring in $(HOST_SUBDIR)/cloog; \ cd "$(HOST_SUBDIR)/cloog" || exit 1; \ case $(srcdir) in \ @@ -13918,7 +13916,7 @@ configure-cloog: libsrcdir="$$s/cloog"; \ $(SHELL) $${libsrcdir}/configure \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} $${srcdiroption} --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl \ + --target=${target_alias} $${srcdiroption} --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system \ || exit 1 @endif cloog @@ -13938,7 +13936,7 @@ configure-stage1-cloog: $(HOST_EXPORTS) \ CFLAGS="$(STAGE1_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE1_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + LIBCFLAGS="$(LIBCFLAGS)"; export LIBCFLAGS; CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring stage 1 in $(HOST_SUBDIR)/cloog ; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ cd $(HOST_SUBDIR)/cloog || exit 1; \ @@ -13953,7 +13951,7 @@ configure-stage1-cloog: $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ --target=${target_alias} $${srcdiroption} \ $(STAGE1_CONFIGURE_FLAGS) \ - --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system @endif cloog-bootstrap .PHONY: configure-stage2-cloog maybe-configure-stage2-cloog @@ -13971,7 +13969,7 @@ configure-stage2-cloog: $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGE2_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE2_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + LIBCFLAGS="$(STAGE2_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring stage 2 in $(HOST_SUBDIR)/cloog ; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ cd $(HOST_SUBDIR)/cloog || exit 1; \ @@ -13987,7 +13985,7 @@ configure-stage2-cloog: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system @endif cloog-bootstrap .PHONY: configure-stage3-cloog maybe-configure-stage3-cloog @@ -14005,7 +14003,7 @@ configure-stage3-cloog: $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGE3_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE3_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + LIBCFLAGS="$(STAGE3_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring stage 3 in $(HOST_SUBDIR)/cloog ; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ cd $(HOST_SUBDIR)/cloog || exit 1; \ @@ -14021,7 +14019,7 @@ configure-stage3-cloog: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system @endif cloog-bootstrap .PHONY: configure-stage4-cloog maybe-configure-stage4-cloog @@ -14039,7 +14037,7 @@ configure-stage4-cloog: $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGE4_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGE4_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + LIBCFLAGS="$(STAGE4_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring stage 4 in $(HOST_SUBDIR)/cloog ; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ cd $(HOST_SUBDIR)/cloog || exit 1; \ @@ -14055,7 +14053,7 @@ configure-stage4-cloog: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system @endif cloog-bootstrap .PHONY: configure-stageprofile-cloog maybe-configure-stageprofile-cloog @@ -14073,7 +14071,7 @@ configure-stageprofile-cloog: $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGEprofile_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGEprofile_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + LIBCFLAGS="$(STAGEprofile_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring stage profile in $(HOST_SUBDIR)/cloog ; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ cd $(HOST_SUBDIR)/cloog || exit 1; \ @@ -14089,7 +14087,7 @@ configure-stageprofile-cloog: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system @endif cloog-bootstrap .PHONY: configure-stagefeedback-cloog maybe-configure-stagefeedback-cloog @@ -14107,7 +14105,7 @@ configure-stagefeedback-cloog: $(POSTSTAGE1_HOST_EXPORTS) \ CFLAGS="$(STAGEfeedback_CFLAGS)"; export CFLAGS; \ CXXFLAGS="$(STAGEfeedback_CXXFLAGS)"; export CXXFLAGS; \ - LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + LIBCFLAGS="$(STAGEfeedback_CFLAGS)"; export LIBCFLAGS; CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ echo Configuring stage feedback in $(HOST_SUBDIR)/cloog ; \ $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/cloog ; \ cd $(HOST_SUBDIR)/cloog || exit 1; \ @@ -14123,7 +14121,7 @@ configure-stagefeedback-cloog: --target=${target_alias} $${srcdiroption} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-ppl + --disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-bits=gmp --with-isl=system @endif cloog-bootstrap @@ -14141,9 +14139,9 @@ maybe-all-cloog: all-cloog all-cloog: configure-cloog @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ - $(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ (cd $(HOST_SUBDIR)/cloog && \ - $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ $(TARGET-cloog)) @endif cloog @@ -14162,7 +14160,7 @@ all-stage1-cloog: configure-stage1-cloog @r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE1_TFLAGS)"; \ - $(HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE1_CFLAGS)" \ @@ -14171,7 +14169,7 @@ all-stage1-cloog: configure-stage1-cloog CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE1_TFLAGS)" \ $(TARGET-stage1-cloog) @@ -14186,7 +14184,7 @@ clean-stage1-cloog: fi; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ - CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean @endif cloog-bootstrap @@ -14204,7 +14202,7 @@ all-stage2-cloog: configure-stage2-cloog s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE2_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE2_CFLAGS)" \ @@ -14213,7 +14211,7 @@ all-stage2-cloog: configure-stage2-cloog CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE2_TFLAGS)" \ $(TARGET-stage2-cloog) @@ -14229,7 +14227,7 @@ clean-stage2-cloog: cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean @endif cloog-bootstrap @@ -14247,7 +14245,7 @@ all-stage3-cloog: configure-stage3-cloog s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE3_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE3_CFLAGS)" \ @@ -14256,7 +14254,7 @@ all-stage3-cloog: configure-stage3-cloog CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE3_TFLAGS)" \ $(TARGET-stage3-cloog) @@ -14272,7 +14270,7 @@ clean-stage3-cloog: cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean @endif cloog-bootstrap @@ -14290,7 +14288,7 @@ all-stage4-cloog: configure-stage4-cloog s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGE4_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGE4_CFLAGS)" \ @@ -14299,7 +14297,7 @@ all-stage4-cloog: configure-stage4-cloog CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGE4_TFLAGS)" \ $(TARGET-stage4-cloog) @@ -14315,7 +14313,7 @@ clean-stage4-cloog: cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean @endif cloog-bootstrap @@ -14333,7 +14331,7 @@ all-stageprofile-cloog: configure-stageprofile-cloog s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGEprofile_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGEprofile_CFLAGS)" \ @@ -14342,7 +14340,7 @@ all-stageprofile-cloog: configure-stageprofile-cloog CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGEprofile_TFLAGS)" \ $(TARGET-stageprofile-cloog) @@ -14358,7 +14356,7 @@ clean-stageprofile-cloog: cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean @endif cloog-bootstrap @@ -14376,7 +14374,7 @@ all-stagefeedback-cloog: configure-stagefeedback-cloog s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ TFLAGS="$(STAGEfeedback_TFLAGS)"; \ $(HOST_EXPORTS) \ - $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}"; export CPPFLAGS; LDFLAGS="$$LDFLAGS ${HOST_PPLLIBS}"; export LDFLAGS; \ + $(POSTSTAGE1_HOST_EXPORTS) CPPFLAGS="-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include ${CPPFLAGS}"; export CPPFLAGS; LDFLAGS="-L$$r/$(HOST_SUBDIR)/isl/.libs $$LDFLAGS"; export LDFLAGS; \ cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(BASE_FLAGS_TO_PASS) \ CFLAGS="$(STAGEfeedback_CFLAGS)" \ @@ -14385,7 +14383,7 @@ all-stagefeedback-cloog: configure-stagefeedback-cloog CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ - $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" \ + $(EXTRA_HOST_FLAGS) $(POSTSTAGE1_FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" \ TFLAGS="$(STAGEfeedback_TFLAGS)" \ $(TARGET-stagefeedback-cloog) @@ -14401,7 +14399,7 @@ clean-stagefeedback-cloog: cd $(HOST_SUBDIR)/cloog && \ $(MAKE) $(EXTRA_HOST_FLAGS) \ $(POSTSTAGE1_FLAGS_TO_PASS) \ - CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" clean + CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" clean @endif cloog-bootstrap @@ -14419,7 +14417,7 @@ check-cloog: s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ (cd $(HOST_SUBDIR)/cloog && \ - $(MAKE) $(FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS" check) + $(MAKE) $(FLAGS_TO_PASS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS" check) @endif cloog @@ -14454,7 +14452,7 @@ info-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing info in cloog" ; \ @@ -14479,7 +14477,7 @@ dvi-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing dvi in cloog" ; \ @@ -14504,7 +14502,7 @@ pdf-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing pdf in cloog" ; \ @@ -14529,7 +14527,7 @@ html-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing html in cloog" ; \ @@ -14554,7 +14552,7 @@ TAGS-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing TAGS in cloog" ; \ @@ -14580,7 +14578,7 @@ install-info-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing install-info in cloog" ; \ @@ -14606,7 +14604,7 @@ install-pdf-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing install-pdf in cloog" ; \ @@ -14632,7 +14630,7 @@ install-html-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing install-html in cloog" ; \ @@ -14657,7 +14655,7 @@ installcheck-cloog: \ r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing installcheck in cloog" ; \ @@ -14681,7 +14679,7 @@ mostlyclean-cloog: r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing mostlyclean in cloog" ; \ @@ -14705,7 +14703,7 @@ clean-cloog: r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing clean in cloog" ; \ @@ -14729,7 +14727,7 @@ distclean-cloog: r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing distclean in cloog" ; \ @@ -14753,7 +14751,7 @@ maintainer-clean-cloog: r=`${PWD_COMMAND}`; export r; \ s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ $(HOST_EXPORTS) \ - for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS} ${HOST_PPLINC}" LDFLAGS="$$LDFLAGS"; do \ + for flag in $(EXTRA_HOST_FLAGS) CPPFLAGS="${CPPFLAGS}" LDFLAGS="$$LDFLAGS"; do \ eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ done; \ echo "Doing maintainer-clean in cloog" ; \ @@ -41326,11 +41324,11 @@ stage1-start:: mkdir stage1-mpc; \ mv stage1-mpc mpc @endif mpc -@if ppl - @cd $(HOST_SUBDIR); [ -d stage1-ppl ] || \ - mkdir stage1-ppl; \ - mv stage1-ppl ppl -@endif ppl +@if isl + @cd $(HOST_SUBDIR); [ -d stage1-isl ] || \ + mkdir stage1-isl; \ + mv stage1-isl isl +@endif isl @if cloog @cd $(HOST_SUBDIR); [ -d stage1-cloog ] || \ mkdir stage1-cloog; \ @@ -41426,11 +41424,11 @@ stage1-end:: cd $(HOST_SUBDIR); mv mpc stage1-mpc ; \ fi @endif mpc -@if ppl - @if test -d $(HOST_SUBDIR)/ppl ; then \ - cd $(HOST_SUBDIR); mv ppl stage1-ppl ; \ +@if isl + @if test -d $(HOST_SUBDIR)/isl ; then \ + cd $(HOST_SUBDIR); mv isl stage1-isl ; \ fi -@endif ppl +@endif isl @if cloog @if test -d $(HOST_SUBDIR)/cloog ; then \ cd $(HOST_SUBDIR); mv cloog stage1-cloog ; \ @@ -41577,12 +41575,12 @@ stage2-start:: mv stage2-mpc mpc ; \ mv stage1-mpc prev-mpc || test -f stage1-lean @endif mpc -@if ppl - @cd $(HOST_SUBDIR); [ -d stage2-ppl ] || \ - mkdir stage2-ppl; \ - mv stage2-ppl ppl ; \ - mv stage1-ppl prev-ppl || test -f stage1-lean -@endif ppl +@if isl + @cd $(HOST_SUBDIR); [ -d stage2-isl ] || \ + mkdir stage2-isl; \ + mv stage2-isl isl ; \ + mv stage1-isl prev-isl || test -f stage1-lean +@endif isl @if cloog @cd $(HOST_SUBDIR); [ -d stage2-cloog ] || \ mkdir stage2-cloog; \ @@ -41697,12 +41695,12 @@ stage2-end:: mv prev-mpc stage1-mpc ; : ; \ fi @endif mpc -@if ppl - @if test -d $(HOST_SUBDIR)/ppl ; then \ - cd $(HOST_SUBDIR); mv ppl stage2-ppl ; \ - mv prev-ppl stage1-ppl ; : ; \ +@if isl + @if test -d $(HOST_SUBDIR)/isl ; then \ + cd $(HOST_SUBDIR); mv isl stage2-isl ; \ + mv prev-isl stage1-isl ; : ; \ fi -@endif ppl +@endif isl @if cloog @if test -d $(HOST_SUBDIR)/cloog ; then \ cd $(HOST_SUBDIR); mv cloog stage2-cloog ; \ @@ -41883,12 +41881,12 @@ stage3-start:: mv stage3-mpc mpc ; \ mv stage2-mpc prev-mpc || test -f stage2-lean @endif mpc -@if ppl - @cd $(HOST_SUBDIR); [ -d stage3-ppl ] || \ - mkdir stage3-ppl; \ - mv stage3-ppl ppl ; \ - mv stage2-ppl prev-ppl || test -f stage2-lean -@endif ppl +@if isl + @cd $(HOST_SUBDIR); [ -d stage3-isl ] || \ + mkdir stage3-isl; \ + mv stage3-isl isl ; \ + mv stage2-isl prev-isl || test -f stage2-lean +@endif isl @if cloog @cd $(HOST_SUBDIR); [ -d stage3-cloog ] || \ mkdir stage3-cloog; \ @@ -42003,12 +42001,12 @@ stage3-end:: mv prev-mpc stage2-mpc ; : ; \ fi @endif mpc -@if ppl - @if test -d $(HOST_SUBDIR)/ppl ; then \ - cd $(HOST_SUBDIR); mv ppl stage3-ppl ; \ - mv prev-ppl stage2-ppl ; : ; \ +@if isl + @if test -d $(HOST_SUBDIR)/isl ; then \ + cd $(HOST_SUBDIR); mv isl stage3-isl ; \ + mv prev-isl stage2-isl ; : ; \ fi -@endif ppl +@endif isl @if cloog @if test -d $(HOST_SUBDIR)/cloog ; then \ cd $(HOST_SUBDIR); mv cloog stage3-cloog ; \ @@ -42245,12 +42243,12 @@ stage4-start:: mv stage4-mpc mpc ; \ mv stage3-mpc prev-mpc || test -f stage3-lean @endif mpc -@if ppl - @cd $(HOST_SUBDIR); [ -d stage4-ppl ] || \ - mkdir stage4-ppl; \ - mv stage4-ppl ppl ; \ - mv stage3-ppl prev-ppl || test -f stage3-lean -@endif ppl +@if isl + @cd $(HOST_SUBDIR); [ -d stage4-isl ] || \ + mkdir stage4-isl; \ + mv stage4-isl isl ; \ + mv stage3-isl prev-isl || test -f stage3-lean +@endif isl @if cloog @cd $(HOST_SUBDIR); [ -d stage4-cloog ] || \ mkdir stage4-cloog; \ @@ -42365,12 +42363,12 @@ stage4-end:: mv prev-mpc stage3-mpc ; : ; \ fi @endif mpc -@if ppl - @if test -d $(HOST_SUBDIR)/ppl ; then \ - cd $(HOST_SUBDIR); mv ppl stage4-ppl ; \ - mv prev-ppl stage3-ppl ; : ; \ +@if isl + @if test -d $(HOST_SUBDIR)/isl ; then \ + cd $(HOST_SUBDIR); mv isl stage4-isl ; \ + mv prev-isl stage3-isl ; : ; \ fi -@endif ppl +@endif isl @if cloog @if test -d $(HOST_SUBDIR)/cloog ; then \ cd $(HOST_SUBDIR); mv cloog stage4-cloog ; \ @@ -42595,12 +42593,12 @@ stageprofile-start:: mv stageprofile-mpc mpc ; \ mv stage1-mpc prev-mpc || test -f stage1-lean @endif mpc -@if ppl - @cd $(HOST_SUBDIR); [ -d stageprofile-ppl ] || \ - mkdir stageprofile-ppl; \ - mv stageprofile-ppl ppl ; \ - mv stage1-ppl prev-ppl || test -f stage1-lean -@endif ppl +@if isl + @cd $(HOST_SUBDIR); [ -d stageprofile-isl ] || \ + mkdir stageprofile-isl; \ + mv stageprofile-isl isl ; \ + mv stage1-isl prev-isl || test -f stage1-lean +@endif isl @if cloog @cd $(HOST_SUBDIR); [ -d stageprofile-cloog ] || \ mkdir stageprofile-cloog; \ @@ -42715,12 +42713,12 @@ stageprofile-end:: mv prev-mpc stage1-mpc ; : ; \ fi @endif mpc -@if ppl - @if test -d $(HOST_SUBDIR)/ppl ; then \ - cd $(HOST_SUBDIR); mv ppl stageprofile-ppl ; \ - mv prev-ppl stage1-ppl ; : ; \ +@if isl + @if test -d $(HOST_SUBDIR)/isl ; then \ + cd $(HOST_SUBDIR); mv isl stageprofile-isl ; \ + mv prev-isl stage1-isl ; : ; \ fi -@endif ppl +@endif isl @if cloog @if test -d $(HOST_SUBDIR)/cloog ; then \ cd $(HOST_SUBDIR); mv cloog stageprofile-cloog ; \ @@ -42878,12 +42876,12 @@ stagefeedback-start:: mv stagefeedback-mpc mpc ; \ mv stageprofile-mpc prev-mpc || test -f stageprofile-lean @endif mpc -@if ppl - @cd $(HOST_SUBDIR); [ -d stagefeedback-ppl ] || \ - mkdir stagefeedback-ppl; \ - mv stagefeedback-ppl ppl ; \ - mv stageprofile-ppl prev-ppl || test -f stageprofile-lean -@endif ppl +@if isl + @cd $(HOST_SUBDIR); [ -d stagefeedback-isl ] || \ + mkdir stagefeedback-isl; \ + mv stagefeedback-isl isl ; \ + mv stageprofile-isl prev-isl || test -f stageprofile-lean +@endif isl @if cloog @cd $(HOST_SUBDIR); [ -d stagefeedback-cloog ] || \ mkdir stagefeedback-cloog; \ @@ -42998,12 +42996,12 @@ stagefeedback-end:: mv prev-mpc stageprofile-mpc ; : ; \ fi @endif mpc -@if ppl - @if test -d $(HOST_SUBDIR)/ppl ; then \ - cd $(HOST_SUBDIR); mv ppl stagefeedback-ppl ; \ - mv prev-ppl stageprofile-ppl ; : ; \ +@if isl + @if test -d $(HOST_SUBDIR)/isl ; then \ + cd $(HOST_SUBDIR); mv isl stagefeedback-isl ; \ + mv prev-isl stageprofile-isl ; : ; \ fi -@endif ppl +@endif isl @if cloog @if test -d $(HOST_SUBDIR)/cloog ; then \ cd $(HOST_SUBDIR); mv cloog stagefeedback-cloog ; \ @@ -43354,14 +43352,6 @@ all-stage3-gcc: maybe-all-stage3-mpc all-stage4-gcc: maybe-all-stage4-mpc all-stageprofile-gcc: maybe-all-stageprofile-mpc all-stagefeedback-gcc: maybe-all-stagefeedback-mpc -all-gcc: maybe-all-ppl - -all-stage1-gcc: maybe-all-stage1-ppl -all-stage2-gcc: maybe-all-stage2-ppl -all-stage3-gcc: maybe-all-stage3-ppl -all-stage4-gcc: maybe-all-stage4-ppl -all-stageprofile-gcc: maybe-all-stageprofile-ppl -all-stagefeedback-gcc: maybe-all-stagefeedback-ppl all-gcc: maybe-all-cloog all-stage1-gcc: maybe-all-stage1-cloog @@ -43546,30 +43536,30 @@ configure-stage3-mpc: maybe-all-stage3-mpfr configure-stage4-mpc: maybe-all-stage4-mpfr configure-stageprofile-mpc: maybe-all-stageprofile-mpfr configure-stagefeedback-mpc: maybe-all-stagefeedback-mpfr -configure-ppl: maybe-all-gmp +configure-isl: maybe-all-gmp -configure-stage1-ppl: maybe-all-stage1-gmp -configure-stage2-ppl: maybe-all-stage2-gmp -configure-stage3-ppl: maybe-all-stage3-gmp -configure-stage4-ppl: maybe-all-stage4-gmp -configure-stageprofile-ppl: maybe-all-stageprofile-gmp -configure-stagefeedback-ppl: maybe-all-stagefeedback-gmp -configure-ppl: maybe-all-mpfr +configure-stage1-isl: maybe-all-stage1-gmp +configure-stage2-isl: maybe-all-stage2-gmp +configure-stage3-isl: maybe-all-stage3-gmp +configure-stage4-isl: maybe-all-stage4-gmp +configure-stageprofile-isl: maybe-all-stageprofile-gmp +configure-stagefeedback-isl: maybe-all-stagefeedback-gmp +configure-cloog: maybe-all-isl -configure-stage1-ppl: maybe-all-stage1-mpfr -configure-stage2-ppl: maybe-all-stage2-mpfr -configure-stage3-ppl: maybe-all-stage3-mpfr -configure-stage4-ppl: maybe-all-stage4-mpfr -configure-stageprofile-ppl: maybe-all-stageprofile-mpfr -configure-stagefeedback-ppl: maybe-all-stagefeedback-mpfr -configure-cloog: maybe-all-ppl +configure-stage1-cloog: maybe-all-stage1-isl +configure-stage2-cloog: maybe-all-stage2-isl +configure-stage3-cloog: maybe-all-stage3-isl +configure-stage4-cloog: maybe-all-stage4-isl +configure-stageprofile-cloog: maybe-all-stageprofile-isl +configure-stagefeedback-cloog: maybe-all-stagefeedback-isl +configure-cloog: maybe-all-gmp -configure-stage1-cloog: maybe-all-stage1-ppl -configure-stage2-cloog: maybe-all-stage2-ppl -configure-stage3-cloog: maybe-all-stage3-ppl -configure-stage4-cloog: maybe-all-stage4-ppl -configure-stageprofile-cloog: maybe-all-stageprofile-ppl -configure-stagefeedback-cloog: maybe-all-stagefeedback-ppl +configure-stage1-cloog: maybe-all-stage1-gmp +configure-stage2-cloog: maybe-all-stage2-gmp +configure-stage3-cloog: maybe-all-stage3-gmp +configure-stage4-cloog: maybe-all-stage4-gmp +configure-stageprofile-cloog: maybe-all-stageprofile-gmp +configure-stagefeedback-cloog: maybe-all-stagefeedback-gmp configure-gdb: maybe-all-intl configure-gdb: maybe-configure-sim configure-gdb: maybe-all-bfd diff --git a/Makefile.tpl b/Makefile.tpl index d898b7d2e3f..2573eee8f6a 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -222,8 +222,7 @@ HOST_EXPORTS = \ HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \ GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \ - PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \ - PPLINC="$(HOST_PPLINC)"; export PPLINC; \ + ISLINC="$(HOST_ISLINC)"; export ISLINC; \ CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \ CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \ LIBELFLIBS="$(HOST_LIBELFLIBS)" ; export LIBELFLIBS; \ @@ -313,9 +312,8 @@ NORMAL_TARGET_EXPORTS = \ HOST_GMPLIBS = @gmplibs@ HOST_GMPINC = @gmpinc@ -# Where to find PPL -HOST_PPLLIBS = @ppllibs@ -HOST_PPLINC = @pplinc@ +# Where to find ISL +HOST_ISLINC = @islinc@ # Where to find CLOOG HOST_CLOOGLIBS = @clooglibs@ diff --git a/config/ChangeLog b/config/ChangeLog index 42fcfce998c..b0b6690cf9d 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,11 @@ +2012-07-02 Richard Guenther + Michael Matz + Tobias Grosser + Sebastian Pop + + * cloog.m4: Set up to work against ISL only. + * isl.m4: New file. + 2012-05-29 Joseph Myers * mt-sde: Fix typos. diff --git a/config/cloog.m4 b/config/cloog.m4 index 9c424450df8..603df6bcfaf 100644 --- a/config/cloog.m4 +++ b/config/cloog.m4 @@ -63,6 +63,17 @@ AC_DEFUN([CLOOG_INIT_FLAGS], if test "x${with_cloog_lib}" != x; then clooglibs="-L$with_cloog_lib" fi + dnl If no --with-cloog flag was specified and there is in-tree ClooG + dnl source, set up flags to use that. + if test "x${clooginc}" == x && test "x${clooglibs}" == x \ + && test -d ${srcdir}/cloog; then + echo FooBar + clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ' + clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -I'${srcdir}'/cloog/include ' + fi + + clooginc="-DCLOOG_INT_GMP ${clooginc}" + clooglibs="${clooglibs} -lcloog-isl ${isllibs}" dnl Flags needed for CLOOG AC_SUBST(clooglibs) @@ -89,63 +100,11 @@ AC_DEFUN([CLOOG_REQUESTED], ] ) -# _CLOOG_ORG_PROG_ISL () -# ------------------ -# Helper for detecting CLooG.org's ISL backend. -m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG_PROGRAM( - [#include "cloog/cloog.h" ], - [cloog_version ()])]) - -# CLOOG_FIND_FLAGS () -# ------------------ -# Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org. -# Only look for the CLooG backend type specified in --enable-cloog-backend -AC_DEFUN([CLOOG_FIND_FLAGS], -[ - AC_REQUIRE([CLOOG_INIT_FLAGS]) - - _cloog_saved_CFLAGS=$CFLAGS - _cloog_saved_CPPFLAGS=$CPPFLAGS - _cloog_saved_LDFLAGS=$LDFLAGS - _cloog_saved_LIBS=$LIBS - - _cloogorginc="-DCLOOG_INT_GMP" - - dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS. - CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}" - CPPFLAGS="${CPPFLAGS} ${_cloogorginc}" - LDFLAGS="${LDFLAGS} ${clooglibs}" - - AC_CACHE_CHECK([for installed CLooG ISL], [gcc_cv_cloog_type], - [LIBS="-lcloog-isl ${_cloog_saved_LIBS}" - AC_LINK_IFELSE([_CLOOG_ORG_PROG_ISL], [gcc_cv_cloog_type="ISL"], - [gcc_cv_cloog_type=no])]) - - case $gcc_cv_cloog_type in - "ISL") - clooginc="${clooginc} ${_cloogorginc}" - clooglibs="${clooglibs} -lcloog-isl -lisl" - cloog_org=yes - ;; - *) - clooglibs= - clooginc= - cloog_org= - ;; - esac - - LIBS=$_cloog_saved_LIBS - CFLAGS=$_cloog_saved_CFLAGS - CPPFLAGS=$_cloog_saved_CPPFLAGS - LDFLAGS=$_cloog_saved_LDFLAGS -] -) - # _CLOOG_CHECK_CT_PROG(MAJOR, MINOR, REVISION) # -------------------------------------------- # Helper for verifying CLooG's compile time version. m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM( - [#include "cloog/cloog.h"], + [#include "cloog/version.h"], [#if CLOOG_VERSION_MAJOR != $1 \ || CLOOG_VERSION_MINOR != $2 \ || CLOOG_VERSION_REVISION < $3 @@ -158,14 +117,14 @@ m4_define([_CLOOG_CHECK_CT_PROG],[AC_LANG_PROGRAM( # REVISION. AC_DEFUN([CLOOG_CHECK_VERSION], [ - AC_REQUIRE([CLOOG_FIND_FLAGS]) + AC_REQUIRE([CLOOG_INIT_FLAGS]) if test "${ENABLE_CLOOG_CHECK}" = yes ; then _cloog_saved_CFLAGS=$CFLAGS _cloog_saved_LDFLAGS=$LDFLAGS - CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" - LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}" + CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${islinc} ${gmpinc}" + LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${isllibs} ${gmplib}" AC_CACHE_CHECK([for version $1.$2.$3 of CLooG], [gcc_cv_cloog], diff --git a/configure b/configure index 402e0648a37..b157a721989 100755 --- a/configure +++ b/configure @@ -646,8 +646,8 @@ stage1_languages extra_host_libiberty_configure_flags clooginc clooglibs -pplinc -ppllibs +islinc +isllibs poststage1_ldflags poststage1_libs stage1_libs @@ -770,10 +770,10 @@ with_stage1_ldflags with_stage1_libs with_boot_libs with_boot_ldflags -with_ppl -with_ppl_include -with_ppl_lib -enable_ppl_version_check +with_isl +with_isl_include +with_isl_lib +enable_isl_version_check with_cloog with_cloog_include with_cloog_lib @@ -1473,8 +1473,8 @@ Optional Features: --enable-build-with-cxx build with C++ compiler instead of C compiler --enable-build-poststage1-with-cxx build stages 2 and 3 with C++, not C - --disable-ppl-version-check - disable check for PPL version + --disable-isl-version-check + disable check for ISL version --disable-cloog-version-check disable check for CLooG version --enable-lto enable link time optimization support @@ -1526,12 +1526,12 @@ Optional Packages: --with-boot-libs=LIBS libraries for stage2 and later --with-boot-ldflags=FLAGS linker flags for stage2 and later - --with-ppl=PATH specify prefix directory for the installed PPL + --with-isl=PATH Specify prefix directory for the installed ISL package. Equivalent to - --with-ppl-include=PATH/include plus - --with-ppl-lib=PATH/lib - --with-ppl-include=PATH specify directory for installed PPL include files - --with-ppl-lib=PATH specify directory for the installed PPL library + --with-isl-include=PATH/include plus + --with-isl-lib=PATH/lib + --with-isl-include=PATH Specify directory for installed ISL include files + --with-isl-lib=PATH Specify the directory for the installed ISL library --with-cloog=PATH Specify prefix directory for the installed CLooG-PPL package. Equivalent to --with-cloog-include=PATH/include plus @@ -1816,6 +1816,48 @@ fi return $ac_retval } # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_run cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -2662,7 +2704,7 @@ build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes" # these libraries are used by various programs built for the host environment # -host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc ppl cloog libelf libiconv" +host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc isl cloog libelf libiconv" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to @@ -5581,160 +5623,158 @@ fi -# Check for PPL -ppllibs= -pplinc= -pwllib= +# Check for ISL -# Check whether --with-ppl was given. -if test "${with_ppl+set}" = set; then : - withval=$with_ppl; +# Check whether --with-isl was given. +if test "${with_isl+set}" = set; then : + withval=$with_isl; fi -# Check whether --with-ppl-include was given. -if test "${with_ppl_include+set}" = set; then : - withval=$with_ppl_include; +# Check whether --with-isl-include was given. +if test "${with_isl_include+set}" = set; then : + withval=$with_isl_include; fi -# Check whether --with-ppl-lib was given. -if test "${with_ppl_lib+set}" = set; then : - withval=$with_ppl_lib; +# Check whether --with-isl-lib was given. +if test "${with_isl_lib+set}" = set; then : + withval=$with_isl_lib; fi -# Check whether --enable-ppl-version-check was given. -if test "${enable_ppl_version_check+set}" = set; then : - enableval=$enable_ppl_version_check; + # Check whether --enable-isl-version-check was given. +if test "${enable_isl_version_check+set}" = set; then : + enableval=$enable_isl_version_check; ENABLE_ISL_CHECK=$enableval +else + ENABLE_ISL_CHECK=yes fi -case $with_ppl in - yes | no | "") - ;; - *) - ppllibs="-L$with_ppl/lib" - pplinc="-I$with_ppl/include $pplinc" - if test -d "$with_ppl/lib" && test -d "$with_ppl/include"; then - with_ppl=yes - else - as_fn_error "cannot find directories \"$with_ppl/lib\" or \"$with_ppl/include\"" "$LINENO" 5 - fi - ;; -esac - -if test x"$with_ppl_include" != x; then - pplinc="-I$with_ppl_include $pplinc" - with_ppl=yes -fi - -if test "x$with_ppl_lib" != x; then - ppllibs="-L$with_ppl_lib" - with_ppl=yes -fi - -if test x"$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then - if test x"$enable_watchdog" = xyes; then - pwllib="-lpwl" + # Initialize isllibs and islinc. + case $with_isl in + no) + isllibs= + islinc= + ;; + "" | yes) + ;; + *) + isllibs="-L$with_isl/lib" + islinc="-I$with_isl/include" + ;; + esac + if test "x${with_isl_include}" != x ; then + islinc="-I$with_isl_include" + fi + if test "x${with_isl_lib}" != x; then + isllibs="-L$with_isl_lib" + fi + if test "x${islinc}" = x && test "x${isllibs}" = x \ + && test -d ${srcdir}/isl; then + isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' ' + islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include' + ENABLE_ISL_CHECK=no fi - ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir" - pplinc='-I$$r/$(HOST_SUBDIR)/ppl/src -I$$r/$(HOST_SUBDIR)/ppl/interfaces/C ' - enable_ppl_version_check=no - with_ppl=yes -fi -if test "x$with_ppl" != xno; then - if test "x$pwllib" = x; then - saved_LIBS="$LIBS" - LIBS="$LIBS $ppllibs -lstdc++ -lm" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PWL_handle_timeout in -lpwl" >&5 -$as_echo_n "checking for PWL_handle_timeout in -lpwl... " >&6; } -if test "${ac_cv_lib_pwl_PWL_handle_timeout+set}" = set; then : + isllibs="${isllibs} -lisl" + + + + + +if test "x$with_isl" != "xno"; then + + if test "${ENABLE_ISL_CHECK}" = yes ; then + _isl_saved_CFLAGS=$CFLAGS + _isl_saved_LDFLAGS=$LDFLAGS + + CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}" + LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs} -lisl" + echo $CFLAGS + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.10 of ISL" >&5 +$as_echo_n "checking for version 0.10 of ISL... " >&6; } +if test "${gcc_cv_isl+set}" = set; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpwl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char PWL_handle_timeout (); +#include + #include int main () { -return PWL_handle_timeout (); +int main() + { + if (strncmp (isl_version (), "isl-0.10", strlen ("isl-0.10")) != 0) + return 1; + return 0; + } ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pwl_PWL_handle_timeout=yes +if ac_fn_c_try_run "$LINENO"; then : + gcc_cv_isl=yes else - ac_cv_lib_pwl_PWL_handle_timeout=no + gcc_cv_isl=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pwl_PWL_handle_timeout" >&5 -$as_echo "$ac_cv_lib_pwl_PWL_handle_timeout" >&6; } -if test "x$ac_cv_lib_pwl_PWL_handle_timeout" = x""yes; then : - pwllib="-lpwl" +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - LIBS="$saved_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_isl" >&5 +$as_echo "$gcc_cv_isl" >&6; } + + CFLAGS=$_isl_saved_CFLAGS + LDFLAGS=$_isl_saved_LDFLAGS fi - ppllibs="$ppllibs -lppl_c -lppl $pwllib -lgmpxx" - if test "$enable_ppl_version_check" != no; then - saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pplinc $gmpinc" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.11 (revision 0 or later) of PPL" >&5 -$as_echo_n "checking for version 0.11 (revision 0 or later) of PPL... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "ppl_c.h" -int -main () -{ - #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11 - choke me - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; ppllibs= ; pplinc= ; with_ppl=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$saved_CFLAGS" + + + + if test "x${with_isl}" = xno; then + graphite_requested=no + elif test "x${with_isl}" != x \ + || test "x${with_isl_include}" != x \ + || test "x${with_isl_lib}" != x ; then + graphite_requested=yes + else + graphite_requested=no fi + + + + if test "${gcc_cv_isl}" = no ; then + isllibs= + islinc= + fi + + if test "${graphite_requested}" = yes \ + && test "x${isllibs}" = x \ + && test "x${islinc}" = x ; then + + as_fn_error "Unable to find a usable ISL. See config.log for details." "$LINENO" 5 + fi + + fi -# Flags needed for PPL - - - - # Check for CLOOG - # Check whether --with-cloog was given. if test "${with_cloog+set}" = set; then : withval=$with_cloog; @@ -5780,107 +5820,30 @@ fi if test "x${with_cloog_lib}" != x; then clooglibs="-L$with_cloog_lib" fi - - - - - -if test "x$with_ppl" = "xno"; then - - - - if test "x${with_cloog}" = xno; then - graphite_requested=no - elif test "x${with_cloog}" != x \ - || test "x${with_cloog_include}" != x \ - || test "x${with_cloog_lib}" != x ; then - graphite_requested=yes - else - graphite_requested=no + if test "x${clooginc}" == x && test "x${clooglibs}" == x \ + && test -d ${srcdir}/cloog; then + echo FooBar + clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ' + clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -I'${srcdir}'/cloog/include ' fi + clooginc="-DCLOOG_INT_GMP ${clooginc}" + clooglibs="${clooglibs} -lcloog-isl ${isllibs}" + + + + - if test "${graphite_requested}" = yes; then - as_fn_error "Unable to find a usable PPL. See config.log for details." "$LINENO" 5 - fi - with_cloog=no -fi -if test "x${with_cloog}" = x && test "x${with_cloog_include}" = x \ - && test "x${with_cloog_lib}" = x && test -d ${srcdir}/cloog; then - clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ' - clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include ' -fi if test "x$with_cloog" != "xno"; then - _cloog_saved_CFLAGS=$CFLAGS - _cloog_saved_CPPFLAGS=$CPPFLAGS - _cloog_saved_LDFLAGS=$LDFLAGS - _cloog_saved_LIBS=$LIBS - - _cloogorginc="-DCLOOG_INT_GMP" - - CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}" - CPPFLAGS="${CPPFLAGS} ${_cloogorginc}" - LDFLAGS="${LDFLAGS} ${clooglibs}" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG ISL" >&5 -$as_echo_n "checking for installed CLooG ISL... " >&6; } -if test "${gcc_cv_cloog_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - LIBS="-lcloog-isl ${_cloog_saved_LIBS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "cloog/cloog.h" -int -main () -{ -cloog_version () - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gcc_cv_cloog_type="ISL" -else - gcc_cv_cloog_type=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5 -$as_echo "$gcc_cv_cloog_type" >&6; } - - case $gcc_cv_cloog_type in - "ISL") - clooginc="${clooginc} ${_cloogorginc}" - clooglibs="${clooglibs} -lcloog-isl -lisl" - cloog_org=yes - ;; - *) - clooglibs= - clooginc= - cloog_org= - ;; - esac - - LIBS=$_cloog_saved_LIBS - CFLAGS=$_cloog_saved_CFLAGS - CPPFLAGS=$_cloog_saved_CPPFLAGS - LDFLAGS=$_cloog_saved_LDFLAGS - - - - - if test "${ENABLE_CLOOG_CHECK}" = yes ; then _cloog_saved_CFLAGS=$CFLAGS _cloog_saved_LDFLAGS=$LDFLAGS - CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" - LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}" + CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${islinc} ${gmpinc}" + LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${isllibs} ${gmplib}" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.17.0 of CLooG" >&5 $as_echo_n "checking for version 0.17.0 of CLooG... " >&6; } @@ -5889,7 +5852,7 @@ if test "${gcc_cv_cloog+set}" = set; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include "cloog/cloog.h" +#include "cloog/version.h" int main () { @@ -7081,7 +7044,7 @@ do case $lib in - mpc | mpfr | gmp | ppl | cloog) + mpc | mpfr | gmp | cloog) # If we're processing --with-$lib, --with-$lib-include or # --with-$lib-lib, for one of the libs above, and target is # different from host, don't pass the current argument to any @@ -14331,9 +14294,6 @@ case "$target" in hppa*64*-*-hpux*) ;; hppa*-*-hpux*) compare_exclusions="gcc/cc*-checksum\$(objext) | */libgcc/lib2funcs* | gcc/ada/*tools/*" ;; esac -case " $configdirs " in -*" ppl "*) compare_exclusions="$compare_exclusions | ppl/src/ppl-config.o" ;; -esac ac_config_files="$ac_config_files Makefile" diff --git a/configure.ac b/configure.ac index 8b626145ac7..12b9c550726 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ m4_include([ltoptions.m4]) m4_include([ltsugar.m4]) m4_include([ltversion.m4]) m4_include([lt~obsolete.m4]) +m4_include([config/isl.m4]) m4_include([config/cloog.m4]) AC_INIT(move-if-change) @@ -132,7 +133,7 @@ build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes" # these libraries are used by various programs built for the host environment # -host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc ppl cloog libelf libiconv" +host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr mpc isl cloog libelf libiconv" # these tools are built for the host environment # Note, the powerpc-eabi build depends on sim occurring before gdb in order to @@ -1517,107 +1518,23 @@ AC_ARG_WITH(boot-ldflags, fi]) AC_SUBST(poststage1_ldflags) -# Check for PPL -ppllibs= -pplinc= -pwllib= +# Check for ISL +dnl Provide configure switches and initialize islinc & isllibs +dnl with user input. +ISL_INIT_FLAGS +if test "x$with_isl" != "xno"; then + dnl The minimal version of ISL required for Graphite. + ISL_CHECK_VERSION(0,10) -AC_ARG_WITH(ppl, -[AS_HELP_STRING([--with-ppl=PATH], - [specify prefix directory for the installed PPL package. - Equivalent to --with-ppl-include=PATH/include - plus --with-ppl-lib=PATH/lib])]) -AC_ARG_WITH(ppl-include, -[AS_HELP_STRING([--with-ppl-include=PATH], - [specify directory for installed PPL include files])]) -AC_ARG_WITH(ppl-lib, -[AS_HELP_STRING([--with-ppl-lib=PATH], - [specify directory for the installed PPL library])]) - -AC_ARG_ENABLE(ppl-version-check, -[AS_HELP_STRING([--disable-ppl-version-check], - [disable check for PPL version])]) - -case $with_ppl in - yes | no | "") - ;; - *) - ppllibs="-L$with_ppl/lib" - pplinc="-I$with_ppl/include $pplinc" - if test -d "$with_ppl/lib" && test -d "$with_ppl/include"; then - with_ppl=yes - else - AC_MSG_ERROR([cannot find directories "$with_ppl/lib" or "$with_ppl/include"]) - fi - ;; -esac - -if test x"$with_ppl_include" != x; then - pplinc="-I$with_ppl_include $pplinc" - with_ppl=yes + dnl Only execute fail-action, if ISL has been requested. + ISL_IF_FAILED([ + AC_MSG_ERROR([Unable to find a usable ISL. See config.log for details.])]) fi -if test "x$with_ppl_lib" != x; then - ppllibs="-L$with_ppl_lib" - with_ppl=yes -fi - -if test x"$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then - if test x"$enable_watchdog" = xyes; then - pwllib="-lpwl" - fi - ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/interfaces/C/'"$lt_cv_objdir"' -L$$r/$(HOST_SUBDIR)/ppl/src/'"$lt_cv_objdir" - pplinc='-I$$r/$(HOST_SUBDIR)/ppl/src -I$$r/$(HOST_SUBDIR)/ppl/interfaces/C ' - enable_ppl_version_check=no - with_ppl=yes -fi - -if test "x$with_ppl" != xno; then - if test "x$pwllib" = x; then - saved_LIBS="$LIBS" - LIBS="$LIBS $ppllibs -lstdc++ -lm" - AC_CHECK_LIB(pwl, PWL_handle_timeout, [pwllib="-lpwl"]) - LIBS="$saved_LIBS" - fi - - ppllibs="$ppllibs -lppl_c -lppl $pwllib -lgmpxx" - - if test "$enable_ppl_version_check" != no; then - saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $pplinc $gmpinc" - AC_MSG_CHECKING([for version 0.11 (revision 0 or later) of PPL]) - AC_TRY_COMPILE([#include "ppl_c.h"],[ - #if PPL_VERSION_MAJOR != 0 || PPL_VERSION_MINOR < 11 - choke me - #endif - ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); ppllibs= ; pplinc= ; with_ppl=no ]) - CFLAGS="$saved_CFLAGS" - fi -fi - -# Flags needed for PPL -AC_SUBST(ppllibs) -AC_SUBST(pplinc) - - # Check for CLOOG - dnl Provide configure switches and initialize clooginc & clooglibs dnl with user input. CLOOG_INIT_FLAGS -if test "x$with_ppl" = "xno"; then - dnl Only execute fail-action, if CLooG has been requested. - CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) - if test "${graphite_requested}" = yes; then - AC_MSG_ERROR([Unable to find a usable PPL. See config.log for details.]) - fi - with_cloog=no -fi -if test "x${with_cloog}" = x && test "x${with_cloog_include}" = x \ - && test "x${with_cloog_lib}" = x && test -d ${srcdir}/cloog; then - clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/'"$lt_cv_objdir"' ' - clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include ' -fi if test "x$with_cloog" != "xno"; then dnl The minimal version of CLooG required for Graphite. dnl @@ -2684,7 +2601,7 @@ changequote(,) changequote([,]) case $lib in - mpc | mpfr | gmp | ppl | cloog) + mpc | mpfr | gmp | cloog) # If we're processing --with-$lib, --with-$lib-include or # --with-$lib-lib, for one of the libs above, and target is # different from host, don't pass the current argument to any @@ -3266,9 +3183,6 @@ case "$target" in hppa*64*-*-hpux*) ;; hppa*-*-hpux*) compare_exclusions="gcc/cc*-checksum\$(objext) | */libgcc/lib2funcs* | gcc/ada/*tools/*" ;; esac -case " $configdirs " in -*" ppl "*) compare_exclusions="$compare_exclusions | ppl/src/ppl-config.o" ;; -esac AC_SUBST(compare_exclusions) AC_CONFIG_FILES([Makefile], diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38663dfd319..c02b77b4cbe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,34 @@ +2012-07-02 Richard Guenther + Michael Matz + Tobias Grosser + Sebastian Pop + + * Makefile.in: Remove PPL flags in favor of ISL ones. + (BACKENDLIBS): Remove PPL libs. + (INCLUDES): Remove PPL includes in favor of ISL ones. + (graphite-clast-to-gimple.o): Remove graphite-dependences.h and + graphite-cloog-compat.h dependencies. + (graphite-dependences.o): Likewise. + (graphite-poly.o): Likewise. + * configure.ac: Declare ISL vars instead of PPL ones. + * configure: Regenerated. + * doc/install.texi: Replace PPL requirement documentation + with ISL one. + * graphite-blocking.c: Remove PPL code, add ISL equivalent. + * graphite-clast-to-gimple.c: Likewise. + * graphite-dependences.c: Likewise. + * graphite-interchange.c: Likewise. + * graphite-poly.h: Likewise. + * graphite-poly.c: Likewise. + * graphite-sese-to-poly.c: Likewise. + * graphite.c: Likewise. + * graphite-scop-detection.c: Re-arrange includes. + * graphite-cloog-util.c: Remove. + * graphite-cloog-util.h: Likewise. + * graphite-ppl.h: Likewise. + * graphite-ppl.c: Likewise. + * graphite-dependences.h: Likewise. + 2012-07-02 Richard Guenther Merge from graphite branch diff --git a/gcc/Makefile.in b/gcc/Makefile.in index d97637859b7..ec39e2eeaaa 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -325,9 +325,8 @@ ZLIBINC = @zlibinc@ GMPLIBS = @GMPLIBS@ GMPINC = @GMPINC@ -# How to find PPL -PPLLIBS = @PPLLIBS@ -PPLINC = @PPLINC@ +# How to find ISL +ISLINC = @ISLINC@ # How to find CLOOG CLOOGLIBS = @CLOOGLIBS@ @@ -954,7 +953,6 @@ REAL_H = real.h $(MACHMODE_H) IRA_INT_H = ira.h ira-int.h $(CFGLOOP_H) alloc-pool.h DBGCNT_H = dbgcnt.h dbgcnt.def EBITMAP_H = ebitmap.h sbitmap.h -GRAPHITE_PPL_H = graphite-ppl.h $(TREE_H) LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \ $(CGRAPH_H) $(VEC_H) vecprim.h $(TREE_H) $(GIMPLE_H) \ $(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h @@ -1027,7 +1025,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # and the system's installed libraries. LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) \ $(LIBDECNUMBER) $(HOST_LIBS) -BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ +BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ $(ZLIB) # Any system libraries needed just for GNAT. SYSLIBS = @GNAT_LIBEXC@ @@ -1059,7 +1057,7 @@ BUILD_ERRORS = build/errors.o INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -I$(srcdir)/../include @INCINTL@ \ $(CPPINC) $(GMPINC) $(DECNUMINC) \ - $(PPLINC) $(CLOOGINC) + $(CLOOGINC) $(ISLINC) .c.o: $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) @@ -1248,11 +1246,9 @@ OBJS = \ graphite.o \ graphite-blocking.o \ graphite-clast-to-gimple.o \ - graphite-cloog-util.o \ graphite-dependences.o \ graphite-interchange.o \ graphite-poly.o \ - graphite-ppl.o \ graphite-scop-detection.o \ graphite-sese-to-poly.o \ gtype-desc.o \ @@ -2539,37 +2535,30 @@ sese.o : sese.c sese.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_PRETTY_PRINT_H $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) value-prof.h graphite.o : graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) \ $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h \ - $(DBGCNT_H) $(GRAPHITE_PPL_H) graphite-poly.h graphite-scop-detection.h \ + $(DBGCNT_H) graphite-poly.h graphite-scop-detection.h \ graphite-clast-to-gimple.h graphite-sese-to-poly.h graphite-blocking.o : graphite-blocking.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \ - sese.h $(GRAPHITE_PPL_H) graphite-poly.h + sese.h graphite-poly.h graphite-clast-to-gimple.o : graphite-clast-to-gimple.c $(CONFIG_H) \ $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \ - $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-cloog-util.h \ - $(GRAPHITE_PPL_H) graphite-poly.h graphite-clast-to-gimple.h \ - graphite-dependences.h -graphite-cloog-util.o : graphite-cloog-util.c $(CONFIG_H) $(SYSTEM_H) \ - coretypes.h graphite-cloog-util.h + $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h \ + graphite-poly.h graphite-clast-to-gimple.h graphite-dependences.o : graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \ - sese.h $(GRAPHITE_PPL_H) graphite-poly.h graphite-dependences.h \ - graphite-cloog-util.h + sese.h graphite-poly.h graphite-interchange.o : graphite-interchange.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \ - sese.h $(GRAPHITE_PPL_H) graphite-poly.h + sese.h graphite-poly.h graphite-poly.o : graphite-poly.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(GIMPLE_PRETTY_PRINT_H) \ - $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h $(GRAPHITE_PPL_H) graphite-poly.h \ - graphite-dependences.h graphite-cloog-util.h -graphite-ppl.o : graphite-ppl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - graphite-cloog-util.h $(GRAPHITE_PPL_H) + $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-poly.h graphite-scop-detection.o : graphite-scop-detection.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) \ - sese.h $(GRAPHITE_PPL_H) graphite-poly.h graphite-scop-detection.h + sese.h graphite-poly.h graphite-scop-detection.h graphite-sese-to-poly.o : graphite-sese-to-poly.c $(CONFIG_H) \ $(SYSTEM_H) coretypes.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) \ - $(TREE_DATA_REF_H) domwalk.h sese.h $(GRAPHITE_PPL_H) graphite-poly.h \ + $(TREE_DATA_REF_H) domwalk.h sese.h graphite-poly.h \ graphite-sese-to-poly.h tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \ diff --git a/gcc/configure b/gcc/configure index 0bdbece6ae8..fd3be5231b8 100755 --- a/gcc/configure +++ b/gcc/configure @@ -604,8 +604,8 @@ enable_plugin pluginlibs CLOOGINC CLOOGLIBS -PPLINC -PPLLIBS +ISLINC +ISLLIBS GMPINC GMPLIBS target_cpu_default @@ -934,8 +934,8 @@ CPP CXXCPP GMPLIBS GMPINC -PPLLIBS -PPLINC +ISLLIBS +ISLINC CLOOGLIBS CLOOGINC' @@ -1687,8 +1687,8 @@ Some influential environment variables: CXXCPP C++ preprocessor GMPLIBS How to link GMP GMPINC How to find GMP include files - PPLLIBS How to link PPL - PPLINC How to find PPL include files + ISLLIBS How to link ISL + ISLINC How to find ISL include files CLOOGLIBS How to link CLOOG CLOOGINC How to find CLOOG include files diff --git a/gcc/configure.ac b/gcc/configure.ac index 7891fcc39da..89644e2dd96 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4987,8 +4987,8 @@ fi AC_ARG_VAR(GMPLIBS,[How to link GMP]) AC_ARG_VAR(GMPINC,[How to find GMP include files]) -AC_ARG_VAR(PPLLIBS,[How to link PPL]) -AC_ARG_VAR(PPLINC,[How to find PPL include files]) +AC_ARG_VAR(ISLLIBS,[How to link ISL]) +AC_ARG_VAR(ISLINC,[How to find ISL include files]) AC_ARG_VAR(CLOOGLIBS,[How to link CLOOG]) AC_ARG_VAR(CLOOGINC,[How to find CLOOG include files]) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index b262bee76c9..436f6567d53 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -362,12 +362,12 @@ installed but it is not in your default library search path, the @option{--with-mpc} configure option should be used. See also @option{--with-mpc-lib} and @option{--with-mpc-include}. -@item Parma Polyhedra Library (PPL) version 0.11 +@item ISL Library version 0.10 Necessary to build GCC with the Graphite loop optimizations. -It can be downloaded from @uref{http://www.cs.unipr.it/ppl/Download/}. +It can be downloaded from @uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/}. -The @option{--with-ppl} configure option should be used if PPL is not +The @option{--with-isl} configure option should be used if ISL is not installed in your default library search path. @item CLooG 0.17.0 @@ -1630,14 +1630,14 @@ a cross compiler, they will not be used to configure target libraries. @itemx --with-cloog=@var{pathname} @itemx --with-cloog-include=@var{pathname} @itemx --with-cloog-lib=@var{pathname} -If you do not have PPL (the Parma Polyhedra Library) and the CLooG +If you do not have ISL and the CLooG libraries installed in a standard location and you want to build GCC, you can explicitly specify the directory where they are installed -(@samp{--with-ppl=@/@var{pplinstalldir}}, +(@samp{--with-isl=@/@var{islinstalldir}}, @samp{--with-cloog=@/@var{clooginstalldir}}). The -@option{--with-ppl=@/@var{pplinstalldir}} option is shorthand for -@option{--with-ppl-lib=@/@var{pplinstalldir}/lib} and -@option{--with-ppl-include=@/@var{pplinstalldir}/include}. Likewise the +@option{--with-isl=@/@var{islinstalldir}} option is shorthand for +@option{--with-isl-lib=@/@var{islinstalldir}/lib} and +@option{--with-isl-include=@/@var{islinstalldir}/include}. Likewise the @option{--with-cloog=@/@var{clooginstalldir}} option is shorthand for @option{--with-cloog-lib=@/@var{clooginstalldir}/lib} and @option{--with-cloog-include=@/@var{clooginstalldir}/include}. If these diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c index 967de9d9462..b4ac522850a 100644 --- a/gcc/graphite-blocking.c +++ b/gcc/graphite-blocking.c @@ -1,7 +1,7 @@ /* Heuristics and transform for loop blocking and strip mining on polyhedral representation. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop and Pranav Garg . @@ -20,7 +20,18 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ + #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "tree-flow.h" @@ -31,8 +42,6 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" @@ -92,65 +101,39 @@ along with GCC; see the file COPYING3. If not see static void pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride) { - ppl_dimension_type iter, dim, strip; - ppl_Polyhedron_t res = PBB_TRANSFORMED_SCATTERING (pbb); + isl_space *d; + isl_constraint *c; + int iter, strip; /* STRIP is the dimension that iterates with stride STRIDE. */ /* ITER is the dimension that enumerates single iterations inside one strip that has at most STRIDE iterations. */ strip = time_depth; iter = strip + 2; - psct_add_scattering_dimension (pbb, strip); - psct_add_scattering_dimension (pbb, strip + 1); - - ppl_Polyhedron_space_dimension (res, &dim); + pbb->transformed = isl_map_insert_dims (pbb->transformed, isl_dim_out, + strip, 2); /* Lower bound of the striped loop. */ - { - ppl_Constraint_t new_cstr; - ppl_Linear_Expression_t expr; - - ppl_new_Linear_Expression_with_dimension (&expr, dim); - ppl_set_coef (expr, strip, -1 * stride); - ppl_set_coef (expr, iter, 1); - - ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_delete_Linear_Expression (expr); - ppl_Polyhedron_add_constraint (res, new_cstr); - ppl_delete_Constraint (new_cstr); - } + d = isl_map_get_space (pbb->transformed); + c = isl_inequality_alloc (isl_local_space_from_space (d)); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, strip, -stride); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, iter, 1); + pbb->transformed = isl_map_add_constraint (pbb->transformed, c); /* Upper bound of the striped loop. */ - { - ppl_Constraint_t new_cstr; - ppl_Linear_Expression_t expr; - - ppl_new_Linear_Expression_with_dimension (&expr, dim); - ppl_set_coef (expr, strip, stride); - ppl_set_coef (expr, iter, -1); - ppl_set_inhomogeneous (expr, stride - 1); - - ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_delete_Linear_Expression (expr); - ppl_Polyhedron_add_constraint (res, new_cstr); - ppl_delete_Constraint (new_cstr); - } + d = isl_map_get_space (pbb->transformed); + c = isl_inequality_alloc (isl_local_space_from_space (d)); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, strip, stride); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, iter, -1); + c = isl_constraint_set_constant_si (c, stride - 1); + pbb->transformed = isl_map_add_constraint (pbb->transformed, c); /* Static scheduling for ITER level. This is mandatory to keep the 2d + 1 canonical scheduling format. */ - { - ppl_Constraint_t new_cstr; - ppl_Linear_Expression_t expr; - - ppl_new_Linear_Expression_with_dimension (&expr, dim); - ppl_set_coef (expr, strip + 1, 1); - ppl_set_inhomogeneous (expr, 0); - - ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_delete_Linear_Expression (expr); - ppl_Polyhedron_add_constraint (res, new_cstr); - ppl_delete_Constraint (new_cstr); - } + d = isl_map_get_space (pbb->transformed); + c = isl_equality_alloc (isl_local_space_from_space (d)); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, strip + 1, 1); + pbb->transformed = isl_map_add_constraint (pbb->transformed, c); } /* Returns true when strip mining with STRIDE of the loop LST is diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 9ab746e152b..0219afeea80 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -19,6 +19,19 @@ along with GCC; see the file COPYING3. If not see . */ #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "diagnostic-core.h" @@ -32,12 +45,8 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_cloog #include "cloog/cloog.h" -#include "ppl_c.h" -#include "graphite-cloog-util.h" -#include "graphite-ppl.h" #include "graphite-poly.h" #include "graphite-clast-to-gimple.h" -#include "graphite-dependences.h" typedef const struct clast_expr *clast_name_p; @@ -45,6 +54,47 @@ typedef const struct clast_expr *clast_name_p; #define CLOOG_LANGUAGE_C LANGUAGE_C #endif + +/* Converts a GMP constant VAL to a tree and returns it. */ + +static tree +gmp_cst_to_tree (tree type, mpz_t val) +{ + tree t = type ? type : integer_type_node; + mpz_t tmp; + double_int di; + + mpz_init (tmp); + mpz_set (tmp, val); + di = mpz_get_double_int (t, tmp, true); + mpz_clear (tmp); + + return double_int_to_tree (t, di); +} + +/* Sets RES to the min of V1 and V2. */ + +static void +value_min (mpz_t res, mpz_t v1, mpz_t v2) +{ + if (mpz_cmp (v1, v2) < 0) + mpz_set (res, v1); + else + mpz_set (res, v2); +} + +/* Sets RES to the max of V1 and V2. */ + +static void +value_max (mpz_t res, mpz_t v1, mpz_t v2) +{ + if (mpz_cmp (v1, v2) < 0) + mpz_set (res, v2); + else + mpz_set (res, v1); +} + + /* This flag is set when an error occurred during the translation of CLAST to Gimple. */ static bool gloog_error; @@ -695,23 +745,18 @@ type_for_clast_expr (struct clast_expr *e, ivs_params_p ip, mpz_t bound_one, return NULL_TREE; } -/* Returns the type for the equation CLEQ. */ +/* Returns true if the clast expression E is a constant with VALUE. */ -static tree -type_for_clast_eq (struct clast_equation *cleq, ivs_params_p ip) +static bool +clast_expr_const_value_p (struct clast_expr *e, int value) { - mpz_t bound_one, bound_two; - tree l, r; - - mpz_init (bound_one); - mpz_init (bound_two); - - l = type_for_clast_expr (cleq->LHS, ip, bound_one, bound_two); - r = type_for_clast_expr (cleq->RHS, ip, bound_one, bound_two); - - mpz_clear (bound_one); - mpz_clear (bound_two); - return max_precision_type (l, r); + struct clast_term *t; + if (e->type != clast_expr_term) + return false; + t = (struct clast_term *)e; + if (t->var) + return false; + return 0 == mpz_cmp_si (t->val, value); } /* Translates a clast equation CLEQ to a tree. */ @@ -721,19 +766,49 @@ graphite_translate_clast_equation (struct clast_equation *cleq, ivs_params_p ip) { enum tree_code comp; - tree type = type_for_clast_eq (cleq, ip); - tree lhs = clast_to_gcc_expression (type, cleq->LHS, ip); - tree rhs = clast_to_gcc_expression (type, cleq->RHS, ip); + tree type, lhs, rhs, ltype, rtype; + mpz_t bound_one, bound_two; + struct clast_expr *clhs, *crhs; + clhs = cleq->LHS; + crhs = cleq->RHS; if (cleq->sign == 0) comp = EQ_EXPR; - else if (cleq->sign > 0) comp = GE_EXPR; - else comp = LE_EXPR; + /* Special cases to reduce range of arguments to hopefully + don't need types with larger precision than the input. */ + if (crhs->type == clast_expr_red + && comp != EQ_EXPR) + { + struct clast_reduction *r = (struct clast_reduction *) crhs; + /* X >= A+1 --> X > A and + X <= A-1 --> X < A */ + if (r->n == 2 + && r->type == clast_red_sum + && clast_expr_const_value_p (r->elts[1], comp == GE_EXPR ? 1 : -1)) + { + crhs = r->elts[0]; + comp = comp == GE_EXPR ? GT_EXPR : LT_EXPR; + } + } + + mpz_init (bound_one); + mpz_init (bound_two); + + ltype = type_for_clast_expr (clhs, ip, bound_one, bound_two); + rtype = type_for_clast_expr (crhs, ip, bound_one, bound_two); + + mpz_clear (bound_one); + mpz_clear (bound_two); + type = max_precision_type (ltype, rtype); + + lhs = clast_to_gcc_expression (type, clhs, ip); + rhs = clast_to_gcc_expression (type, crhs, ip); + return fold_build2 (comp, boolean_type_node, lhs, rhs); } @@ -776,87 +851,59 @@ graphite_create_new_guard (edge entry_edge, struct clast_guard *stmt, static void compute_bounds_for_param (scop_p scop, int param, mpz_t low, mpz_t up) { - ppl_Linear_Expression_t le; + isl_int v; + isl_aff *aff = isl_aff_zero_on_domain + (isl_local_space_from_space (isl_set_get_space (scop->context))); - /* Prepare the linear expression corresponding to the parameter that - we want to maximize/minimize. */ - ppl_new_Linear_Expression_with_dimension (&le, scop_nb_params (scop)); - ppl_set_coef (le, param, 1); + aff = isl_aff_add_coefficient_si (aff, isl_dim_param, param, 1); - ppl_max_for_le_pointset (SCOP_CONTEXT (scop), le, up); - ppl_min_for_le_pointset (SCOP_CONTEXT (scop), le, low); - ppl_delete_Linear_Expression (le); + isl_int_init (v); + isl_set_min (scop->context, aff, &v); + isl_int_get_gmp (v, low); + isl_set_max (scop->context, aff, &v); + isl_int_get_gmp (v, up); + isl_int_clear (v); + isl_aff_free (aff); } /* Compute the lower bound LOW and upper bound UP for the induction - variable at LEVEL for the statement PBB, based on the transformed - scattering of PBB: T|I|G|Cst, with T the scattering transform, I - the iteration domain, and G the context parameters. */ + variable of loop LOOP. + + FIXME: This one is not entirely correct, as min/max expressions in the + calculation can yield to incorrect results. To be completely + correct, we need to evaluate each subexpression generated by + CLooG. CLooG does not yet support this, so this is as good as + it can be. */ static void -compute_bounds_for_level (poly_bb_p pbb, int level, mpz_t low, mpz_t up) +compute_bounds_for_loop (struct clast_for *loop, mpz_t low, mpz_t up) { - ppl_Pointset_Powerset_C_Polyhedron_t ps; - ppl_Linear_Expression_t le; + isl_set *domain; + isl_aff *dimension; + isl_local_space *local_space; + isl_int isl_value; + enum isl_lp_result lp_result; - combine_context_id_scat (&ps, pbb, false); + domain = isl_set_copy (isl_set_from_cloog_domain (loop->domain)); + local_space = isl_local_space_from_space (isl_set_get_space (domain)); + dimension = isl_aff_zero_on_domain (local_space); + dimension = isl_aff_add_coefficient_si (dimension, isl_dim_in, + isl_set_dim (domain, isl_dim_set) - 1, + 1); - /* Prepare the linear expression corresponding to the level that we - want to maximize/minimize. */ - { - ppl_dimension_type dim = pbb_nb_scattering_transform (pbb) - + pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb); + isl_int_init (isl_value); - ppl_new_Linear_Expression_with_dimension (&le, dim); - ppl_set_coef (le, psct_dynamic_dim (pbb, level), 1); - } + lp_result = isl_set_min (domain, dimension, &isl_value); + assert (lp_result == isl_lp_ok); + isl_int_get_gmp (isl_value, low); - ppl_max_for_le_pointset (ps, le, up); - ppl_min_for_le_pointset (ps, le, low); - ppl_delete_Linear_Expression (le); - ppl_delete_Pointset_Powerset_C_Polyhedron (ps); -} + lp_result = isl_set_max (domain, dimension, &isl_value); + assert (lp_result == isl_lp_ok); + isl_int_get_gmp (isl_value, up); -/* Walks a CLAST and returns the first statement in the body of a - loop. - - FIXME: This function should not be used to get a PBB in the STMT - loop in order to find out the iteration domain of the loop: the - counter example from Tobias is: - - | for (i = 0; i < 100; i++) - | { - | if (i == 0) - | S1; - | S2; - | } - - This function would return S1 whose iteration domain contains only - one point "i = 0", whereas the iteration domain of S2 has 100 points. - - This should be implemented using some functionality existing in - CLooG-ISL. */ - -static struct clast_user_stmt * -clast_get_body_of_loop (struct clast_stmt *stmt) -{ - if (!stmt - || CLAST_STMT_IS_A (stmt, stmt_user)) - return (struct clast_user_stmt *) stmt; - - if (CLAST_STMT_IS_A (stmt, stmt_for)) - return clast_get_body_of_loop (((struct clast_for *) stmt)->body); - - if (CLAST_STMT_IS_A (stmt, stmt_guard)) - return clast_get_body_of_loop (((struct clast_guard *) stmt)->then); - - if (CLAST_STMT_IS_A (stmt, stmt_block)) - return clast_get_body_of_loop (((struct clast_block *) stmt)->body); - - if (CLAST_STMT_IS_A (stmt, stmt_ass)) - return clast_get_body_of_loop (stmt->next); - - gcc_unreachable (); + isl_int_clear (isl_value); + isl_set_free (domain); + isl_aff_free (dimension); } /* Returns the type for the induction variable for the loop translated @@ -895,10 +942,6 @@ graphite_create_new_loop (edge entry_edge, struct clast_for *stmt, { mpz_t low, up; - struct clast_user_stmt *body - = clast_get_body_of_loop ((struct clast_stmt *) stmt); - poly_bb_p pbb = (poly_bb_p) body->statement->usr; - tree stride = gmp_cst_to_tree (type, stmt->stride); tree ivvar = create_tmp_var (type, "graphite_IV"); tree iv, iv_after_increment; @@ -910,7 +953,7 @@ graphite_create_new_loop (edge entry_edge, struct clast_for *stmt, mpz_init (low); mpz_init (up); - compute_bounds_for_level (pbb, level, low, up); + compute_bounds_for_loop (stmt, low, up); save_clast_name_index (ip->newivs_index, stmt->iterator, VEC_length (tree, *(ip->newivs)), level, low, up); mpz_clear (low); @@ -982,7 +1025,7 @@ mark_bb_with_pbb (poly_bb_p pbb, basic_block bb, htab_t bb_pbb_mapping) /* Find BB's related poly_bb_p in hash table BB_PBB_MAPPING. */ -static poly_bb_p +poly_bb_p find_pbb_via_hash (htab_t bb_pbb_mapping, basic_block bb) { bb_pbb_def tmp; @@ -997,41 +1040,32 @@ find_pbb_via_hash (htab_t bb_pbb_mapping, basic_block bb) return NULL; } -/* Check data dependency in LOOP at level LEVEL. - BB_PBB_MAPPING is a basic_block and it's related poly_bb_p - mapping. */ +/* Return the scop of the loop and initialize PBBS the set of + poly_bb_p that belong to the LOOP. BB_PBB_MAPPING is a map created + by the CLAST code generator between a generated basic_block and its + related poly_bb_p. */ -static bool -dependency_in_loop_p (loop_p loop, htab_t bb_pbb_mapping, int level) +scop_p +get_loop_body_pbbs (loop_p loop, htab_t bb_pbb_mapping, + VEC (poly_bb_p, heap) **pbbs) { - unsigned i,j; + unsigned i; basic_block *bbs = get_loop_body_in_dom_order (loop); + scop_p scop = NULL; for (i = 0; i < loop->num_nodes; i++) { - poly_bb_p pbb1 = find_pbb_via_hash (bb_pbb_mapping, bbs[i]); + poly_bb_p pbb = find_pbb_via_hash (bb_pbb_mapping, bbs[i]); - if (pbb1 == NULL) - continue; + if (pbb == NULL) + continue; - for (j = 0; j < loop->num_nodes; j++) - { - poly_bb_p pbb2 = find_pbb_via_hash (bb_pbb_mapping, bbs[j]); - - if (pbb2 == NULL) - continue; - - if (dependency_between_pbbs_p (pbb1, pbb2, level)) - { - free (bbs); - return true; - } - } + scop = PBB_SCOP (pbb); + VEC_safe_push (poly_bb_p, heap, *pbbs, pbb); } free (bbs); - - return false; + return scop; } /* Translates a clast user statement STMT to gimple. @@ -1138,7 +1172,7 @@ translate_clast_for_loop (loop_p context_loop, struct clast_for *stmt, set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src); if (flag_loop_parallelize_all - && !dependency_in_loop_p (loop, bb_pbb_mapping, level)) + && loop_is_parallel_p (loop, bb_pbb_mapping, level)) loop->can_be_parallel = true; return last_e; @@ -1358,14 +1392,52 @@ init_cloog_input_file (int scop_number) return graphite_out_file; } +/* Extend the scattering to NEW_DIMS scattering dimensions. */ + +static +isl_map *extend_scattering(isl_map *scattering, int new_dims) +{ + int old_dims, i; + isl_space *space; + isl_basic_map *change_scattering; + isl_map *change_scattering_map; + + old_dims = isl_map_dim (scattering, isl_dim_out); + + space = isl_space_alloc (isl_map_get_ctx (scattering), 0, old_dims, new_dims); + change_scattering = isl_basic_map_universe (isl_space_copy (space)); + + for (i = 0; i < old_dims; i++) + { + isl_constraint *c; + c = isl_equality_alloc + (isl_local_space_from_space (isl_space_copy (space))); + isl_constraint_set_coefficient_si (c, isl_dim_in, i, 1); + isl_constraint_set_coefficient_si (c, isl_dim_out, i, -1); + change_scattering = isl_basic_map_add_constraint (change_scattering, c); + } + + for (i = old_dims; i < new_dims; i++) + { + isl_constraint *c; + c = isl_equality_alloc + (isl_local_space_from_space (isl_space_copy (space))); + isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1); + change_scattering = isl_basic_map_add_constraint (change_scattering, c); + } + + change_scattering_map = isl_map_from_basic_map (change_scattering); + change_scattering_map = isl_map_align_params (change_scattering_map, space); + return isl_map_apply_range (scattering, change_scattering_map); +} + /* Build cloog union domain for SCoP. */ static CloogUnionDomain * -build_cloog_union_domain (scop_p scop) +build_cloog_union_domain (scop_p scop, int nb_scattering_dims) { int i; poly_bb_p pbb; - CloogUnionDomain *union_domain = cloog_union_domain_alloc (scop_nb_params (scop)); @@ -1376,16 +1448,12 @@ build_cloog_union_domain (scop_p scop) /* Dead code elimination: when the domain of a PBB is empty, don't generate code for the PBB. */ - if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (PBB_DOMAIN (pbb))) + if (isl_set_is_empty(pbb->domain)) continue; - domain = new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb), - scop_nb_params (scop), - cloog_state); - - scattering = new_Cloog_Scattering_from_ppl_Polyhedron - (PBB_TRANSFORMED_SCATTERING (pbb), scop_nb_params (scop), - pbb_nb_scattering_transform (pbb), cloog_state); + domain = cloog_domain_from_isl_set(isl_set_copy(pbb->domain)); + scattering = cloog_scattering_from_isl_map(extend_scattering(isl_map_copy(pbb->transformed), + nb_scattering_dims)); union_domain = cloog_union_domain_add_domain (union_domain, "", domain, scattering, pbb); @@ -1422,6 +1490,11 @@ set_cloog_options (void) A */ options->strides = 1; + /* We want the clast to provide the iteration domains of the executed loops. + This allows us to derive minimal/maximal values for the induction + variables. */ + options->save_domains = 1; + /* Disable optimizations and make cloog generate source code closer to the input. This is useful for debugging, but later we want the optimized code. @@ -1456,20 +1529,38 @@ debug_clast_stmt (struct clast_stmt *stmt) print_clast_stmt (stderr, stmt); } +/* Get the maximal number of scattering dimensions in the scop SCOP. */ + +static +int get_max_scattering_dimensions (scop_p scop) +{ + int i; + poly_bb_p pbb; + int scattering_dims = 0; + + FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) + { + int pbb_scatt_dims = isl_map_dim (pbb->transformed, isl_dim_out); + if (pbb_scatt_dims > scattering_dims) + scattering_dims = pbb_scatt_dims; + } + + return scattering_dims; +} + static CloogInput * generate_cloog_input (scop_p scop, htab_t params_index) { CloogUnionDomain *union_domain; CloogInput *cloog_input; CloogDomain *context; + int nb_scattering_dims = get_max_scattering_dimensions (scop); - int nb_scattering_dims = unify_scattering_dimensions (scop); - union_domain = build_cloog_union_domain (scop); + union_domain = build_cloog_union_domain (scop, nb_scattering_dims); union_domain = add_names_to_union_domain (scop, union_domain, nb_scattering_dims, params_index); - context = new_Cloog_Domain_from_ppl_Pointset_Powerset - (SCOP_CONTEXT (scop), scop_nb_params (scop), cloog_state); + context = cloog_domain_from_isl_set (isl_set_copy (scop->context)); cloog_input = cloog_input_alloc (context, union_domain); diff --git a/gcc/graphite-clast-to-gimple.h b/gcc/graphite-clast-to-gimple.h index c82bb6a53b2..8fdee90856b 100644 --- a/gcc/graphite-clast-to-gimple.h +++ b/gcc/graphite-clast-to-gimple.h @@ -21,8 +21,6 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_GRAPHITE_CLAST_TO_GIMPLE_H #define GCC_GRAPHITE_CLAST_TO_GIMPLE_H -#include "graphite-cloog-util.h" - extern CloogState *cloog_state; /* Data structure for CLooG program representation. */ diff --git a/gcc/graphite-cloog-util.c b/gcc/graphite-cloog-util.c deleted file mode 100644 index 83cfb54eb1e..00000000000 --- a/gcc/graphite-cloog-util.c +++ /dev/null @@ -1,409 +0,0 @@ -/* Gimple Represented as Polyhedra. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. - Contributed by Sebastian Pop - and Tobias Grosser . - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#include "config.h" -#include "system.h" -#include "coretypes.h" - -#ifdef HAVE_cloog - -#include "ppl_c.h" -#include "cloog/cloog.h" -#include "graphite-cloog-util.h" - -/* Counts the number of constraints in PCS. */ - -static int -ppl_Constrain_System_number_of_constraints (ppl_const_Constraint_System_t pcs) -{ - ppl_Constraint_System_const_iterator_t cit, end; - int num = 0; - - ppl_new_Constraint_System_const_iterator (&cit); - ppl_new_Constraint_System_const_iterator (&end); - - for (ppl_Constraint_System_begin (pcs, cit), - ppl_Constraint_System_end (pcs, end); - !ppl_Constraint_System_const_iterator_equal_test (cit, end); - ppl_Constraint_System_const_iterator_increment (cit)) - num++; - - ppl_delete_Constraint_System_const_iterator (cit); - ppl_delete_Constraint_System_const_iterator (end); - return num; -} - -static void -oppose_constraint (CloogMatrix *m, int row) -{ - int k; - - /* Do not oppose the first column: it is the eq/ineq one. */ - /* Cast needed to remove warning that is generated as CLooG isl - is using an unsigned int for NbColumns and CLooG PPL is - using a signed int for NBColumns. */ - for (k = 1; k < (int)m->NbColumns; k++) - mpz_neg (m->p[row][k], m->p[row][k]); -} - -/* Inserts constraint CSTR at row ROW of matrix M. */ - -static void -insert_constraint_into_matrix (CloogMatrix *m, int row, - ppl_const_Constraint_t cstr) -{ - ppl_Coefficient_t c; - ppl_dimension_type i, dim, nb_cols = m->NbColumns; - - ppl_Constraint_space_dimension (cstr, &dim); - ppl_new_Coefficient (&c); - - for (i = 0; i < dim; i++) - { - ppl_Constraint_coefficient (cstr, i, c); - ppl_Coefficient_to_mpz_t (c, m->p[row][i + 1]); - } - - for (i = dim; i < nb_cols - 1; i++) - mpz_set_si (m->p[row][i + 1], 0); - - ppl_Constraint_inhomogeneous_term (cstr, c); - ppl_Coefficient_to_mpz_t (c, m->p[row][nb_cols - 1]); - mpz_set_si (m->p[row][0], 1); - - switch (ppl_Constraint_type (cstr)) - { - case PPL_CONSTRAINT_TYPE_LESS_THAN: - oppose_constraint (m, row); - case PPL_CONSTRAINT_TYPE_GREATER_THAN: - mpz_sub_ui (m->p[row][nb_cols - 1], - m->p[row][nb_cols - 1], 1); - break; - - case PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL: - oppose_constraint (m, row); - case PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL: - break; - - case PPL_CONSTRAINT_TYPE_EQUAL: - mpz_set_si (m->p[row][0], 0); - break; - - default: - /* Not yet implemented. */ - gcc_unreachable(); - } - - ppl_delete_Coefficient (c); -} - -/* Creates a CloogMatrix from constraint system PCS. */ - -static CloogMatrix * -new_Cloog_Matrix_from_ppl_Constraint_System (ppl_const_Constraint_System_t pcs) -{ - CloogMatrix *matrix; - ppl_Constraint_System_const_iterator_t cit, end; - ppl_dimension_type dim; - int rows; - int row = 0; - - rows = ppl_Constrain_System_number_of_constraints (pcs); - ppl_Constraint_System_space_dimension (pcs, &dim); - matrix = cloog_matrix_alloc (rows, dim + 2); - ppl_new_Constraint_System_const_iterator (&cit); - ppl_new_Constraint_System_const_iterator (&end); - - for (ppl_Constraint_System_begin (pcs, cit), - ppl_Constraint_System_end (pcs, end); - !ppl_Constraint_System_const_iterator_equal_test (cit, end); - ppl_Constraint_System_const_iterator_increment (cit)) - { - ppl_const_Constraint_t c; - ppl_Constraint_System_const_iterator_dereference (cit, &c); - insert_constraint_into_matrix (matrix, row, c); - row++; - } - - ppl_delete_Constraint_System_const_iterator (cit); - ppl_delete_Constraint_System_const_iterator (end); - - return matrix; -} - -/* Creates a CloogMatrix from polyhedron PH. */ - -CloogMatrix * -new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph) -{ - ppl_const_Constraint_System_t pcs; - CloogMatrix *res; - - ppl_Polyhedron_get_constraints (ph, &pcs); - res = new_Cloog_Matrix_from_ppl_Constraint_System (pcs); - - return res; -} - -/* Translates row ROW of the CloogMatrix MATRIX to a PPL Constraint. */ - -static ppl_Constraint_t -cloog_matrix_to_ppl_constraint (CloogMatrix *matrix, int row) -{ - int j; - ppl_Constraint_t cstr; - ppl_Coefficient_t coef; - ppl_Linear_Expression_t expr; - ppl_dimension_type dim = matrix->NbColumns - 2; - - ppl_new_Coefficient (&coef); - ppl_new_Linear_Expression_with_dimension (&expr, dim); - - /* Cast needed to remove warning that is generated as CLooG isl - is using an unsigned int for NbColumns and CLooG PPL is - using a signed int for NBColumns. */ - for (j = 1; j < (int)matrix->NbColumns - 1; j++) - { - ppl_assign_Coefficient_from_mpz_t (coef, matrix->p[row][j]); - ppl_Linear_Expression_add_to_coefficient (expr, j - 1, coef); - } - - ppl_assign_Coefficient_from_mpz_t (coef, - matrix->p[row][matrix->NbColumns - 1]); - ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); - ppl_delete_Coefficient (coef); - - if (mpz_sgn (matrix->p[row][0]) == 0) - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); - else - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - - ppl_delete_Linear_Expression (expr); - return cstr; -} - -/* Creates a PPL constraint system from MATRIX. */ - -static void -new_Constraint_System_from_Cloog_Matrix (ppl_Constraint_System_t *pcs, - CloogMatrix *matrix) -{ - int i; - - ppl_new_Constraint_System (pcs); - - /* Cast needed to remove warning that is generated as CLooG isl - is using an unsigned int for NbColumns and CLooG PPL is - using a signed int for NBColumns. */ - for (i = 0; i < (int)matrix->NbRows; i++) - { - ppl_Constraint_t c = cloog_matrix_to_ppl_constraint (matrix, i); - ppl_Constraint_System_insert_Constraint (*pcs, c); - ppl_delete_Constraint (c); - } -} - -/* Creates a PPL Polyhedron from MATRIX. */ - -void -new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *ph, - CloogMatrix *matrix) -{ - ppl_Constraint_System_t cs; - new_Constraint_System_from_Cloog_Matrix (&cs, matrix); - ppl_new_C_Polyhedron_recycle_Constraint_System (ph, cs); -} - -/* Creates a CloogDomain from polyhedron PH. */ - -CloogDomain * -new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, int nb_params, - CloogState *state) -{ - CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); - CloogDomain *res = cloog_domain_from_cloog_matrix (state, mat, nb_params); - cloog_matrix_free (mat); - return res; -} - -/* Create a CloogScattering from polyhedron PH. */ - -CloogScattering * -new_Cloog_Scattering_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, - int nb_params, - int nb_scatt, - CloogState *state) -{ - CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); - CloogScattering *res = cloog_scattering_from_cloog_matrix (state, mat, - nb_scatt, - nb_params); - - cloog_matrix_free (mat); - return res; -} - -/* Creates a CloogDomain from a pointset powerset PS. */ - -CloogDomain * -new_Cloog_Domain_from_ppl_Pointset_Powerset - (ppl_Pointset_Powerset_C_Polyhedron_t ps, int nb_params, - CloogState *state) -{ - CloogDomain *res = NULL; - ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; - - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it); - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end); - - for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it), - ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end); - !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end); - ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it)) - { - ppl_const_Polyhedron_t ph; - CloogDomain *tmp; - - ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph); - tmp = new_Cloog_Domain_from_ppl_Polyhedron (ph, nb_params, state); - - if (res == NULL) - res = tmp; - else - res = cloog_domain_union (res, tmp); - } - - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it); - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end); - - gcc_assert (res != NULL); - - return res; -} - -/* Print to FILE the matrix MAT in OpenScop format. OUTPUT is the number - of output dimensions, INPUT is the number of input dimensions, LOCALS - is the number of existentially quantified variables and PARAMS is the - number of parameters. */ - -static void -openscop_print_cloog_matrix (FILE *file, CloogMatrix *mat, - int output, int input, int locals, - int params) -{ - unsigned i, j; - - fprintf (file, "%d %d %d %d %d %d \n", mat->NbRows, - mat->NbColumns, output, input, locals, params); - - for (i = 0; i < mat->NbRows; i++) - { - for (j = 0; j < mat->NbColumns; j++) - if (j == 0) - fprintf (file, "%ld ", mpz_get_si (mat->p[i][j])); - else - fprintf (file, "%6ld ", mpz_get_si (mat->p[i][j])); - - fprintf (file, "\n"); - } -} - -/* Print to FILE the polyhedron PH in OpenScop format. OUTPUT is the number - of output dimensions, INPUT is the number of input dimensions, LOCALS is - the number of existentially quantified variables and PARAMS is the number - of parameters. */ - -void -openscop_print_polyhedron_matrix (FILE *file, ppl_const_Polyhedron_t ph, - int output, int input, int locals, - int params) -{ - CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); - openscop_print_cloog_matrix (file, mat, output, input, locals, params); - cloog_matrix_free (mat); -} - -/* Read from FILE a matrix in OpenScop format. OUTPUT is the number of - output dimensions, INPUT is the number of input dimensions, LOCALS - is the number of existentially quantified variables and PARAMS is the - number of parameters. */ - -static CloogMatrix * -openscop_read_cloog_matrix (FILE *file, int *output, int *input, int *locals, - int *params) -{ - int nb_rows, nb_cols, i, j; - CloogMatrix *mat; - int *openscop_matrix_header, *matrix_line; - - openscop_matrix_header = openscop_read_N_int (file, 6); - - nb_rows = openscop_matrix_header[0]; - nb_cols = openscop_matrix_header[1]; - *output = openscop_matrix_header[2]; - *input = openscop_matrix_header[3]; - *locals = openscop_matrix_header[4]; - *params = openscop_matrix_header[5]; - - free (openscop_matrix_header); - - if (nb_rows == 0 || nb_cols == 0) - return NULL; - - mat = cloog_matrix_alloc (nb_rows, nb_cols); - mat->NbRows = nb_rows; - mat->NbColumns = nb_cols; - - for (i = 0; i < nb_rows; i++) - { - matrix_line = openscop_read_N_int (file, nb_cols); - - for (j = 0; j < nb_cols; j++) - mpz_set_si (mat->p[i][j], matrix_line[j]); - } - - return mat; -} - -/* Read from FILE the polyhedron PH in OpenScop format. OUTPUT is the number - of output dimensions, INPUT is the number of input dimensions, LOCALS is - the number of existentially quantified variables and PARAMS is the number - of parameters. */ - -void -openscop_read_polyhedron_matrix (FILE *file, ppl_Polyhedron_t *ph, - int *output, int *input, int *locals, - int *params) -{ - CloogMatrix *mat; - - mat = openscop_read_cloog_matrix (file, output, input, locals, params); - - if (!mat) - *ph = NULL; - else - { - new_C_Polyhedron_from_Cloog_Matrix (ph, mat); - cloog_matrix_free (mat); - } -} - -#endif diff --git a/gcc/graphite-cloog-util.h b/gcc/graphite-cloog-util.h deleted file mode 100644 index da26ee9f1fc..00000000000 --- a/gcc/graphite-cloog-util.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Gimple Represented as Polyhedra. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. - Contributed by Sebastian Pop - and Tobias Grosser . - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ -#ifndef GRAPHITE_CLOOG_UTIL_H -#define GRAPHITE_CLOOG_UTIL_H - -#include "cloog/cloog.h" - -CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t); -CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t, - int, CloogState *); -CloogScattering *new_Cloog_Scattering_from_ppl_Polyhedron - (ppl_const_Polyhedron_t, int, int, CloogState *); -CloogDomain * new_Cloog_Domain_from_ppl_Pointset_Powerset - (ppl_Pointset_Powerset_C_Polyhedron_t, int, CloogState *); -void new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *, CloogMatrix *); -void openscop_print_polyhedron_matrix (FILE *, ppl_const_Polyhedron_t, int, - int, int, int); -void openscop_read_polyhedron_matrix (FILE *, ppl_Polyhedron_t *, int *, int *, - int *, int *); - -extern int *openscop_read_N_int (FILE *, int); - -#endif /* GRAPHITE_CLOOG_UTIL_H */ diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index fb49f161480..0c10e60e640 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -1,5 +1,5 @@ /* Data dependence analysis for Graphite. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop and Konrad Trifunovic . @@ -20,6 +20,17 @@ along with GCC; see the file COPYING3. If not see . */ #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "tree-flow.h" @@ -31,904 +42,556 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" -#include "graphite-dependences.h" -#include "graphite-cloog-util.h" -/* Comparison function for poly_ddr hash table. */ +/* Add the constraints from the set S to the domain of MAP. */ -int -eq_poly_ddr_p (const void *pddr1, const void *pddr2) +static isl_map * +constrain_domain (isl_map *map, isl_set *s) { - const struct poly_ddr *p1 = (const struct poly_ddr *) pddr1; - const struct poly_ddr *p2 = (const struct poly_ddr *) pddr2; + isl_space *d = isl_map_get_space (map); + isl_id *id = isl_space_get_tuple_id (d, isl_dim_in); - return (PDDR_SOURCE (p1) == PDDR_SOURCE (p2) - && PDDR_SINK (p1) == PDDR_SINK (p2)); + s = isl_set_set_tuple_id (s, id); + isl_space_free (d); + return isl_map_intersect_domain (map, s); } -/* Hash function for poly_ddr hashtable. */ +/* Constrain pdr->accesses with pdr->extent and pbb->domain. */ -hashval_t -hash_poly_ddr_p (const void *pddr) +static isl_map * +add_pdr_constraints (poly_dr_p pdr, poly_bb_p pbb) { - const struct poly_ddr *p = (const struct poly_ddr *) pddr; - - return (hashval_t) ((long) PDDR_SOURCE (p) + (long) PDDR_SINK (p)); + isl_map *x = isl_map_intersect_range (isl_map_copy (pdr->accesses), + isl_set_copy (pdr->extent)); + x = constrain_domain (x, isl_set_copy (pbb->domain)); + return x; } -/* Returns true when PDDR has no dependence. */ +/* Returns all the memory reads in SCOP. */ -static bool -pddr_is_empty (poly_ddr_p pddr) -{ - if (!pddr) - return true; - - gcc_assert (PDDR_KIND (pddr) != unknown_dependence); - - return PDDR_KIND (pddr) == no_dependence ? true : false; -} - -/* Prints to FILE the layout of the dependence polyhedron of PDDR: - - T1|I1|T2|I2|S1|S2|G - - with - | T1 and T2 the scattering dimensions for PDDR_SOURCE and PDDR_SINK - | I1 and I2 the iteration domains - | S1 and S2 the subscripts - | G the global parameters. */ - -static void -print_dependence_polyhedron_layout (FILE *file, poly_ddr_p pddr) -{ - poly_dr_p pdr1 = PDDR_SOURCE (pddr); - poly_dr_p pdr2 = PDDR_SINK (pddr); - poly_bb_p pbb1 = PDR_PBB (pdr1); - poly_bb_p pbb2 = PDR_PBB (pdr2); - - graphite_dim_t i; - graphite_dim_t tdim1 = PDDR_ORIGINAL_SCATTERING_P (pddr) ? - pbb_nb_scattering_orig (pbb1) : pbb_nb_scattering_transform (pbb1); - graphite_dim_t tdim2 = PDDR_ORIGINAL_SCATTERING_P (pddr) ? - pbb_nb_scattering_orig (pbb2) : pbb_nb_scattering_transform (pbb2); - graphite_dim_t idim1 = pbb_dim_iter_domain (pbb1); - graphite_dim_t idim2 = pbb_dim_iter_domain (pbb2); - graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1; - graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1; - graphite_dim_t gdim = scop_nb_params (PBB_SCOP (pbb1)); - - fprintf (file, "# eq"); - - for (i = 0; i < tdim1; i++) - fprintf (file, " t1_%d", (int) i); - for (i = 0; i < idim1; i++) - fprintf (file, " i1_%d", (int) i); - for (i = 0; i < tdim2; i++) - fprintf (file, " t2_%d", (int) i); - for (i = 0; i < idim2; i++) - fprintf (file, " i2_%d", (int) i); - for (i = 0; i < sdim1; i++) - fprintf (file, " s1_%d", (int) i); - for (i = 0; i < sdim2; i++) - fprintf (file, " s2_%d", (int) i); - for (i = 0; i < gdim; i++) - fprintf (file, " g_%d", (int) i); - - fprintf (file, " cst\n"); -} - -/* Prints to FILE the poly_ddr_p PDDR. */ - -void -print_pddr (FILE *file, poly_ddr_p pddr) -{ - fprintf (file, "pddr (kind: "); - - if (PDDR_KIND (pddr) == unknown_dependence) - fprintf (file, "unknown_dependence"); - else if (PDDR_KIND (pddr) == no_dependence) - fprintf (file, "no_dependence"); - else if (PDDR_KIND (pddr) == has_dependence) - fprintf (file, "has_dependence"); - - fprintf (file, "\n source "); - print_pdr (file, PDDR_SOURCE (pddr), 2); - - fprintf (file, "\n sink "); - print_pdr (file, PDDR_SINK (pddr), 2); - - if (PDDR_KIND (pddr) == has_dependence) - { - fprintf (file, "\n dependence polyhedron (\n"); - print_dependence_polyhedron_layout (file, pddr); - ppl_print_powerset_matrix (file, PDDR_DDP (pddr)); - ppl_io_fprint_Pointset_Powerset_C_Polyhedron (file, PDDR_DDP (pddr)); - fprintf (file, ")\n"); - } - - fprintf (file, ")\n"); -} - -/* Prints to STDERR the poly_ddr_p PDDR. */ - -DEBUG_FUNCTION void -debug_pddr (poly_ddr_p pddr) -{ - print_pddr (stderr, pddr); -} - - -/* Remove all the dimensions except alias information at dimension - ALIAS_DIM. */ - -static void -build_alias_set_powerset (ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset, - ppl_dimension_type alias_dim) -{ - ppl_dimension_type *ds; - ppl_dimension_type access_dim; - unsigned i, pos; - - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (alias_powerset, - &access_dim); - ds = XNEWVEC (ppl_dimension_type, access_dim - 1); - gcc_assert (alias_dim < access_dim); - - for (pos = 0, i = 0; i < access_dim; i++) - if (i != alias_dim) - ds[pos++] = i; - - ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (alias_powerset, - ds, - access_dim - 1); - free (ds); -} - -/* Return true when PDR1 and PDR2 may alias. */ - -static bool -poly_drs_may_alias_p (poly_dr_p pdr1, poly_dr_p pdr2) -{ - ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset1, alias_powerset2; - ppl_Pointset_Powerset_C_Polyhedron_t accesses1 = PDR_ACCESSES (pdr1); - ppl_Pointset_Powerset_C_Polyhedron_t accesses2 = PDR_ACCESSES (pdr2); - ppl_dimension_type alias_dim1 = pdr_alias_set_dim (pdr1); - ppl_dimension_type alias_dim2 = pdr_alias_set_dim (pdr2); - int empty_p; - - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&alias_powerset1, accesses1); - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&alias_powerset2, accesses2); - - build_alias_set_powerset (alias_powerset1, alias_dim1); - build_alias_set_powerset (alias_powerset2, alias_dim2); - - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign - (alias_powerset1, alias_powerset2); - - empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (alias_powerset1); - - ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset1); - ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset2); - - return !empty_p; -} - -/* Swap [cut0, ..., cut1] to the end of DR: "a CUT0 b CUT1 c" is - transformed into "a CUT0 c CUT1' b" - - Add NB0 zeros before "a": "00...0 a CUT0 c CUT1' b" - Add NB1 zeros between "a" and "c": "00...0 a 00...0 c CUT1' b" - Add DIM - NB0 - NB1 - PDIM zeros between "c" and "b": - "00...0 a 00...0 c 00...0 b". */ - -static ppl_Pointset_Powerset_C_Polyhedron_t -map_dr_into_dep_poly (graphite_dim_t dim, - ppl_Pointset_Powerset_C_Polyhedron_t dr, - graphite_dim_t cut0, graphite_dim_t cut1, - graphite_dim_t nb0, graphite_dim_t nb1) -{ - ppl_dimension_type pdim; - ppl_dimension_type *map; - ppl_Pointset_Powerset_C_Polyhedron_t res; - ppl_dimension_type i; - - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&res, dr); - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (res, &pdim); - - map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, pdim); - - /* First mapping: move 'g' vector to right position. */ - for (i = 0; i < cut0; i++) - map[i] = i; - - for (i = cut0; i < cut1; i++) - map[i] = pdim - cut1 + i; - - for (i = cut1; i < pdim; i++) - map[i] = cut0 + i - cut1; - - ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (res, map, pdim); - free (map); - - /* After swapping 's' and 'g' vectors, we have to update a new cut. */ - cut1 = pdim - cut1 + cut0; - - ppl_insert_dimensions_pointset (res, 0, nb0); - ppl_insert_dimensions_pointset (res, nb0 + cut0, nb1); - ppl_insert_dimensions_pointset (res, nb0 + nb1 + cut1, - dim - nb0 - nb1 - pdim); - - return res; -} - -/* Builds subscript equality constraints. */ - -static ppl_Pointset_Powerset_C_Polyhedron_t -dr_equality_constraints (graphite_dim_t dim, - graphite_dim_t pos, graphite_dim_t nb_subscripts) -{ - ppl_Polyhedron_t eqs; - ppl_Pointset_Powerset_C_Polyhedron_t res; - graphite_dim_t i; - - ppl_new_C_Polyhedron_from_space_dimension (&eqs, dim, 0); - - for (i = 0; i < nb_subscripts; i++) - { - ppl_Constraint_t cstr - = ppl_build_relation (dim, pos + i, pos + i + nb_subscripts, - 0, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (eqs, cstr); - ppl_delete_Constraint (cstr); - } - - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&res, eqs); - ppl_delete_Polyhedron (eqs); - return res; -} - -/* Builds scheduling inequality constraints: when DIRECTION is - 1 builds a GE constraint, - 0 builds an EQ constraint, - -1 builds a LE constraint. - DIM is the dimension of the scheduling space. - POS and POS + OFFSET are the dimensions that are related. */ - -static ppl_Pointset_Powerset_C_Polyhedron_t -build_pairwise_scheduling (graphite_dim_t dim, - graphite_dim_t pos, - graphite_dim_t offset, - int direction) -{ - ppl_Pointset_Powerset_C_Polyhedron_t res; - ppl_Polyhedron_t equalities; - ppl_Constraint_t cstr; - graphite_dim_t a = pos; - graphite_dim_t b = pos + offset; - - ppl_new_C_Polyhedron_from_space_dimension (&equalities, dim, 0); - - switch (direction) - { - case 1: - /* Builds "a + 1 <= b. */ - cstr = ppl_build_relation (dim, a, b, 1, - PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL); - break; - - case 0: - /* Builds "a = b. */ - cstr = ppl_build_relation (dim, a, b, 0, - PPL_CONSTRAINT_TYPE_EQUAL); - break; - - case -1: - /* Builds "a >= b + 1. */ - cstr = ppl_build_relation (dim, a, b, -1, - PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - break; - - default: - gcc_unreachable (); - } - - ppl_Polyhedron_add_constraint (equalities, cstr); - ppl_delete_Constraint (cstr); - - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&res, equalities); - ppl_delete_Polyhedron (equalities); - return res; -} - -/* Add to a non empty polyhedron BAG the precedence constraints for - the lexicographical comparison of time vectors in BAG following the - lexicographical order. DIM is the dimension of the polyhedron BAG. - TDIM is the number of loops common to the two statements that are - compared lexicographically, i.e. the number of loops containing - both statements. OFFSET is the number of dimensions needed to - represent the first statement, i.e. dimT1 + dimI1 in the layout of - the BAG polyhedron: T1|I1|T2|I2|S1|S2|G. When DIRECTION is set to - 1, compute the direct dependence from PDR1 to PDR2, and when - DIRECTION is -1, compute the reversed dependence relation, from - PDR2 to PDR1. */ - -static ppl_Pointset_Powerset_C_Polyhedron_t -build_lexicographical_constraint (ppl_Pointset_Powerset_C_Polyhedron_t bag, - graphite_dim_t dim, - graphite_dim_t tdim, - graphite_dim_t offset, - int direction) -{ - graphite_dim_t i; - ppl_Pointset_Powerset_C_Polyhedron_t res, lex; - - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&res, dim, 1); - - lex = build_pairwise_scheduling (dim, 0, offset, direction); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (lex, bag); - - if (!ppl_powerset_is_empty (lex)) - ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (res, lex); - - ppl_delete_Pointset_Powerset_C_Polyhedron (lex); - - for (i = 0; i < tdim - 1; i++) - { - ppl_Pointset_Powerset_C_Polyhedron_t sceq; - - sceq = build_pairwise_scheduling (dim, i, offset, 0); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (bag, sceq); - ppl_delete_Pointset_Powerset_C_Polyhedron (sceq); - - if (ppl_powerset_is_empty (bag)) - break; - - lex = build_pairwise_scheduling (dim, i + 1, offset, direction); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (lex, bag); - - if (!ppl_powerset_is_empty (lex)) - ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (res, lex); - - ppl_delete_Pointset_Powerset_C_Polyhedron (lex); - } - - return res; -} - -/* Build the dependence polyhedron for data references PDR1 and PDR2. - The layout of the dependence polyhedron is: - - T1|I1|T2|I2|S1|S2|G - - with - | T1 and T2 the scattering dimensions for PDR1 and PDR2 - | I1 and I2 the iteration domains - | S1 and S2 the subscripts - | G the global parameters. - - When DIRECTION is set to 1, compute the direct dependence from PDR1 - to PDR2, and when DIRECTION is -1, compute the reversed dependence - relation, from PDR2 to PDR1. */ - -static ppl_Pointset_Powerset_C_Polyhedron_t -dependence_polyhedron (poly_dr_p pdr1, poly_dr_p pdr2, - int direction, bool original_scattering_p) -{ - poly_bb_p pbb1 = PDR_PBB (pdr1); - poly_bb_p pbb2 = PDR_PBB (pdr2); - scop_p scop = PBB_SCOP (pbb1); - graphite_dim_t tdim1 = original_scattering_p ? - pbb_nb_scattering_orig (pbb1) : pbb_nb_scattering_transform (pbb1); - graphite_dim_t tdim2 = original_scattering_p ? - pbb_nb_scattering_orig (pbb2) : pbb_nb_scattering_transform (pbb2); - graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1); - graphite_dim_t ddim2 = pbb_dim_iter_domain (pbb2); - graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1; - graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1; - graphite_dim_t gdim = scop_nb_params (scop); - graphite_dim_t dim1 = pdr_dim (pdr1); - graphite_dim_t dim2 = pdr_dim (pdr2); - graphite_dim_t dim = tdim1 + tdim2 + dim1 + dim2 - gdim; - ppl_Pointset_Powerset_C_Polyhedron_t res; - ppl_Pointset_Powerset_C_Polyhedron_t idr1, idr2; - ppl_Pointset_Powerset_C_Polyhedron_t sc1, sc2, dreq; - ppl_Pointset_Powerset_C_Polyhedron_t lex; - - gcc_assert (PBB_SCOP (pbb1) == PBB_SCOP (pbb2)); - - combine_context_id_scat (&sc1, pbb1, original_scattering_p); - combine_context_id_scat (&sc2, pbb2, original_scattering_p); - - ppl_insert_dimensions_pointset (sc1, tdim1 + ddim1, - tdim2 + ddim2 + sdim1 + sdim2); - - ppl_insert_dimensions_pointset (sc2, 0, tdim1 + ddim1); - ppl_insert_dimensions_pointset (sc2, tdim1 + ddim1 + tdim2 + ddim2, - sdim1 + sdim2); - - idr1 = map_dr_into_dep_poly (dim, PDR_ACCESSES (pdr1), ddim1, ddim1 + gdim, - tdim1, tdim2 + ddim2); - idr2 = map_dr_into_dep_poly (dim, PDR_ACCESSES (pdr2), ddim2, ddim2 + gdim, - tdim1 + ddim1 + tdim2, sdim1); - - /* Now add the subscript equalities. */ - dreq = dr_equality_constraints (dim, tdim1 + ddim1 + tdim2 + ddim2, sdim1); - - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&res, dim, 0); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, sc1); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, sc2); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, idr1); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, idr2); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, dreq); - ppl_delete_Pointset_Powerset_C_Polyhedron (sc1); - ppl_delete_Pointset_Powerset_C_Polyhedron (sc2); - ppl_delete_Pointset_Powerset_C_Polyhedron (idr1); - ppl_delete_Pointset_Powerset_C_Polyhedron (idr2); - ppl_delete_Pointset_Powerset_C_Polyhedron (dreq); - - if (ppl_powerset_is_empty (res)) - return NULL; - - lex = build_lexicographical_constraint (res, dim, MIN (tdim1, tdim2), - tdim1 + ddim1, direction); - ppl_delete_Pointset_Powerset_C_Polyhedron (res); - - return lex; -} - -/* Build the dependence polyhedron for data references PDR1 and PDR2. - If possible use already cached information. - - When DIRECTION is set to 1, compute the direct dependence from PDR1 - to PDR2, and when DIRECTION is -1, compute the reversed dependence - relation, from PDR2 to PDR1. */ - -static poly_ddr_p -new_poly_ddr (poly_dr_p pdr1, poly_dr_p pdr2, - int direction, bool original_scattering_p) -{ - PTR *x = NULL; - poly_ddr_p res; - bool may_alias; - - /* Return the PDDR from the cache if it already has been computed. */ - if (original_scattering_p) - { - struct poly_ddr tmp; - scop_p scop = PBB_SCOP (PDR_PBB (pdr1)); - - tmp.source = pdr1; - tmp.sink = pdr2; - x = htab_find_slot (SCOP_ORIGINAL_PDDRS (scop), - &tmp, INSERT); - - if (x && *x) - return (poly_ddr_p) *x; - } - - res = XNEW (struct poly_ddr); - PDDR_SOURCE (res) = pdr1; - PDDR_SINK (res) = pdr2; - PDDR_DDP (res) = NULL; - PDDR_ORIGINAL_SCATTERING_P (res) = original_scattering_p; - PDDR_KIND (res) = unknown_dependence; - - may_alias = poly_drs_may_alias_p (pdr1, pdr2); - - if (!(pdr_read_p (pdr1) && pdr_read_p (pdr2)) - && PDR_BASE_OBJECT_SET (pdr1) != PDR_BASE_OBJECT_SET (pdr2) - && may_alias) - PDDR_KIND (res) = unknown_dependence; - - else if (!(pdr_read_p (pdr1) && pdr_read_p (pdr2)) - && same_pdr_p (pdr1, pdr2) - && may_alias) - { - PDDR_DDP (res) = dependence_polyhedron (pdr1, pdr2, direction, - original_scattering_p); - if (PDDR_DDP (res)) - PDDR_KIND (res) = has_dependence; - else - PDDR_KIND (res) = no_dependence; - } - else - PDDR_KIND (res) = no_dependence; - - if (original_scattering_p) - *x = res; - - return res; -} - -/* Free the data dependence relation poly_ddr_p P. */ - -void -free_poly_ddr (void *p) -{ - poly_ddr_p pddr = (poly_ddr_p) p; - ppl_delete_Pointset_Powerset_C_Polyhedron (PDDR_DDP (pddr)); - free (pddr); -} - -/* Return true when the data dependence relation between the data - references PDR1 belonging to PBB1 and PDR2 is part of a - reduction. */ - -static inline bool -reduction_dr_1 (poly_bb_p pbb1, poly_dr_p pdr1, poly_dr_p pdr2) -{ - int i; - poly_dr_p pdr; - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr) - if (PDR_TYPE (pdr) == PDR_WRITE - && same_pdr_p (pdr, pdr1) && same_pdr_p (pdr, pdr2)) - return true; - - return false; -} - -/* Return true when the data dependence relation between the data - references PDR1 belonging to PBB1 and PDR2 belonging to PBB2 is - part of a reduction. */ - -static inline bool -reduction_dr_p (poly_dr_p pdr1, poly_dr_p pdr2) -{ - poly_bb_p pbb1 = PDR_PBB (pdr1); - poly_bb_p pbb2 = PDR_PBB (pdr2); - - if (PBB_IS_REDUCTION (pbb1)) - return reduction_dr_1 (pbb1, pdr1, pdr2); - - if (PBB_IS_REDUCTION (pbb2)) - return reduction_dr_1 (pbb2, pdr2, pdr1); - - return false; -} - -/* Returns true when the PBB_TRANSFORMED_SCATTERING functions of PBB1 - and PBB2 respect the data dependences of PBB_ORIGINAL_SCATTERING - functions. */ - -static bool -graphite_legal_transform_dr (poly_dr_p pdr1, poly_dr_p pdr2) -{ - ppl_Pointset_Powerset_C_Polyhedron_t po, pt; - graphite_dim_t ddim1, otdim1, otdim2, ttdim1, ttdim2; - ppl_Pointset_Powerset_C_Polyhedron_t po_temp; - ppl_dimension_type pdim; - bool is_empty_p; - poly_ddr_p opddr, tpddr; - poly_bb_p pbb1, pbb2; - - if (reduction_dr_p (pdr1, pdr2)) - return true; - - /* We build the reverse dependence relation for the transformed - scattering, such that when we intersect it with the original PO, - we get an empty intersection when the transform is legal: - i.e. the transform should reverse no dependences, and so PT, the - reversed transformed PDDR, should have no constraint from PO. */ - opddr = new_poly_ddr (pdr1, pdr2, 1, true); - - if (PDDR_KIND (opddr) == unknown_dependence) - return false; - - /* There are no dependences between PDR1 and PDR2 in the original - version of the program, or after the transform, so the - transform is legal. */ - if (pddr_is_empty (opddr)) - return true; - - tpddr = new_poly_ddr (pdr1, pdr2, -1, false); - - if (PDDR_KIND (tpddr) == unknown_dependence) - { - free_poly_ddr (tpddr); - return false; - } - - if (pddr_is_empty (tpddr)) - { - free_poly_ddr (tpddr); - return true; - } - - po = PDDR_DDP (opddr); - pt = PDDR_DDP (tpddr); - - /* Copy PO into PO_TEMP, such that PO is not destroyed. PO is - stored in a cache and should not be modified or freed. */ - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &pdim); - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&po_temp, - pdim, 0); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po_temp, po); - - /* Extend PO and PT to have the same dimensions. */ - pbb1 = PDR_PBB (pdr1); - pbb2 = PDR_PBB (pdr2); - ddim1 = pbb_dim_iter_domain (pbb1); - otdim1 = pbb_nb_scattering_orig (pbb1); - otdim2 = pbb_nb_scattering_orig (pbb2); - ttdim1 = pbb_nb_scattering_transform (pbb1); - ttdim2 = pbb_nb_scattering_transform (pbb2); - ppl_insert_dimensions_pointset (po_temp, otdim1, ttdim1); - ppl_insert_dimensions_pointset (po_temp, otdim1 + ttdim1 + ddim1 + otdim2, - ttdim2); - ppl_insert_dimensions_pointset (pt, 0, otdim1); - ppl_insert_dimensions_pointset (pt, otdim1 + ttdim1 + ddim1, otdim2); - - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po_temp, pt); - is_empty_p = ppl_powerset_is_empty (po_temp); - - ppl_delete_Pointset_Powerset_C_Polyhedron (po_temp); - free_poly_ddr (tpddr); - - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "\nloop carries dependency.\n"); - - return is_empty_p; -} - -/* Return true when the data dependence relation for PBB1 and PBB2 is - part of a reduction. */ - -static inline bool -reduction_ddr_p (poly_bb_p pbb1, poly_bb_p pbb2) -{ - return pbb1 == pbb2 && PBB_IS_REDUCTION (pbb1); -} - -/* Iterates over the data references of PBB1 and PBB2 and detect - whether the transformed schedule is correct. */ - -static bool -graphite_legal_transform_bb (poly_bb_p pbb1, poly_bb_p pbb2) +static isl_union_map * +scop_get_reads (scop_p scop, VEC (poly_bb_p, heap) *pbbs) { int i, j; - poly_dr_p pdr1, pdr2; + poly_bb_p pbb; + poly_dr_p pdr; + isl_space *space = isl_set_get_space (scop->context); + isl_union_map *res = isl_union_map_empty (space); - if (!PBB_PDR_DUPLICATES_REMOVED (pbb1)) - pbb_remove_duplicate_pdrs (pbb1); + FOR_EACH_VEC_ELT (poly_bb_p, pbbs, i, pbb) + { + FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), j, pdr) + if (pdr_read_p (pdr)) + res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb)); + } - if (!PBB_PDR_DUPLICATES_REMOVED (pbb2)) - pbb_remove_duplicate_pdrs (pbb2); - - if (reduction_ddr_p (pbb1, pbb2)) - return true; - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), j, pdr2) - if (!graphite_legal_transform_dr (pdr1, pdr2)) - return false; - - return true; + return res; } -/* Iterates over the SCOP and detect whether the transformed schedule - is correct. */ +/* Returns all the memory must writes in SCOP. */ + +static isl_union_map * +scop_get_must_writes (scop_p scop, VEC (poly_bb_p, heap) *pbbs) +{ + int i, j; + poly_bb_p pbb; + poly_dr_p pdr; + isl_space *space = isl_set_get_space (scop->context); + isl_union_map *res = isl_union_map_empty (space); + + FOR_EACH_VEC_ELT (poly_bb_p, pbbs, i, pbb) + { + FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), j, pdr) + if (pdr_write_p (pdr)) + res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb)); + } + + return res; +} + +/* Returns all the memory may writes in SCOP. */ + +static isl_union_map * +scop_get_may_writes (scop_p scop, VEC (poly_bb_p, heap) *pbbs) +{ + int i, j; + poly_bb_p pbb; + poly_dr_p pdr; + isl_space *space = isl_set_get_space (scop->context); + isl_union_map *res = isl_union_map_empty (space); + + FOR_EACH_VEC_ELT (poly_bb_p, pbbs, i, pbb) + { + FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), j, pdr) + if (pdr_may_write_p (pdr)) + res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb)); + } + + return res; +} + +/* Returns all the original schedules in SCOP. */ + +static isl_union_map * +scop_get_original_schedule (scop_p scop, VEC (poly_bb_p, heap) *pbbs) +{ + int i; + poly_bb_p pbb; + isl_space *space = isl_set_get_space (scop->context); + isl_union_map *res = isl_union_map_empty (space); + + FOR_EACH_VEC_ELT (poly_bb_p, pbbs, i, pbb) + { + res = isl_union_map_add_map + (res, constrain_domain (isl_map_copy (pbb->schedule), + isl_set_copy (pbb->domain))); + } + + return res; +} + +/* Returns all the transformed schedules in SCOP. */ + +static isl_union_map * +scop_get_transformed_schedule (scop_p scop, VEC (poly_bb_p, heap) *pbbs) +{ + int i; + poly_bb_p pbb; + isl_space *space = isl_set_get_space (scop->context); + isl_union_map *res = isl_union_map_empty (space); + + FOR_EACH_VEC_ELT (poly_bb_p, pbbs, i, pbb) + { + res = isl_union_map_add_map + (res, constrain_domain (isl_map_copy (pbb->transformed), + isl_set_copy (pbb->domain))); + } + + return res; +} + +/* Helper function used on each MAP of a isl_union_map. Computes the + maximal output dimension. */ + +static int +max_number_of_out_dimensions (__isl_take isl_map *map, void *user) +{ + int global_max = *((int *) user); + isl_space *space = isl_map_get_space (map); + int nb_out = isl_space_dim (space, isl_dim_out); + + if (global_max < nb_out) + *((int *) user) = nb_out; + + isl_map_free (map); + isl_space_free (space); + return 0; +} + +/* Extends the output dimension of MAP to MAX dimensions. */ + +static __isl_give isl_map * +extend_map (__isl_take isl_map *map, int max) +{ + isl_space *space = isl_map_get_space (map); + int n = isl_space_dim (space, isl_dim_out); + + isl_space_free (space); + return isl_map_add_dims (map, isl_dim_out, max - n); +} + +/* Structure used to pass parameters to extend_schedule_1. */ + +struct extend_schedule_str { + int max; + isl_union_map *umap; +}; + +/* Helper function for extend_schedule. */ + +static int +extend_schedule_1 (__isl_take isl_map *map, void *user) +{ + struct extend_schedule_str *str = (struct extend_schedule_str *) user; + str->umap = isl_union_map_add_map (str->umap, extend_map (map, str->max)); + return 0; +} + +/* Return a relation that has uniform output dimensions. */ + +__isl_give isl_union_map * +extend_schedule (__isl_take isl_union_map *x) +{ + int max = 0; + int res; + struct extend_schedule_str str; + + res = isl_union_map_foreach_map (x, max_number_of_out_dimensions, (void *) &max); + gcc_assert (res == 0); + + str.max = max; + str.umap = isl_union_map_empty (isl_union_map_get_space (x)); + res = isl_union_map_foreach_map (x, extend_schedule_1, (void *) &str); + gcc_assert (res == 0); + + isl_union_map_free (x); + return str.umap; +} + +/* Applies SCHEDULE to the in and out dimensions of the dependences + DEPS and return the resulting relation. */ + +static isl_map * +apply_schedule_on_deps (__isl_keep isl_union_map *schedule, + __isl_keep isl_union_map *deps) +{ + isl_map *x; + isl_union_map *ux, *trans; + + trans = isl_union_map_copy (schedule); + trans = extend_schedule (trans); + ux = isl_union_map_copy (deps); + ux = isl_union_map_apply_domain (ux, isl_union_map_copy (trans)); + ux = isl_union_map_apply_range (ux, trans); + x = isl_map_from_union_map (ux); + + return x; +} + +/* Return true when SCHEDULE does not violate the data DEPS: that is + when the intersection of LEX with the DEPS transformed by SCHEDULE + is empty. LEX is the relation in which the outputs occur before + the inputs. */ + +static bool +no_violations (__isl_keep isl_union_map *schedule, + __isl_keep isl_union_map *deps) +{ + bool res; + isl_space *space; + isl_map *lex, *x; + + if (isl_union_map_is_empty (deps)) + return true; + + x = apply_schedule_on_deps (schedule, deps); + space = isl_map_get_space (x); + space = isl_space_range (space); + lex = isl_map_lex_ge (space); + x = isl_map_intersect (x, lex); + res = isl_map_is_empty (x); + + isl_map_free (x); + return res; +} + +/* Return true when DEPS is non empty and the intersection of LEX with + the DEPS transformed by SCHEDULE is non empty. LEX is the relation + in which all the inputs before DEPTH occur at the same time as the + output, and the input at DEPTH occurs before output. */ + +static bool +carries_deps (__isl_keep isl_union_map *schedule, + __isl_keep isl_union_map *deps, + int depth) +{ + bool res; + int idx, i; + isl_space *space; + isl_map *lex, *x; + isl_constraint *ineq; + + if (isl_union_map_is_empty (deps)) + return false; + + x = apply_schedule_on_deps (schedule, deps); + space = isl_map_get_space (x); + space = isl_space_range (space); + lex = isl_map_lex_le (space); + space = isl_map_get_space (x); + ineq = isl_inequality_alloc (isl_local_space_from_space (space)); + + idx = 2 * depth + 1; + for (i = 0; i < idx; i++) + lex = isl_map_equate (lex, isl_dim_in, i, isl_dim_out, i); + + /* in + 1 <= out */ + ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_out, idx, 1); + ineq = isl_constraint_set_coefficient_si (ineq, isl_dim_in, idx, -1); + ineq = isl_constraint_set_constant_si (ineq, -1); + lex = isl_map_add_constraint (lex, ineq); + x = isl_map_intersect (x, lex); + res = !isl_map_is_empty (x); + + isl_map_free (x); + return res; +} + +/* Subtract from the RAW, WAR, and WAW dependences those relations + that have been marked as belonging to an associative commutative + reduction. */ + +static void +subtract_commutative_associative_deps (scop_p scop, + VEC (poly_bb_p, heap) *pbbs, + isl_union_map *original, + isl_union_map **must_raw, + isl_union_map **may_raw, + isl_union_map **must_raw_no_source, + isl_union_map **may_raw_no_source, + isl_union_map **must_war, + isl_union_map **may_war, + isl_union_map **must_war_no_source, + isl_union_map **may_war_no_source, + isl_union_map **must_waw, + isl_union_map **may_waw, + isl_union_map **must_waw_no_source, + isl_union_map **may_waw_no_source) +{ + int i, j; + poly_bb_p pbb; + poly_dr_p pdr; + isl_space *space = isl_set_get_space (scop->context); + + FOR_EACH_VEC_ELT (poly_bb_p, pbbs, i, pbb) + if (PBB_IS_REDUCTION (pbb)) + { + int res; + isl_union_map *r = isl_union_map_empty (isl_space_copy (space)); + isl_union_map *must_w = isl_union_map_empty (isl_space_copy (space)); + isl_union_map *may_w = isl_union_map_empty (isl_space_copy (space)); + isl_union_map *all_w; + isl_union_map *empty; + isl_union_map *x_must_raw; + isl_union_map *x_may_raw; + isl_union_map *x_must_raw_no_source; + isl_union_map *x_may_raw_no_source; + isl_union_map *x_must_war; + isl_union_map *x_may_war; + isl_union_map *x_must_war_no_source; + isl_union_map *x_may_war_no_source; + isl_union_map *x_must_waw; + isl_union_map *x_may_waw; + isl_union_map *x_must_waw_no_source; + isl_union_map *x_may_waw_no_source; + + FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), j, pdr) + if (pdr_read_p (pdr)) + r = isl_union_map_add_map (r, add_pdr_constraints (pdr, pbb)); + + FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), j, pdr) + if (pdr_write_p (pdr)) + must_w = isl_union_map_add_map (must_w, + add_pdr_constraints (pdr, pbb)); + + FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), j, pdr) + if (pdr_may_write_p (pdr)) + may_w = isl_union_map_add_map (may_w, + add_pdr_constraints (pdr, pbb)); + + all_w = isl_union_map_union + (isl_union_map_copy (must_w), isl_union_map_copy (may_w)); + empty = isl_union_map_empty (isl_union_map_get_space (all_w)); + + res = isl_union_map_compute_flow (isl_union_map_copy (r), + isl_union_map_copy (must_w), + isl_union_map_copy (may_w), + isl_union_map_copy (original), + &x_must_raw, &x_may_raw, + &x_must_raw_no_source, + &x_may_raw_no_source); + gcc_assert (res == 0); + res = isl_union_map_compute_flow (isl_union_map_copy (all_w), + r, empty, + isl_union_map_copy (original), + &x_must_war, &x_may_war, + &x_must_war_no_source, + &x_may_war_no_source); + gcc_assert (res == 0); + res = isl_union_map_compute_flow (all_w, must_w, may_w, + isl_union_map_copy (original), + &x_must_waw, &x_may_waw, + &x_must_waw_no_source, + &x_may_waw_no_source); + gcc_assert (res == 0); + + *must_raw = isl_union_map_subtract (*must_raw, x_must_raw); + *may_raw = isl_union_map_subtract (*may_raw, x_may_raw); + *must_raw_no_source = isl_union_map_subtract (*must_raw_no_source, + x_must_raw_no_source); + *may_raw_no_source = isl_union_map_subtract (*may_raw_no_source, + x_may_raw_no_source); + *must_war = isl_union_map_subtract (*must_war, x_must_war); + *may_war = isl_union_map_subtract (*may_war, x_may_war); + *must_war_no_source = isl_union_map_subtract (*must_war_no_source, + x_must_war_no_source); + *may_war_no_source = isl_union_map_subtract (*may_war_no_source, + x_may_war_no_source); + *must_waw = isl_union_map_subtract (*must_waw, x_must_waw); + *may_waw = isl_union_map_subtract (*may_waw, x_may_waw); + *must_waw_no_source = isl_union_map_subtract (*must_waw_no_source, + x_must_waw_no_source); + *may_waw_no_source = isl_union_map_subtract (*may_waw_no_source, + x_may_waw_no_source); + } + + isl_union_map_free (original); + isl_space_free (space); +} + +/* Compute the original data dependences in SCOP for all the reads and + writes in PBBS. */ + +static void +compute_deps (scop_p scop, VEC (poly_bb_p, heap) *pbbs, + isl_union_map **must_raw, + isl_union_map **may_raw, + isl_union_map **must_raw_no_source, + isl_union_map **may_raw_no_source, + isl_union_map **must_war, + isl_union_map **may_war, + isl_union_map **must_war_no_source, + isl_union_map **may_war_no_source, + isl_union_map **must_waw, + isl_union_map **may_waw, + isl_union_map **must_waw_no_source, + isl_union_map **may_waw_no_source) +{ + isl_union_map *reads = scop_get_reads (scop, pbbs); + isl_union_map *must_writes = scop_get_must_writes (scop, pbbs); + isl_union_map *may_writes = scop_get_may_writes (scop, pbbs); + isl_union_map *all_writes = isl_union_map_union + (isl_union_map_copy (must_writes), isl_union_map_copy (may_writes)); + isl_space *space = isl_union_map_get_space (all_writes); + isl_union_map *empty = isl_union_map_empty (space); + isl_union_map *original = scop_get_original_schedule (scop, pbbs); + int res; + + res = isl_union_map_compute_flow (isl_union_map_copy (reads), + isl_union_map_copy (must_writes), + isl_union_map_copy (may_writes), + isl_union_map_copy (original), + must_raw, may_raw, must_raw_no_source, + may_raw_no_source); + gcc_assert (res == 0); + res = isl_union_map_compute_flow (isl_union_map_copy (all_writes), + reads, empty, + isl_union_map_copy (original), + must_war, may_war, must_war_no_source, + may_war_no_source); + gcc_assert (res == 0); + res = isl_union_map_compute_flow (all_writes, must_writes, may_writes, + isl_union_map_copy (original), + must_waw, may_waw, must_waw_no_source, + may_waw_no_source); + gcc_assert (res == 0); + + subtract_commutative_associative_deps + (scop, pbbs, original, + must_raw, may_raw, must_raw_no_source, may_raw_no_source, + must_war, may_war, must_war_no_source, may_war_no_source, + must_waw, may_waw, must_waw_no_source, may_waw_no_source); +} + +/* Given a TRANSFORM, check whether it respects the original + dependences in SCOP. Returns true when TRANSFORM is a safe + transformation. */ + +static bool +transform_is_safe (scop_p scop, isl_union_map *transform) +{ + bool res; + + if (!scop->must_raw) + compute_deps (scop, SCOP_BBS (scop), + &scop->must_raw, &scop->may_raw, + &scop->must_raw_no_source, &scop->may_raw_no_source, + &scop->must_war, &scop->may_war, + &scop->must_war_no_source, &scop->may_war_no_source, + &scop->must_waw, &scop->may_waw, + &scop->must_waw_no_source, &scop->may_waw_no_source); + + res = (no_violations (transform, scop->must_raw) + && no_violations (transform, scop->may_raw) + && no_violations (transform, scop->must_war) + && no_violations (transform, scop->may_war) + && no_violations (transform, scop->must_waw) + && no_violations (transform, scop->may_waw)); + + isl_union_map_free (transform); + return res; +} + +/* Return true when the SCOP transformed schedule is correct. */ bool graphite_legal_transform (scop_p scop) { - int i, j; - poly_bb_p pbb1, pbb2; + int res; + isl_union_map *transform; timevar_push (TV_GRAPHITE_DATA_DEPS); - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1) - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2) - if (!graphite_legal_transform_bb (pbb1, pbb2)) - { - timevar_pop (TV_GRAPHITE_DATA_DEPS); - return false; - } - + transform = scop_get_transformed_schedule (scop, SCOP_BBS (scop)); + res = transform_is_safe (scop, transform); timevar_pop (TV_GRAPHITE_DATA_DEPS); - return true; + + return res; } -/* Returns TRUE when the dependence polyhedron between PDR1 and - PDR2 represents a loop carried dependence at level LEVEL. */ +/* Return true when the loop at DEPTH carries dependences. BODY is + the body of the loop. */ static bool -graphite_carried_dependence_level_k (poly_dr_p pdr1, poly_dr_p pdr2, - int level) +loop_level_carries_dependences (scop_p scop, VEC (poly_bb_p, heap) *body, + int depth) { - ppl_Pointset_Powerset_C_Polyhedron_t po; - ppl_Pointset_Powerset_C_Polyhedron_t eqpp; - poly_bb_p pbb = PDR_PBB (pdr1); - graphite_dim_t tdim1 = pbb_nb_scattering_transform (pbb); - graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb); - ppl_dimension_type dim; - bool empty_p; - poly_ddr_p pddr = new_poly_ddr (pdr1, pdr2, 1, false); - graphite_dim_t pos; + isl_union_map *transform = scop_get_transformed_schedule (scop, body); + isl_union_map *must_raw, *may_raw; + isl_union_map *must_war, *may_war; + isl_union_map *must_waw, *may_waw; + int res; - if (PDDR_KIND (pddr) == unknown_dependence) - { - free_poly_ddr (pddr); - return true; - } + compute_deps (scop, body, + &must_raw, &may_raw, NULL, NULL, + &must_war, &may_war, NULL, NULL, + &must_waw, &may_waw, NULL, NULL); - if (pddr_is_empty (pddr)) - { - free_poly_ddr (pddr); - return false; - } + res = (carries_deps (transform, must_raw, depth) + || carries_deps (transform, may_raw, depth) + || carries_deps (transform, must_war, depth) + || carries_deps (transform, may_war, depth) + || carries_deps (transform, must_waw, depth) + || carries_deps (transform, may_waw, depth)); - po = PDDR_DDP (pddr); - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &dim); - pos = psct_dynamic_dim (pbb, level); - eqpp = build_pairwise_scheduling (dim, pos, tdim1 + ddim1, 1); - - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (eqpp, po); - empty_p = ppl_powerset_is_empty (eqpp); - - ppl_delete_Pointset_Powerset_C_Polyhedron (eqpp); - free_poly_ddr (pddr); - - return !empty_p; + isl_union_map_free (transform); + isl_union_map_free (must_raw); + isl_union_map_free (may_raw); + isl_union_map_free (must_war); + isl_union_map_free (may_war); + isl_union_map_free (must_waw); + isl_union_map_free (may_waw); + return res; } -/* Check data dependency between PBB1 and PBB2 at level LEVEL. */ +/* Returns true when the loop L at level DEPTH is parallel. + BB_PBB_MAPPING is a map between a basic_block and its related + poly_bb_p. */ bool -dependency_between_pbbs_p (poly_bb_p pbb1, poly_bb_p pbb2, int level) +loop_is_parallel_p (loop_p loop, htab_t bb_pbb_mapping, int depth) { - int i, j; - poly_dr_p pdr1, pdr2; + bool dependences; + scop_p scop; + VEC (poly_bb_p, heap) *body = VEC_alloc (poly_bb_p, heap, 3); timevar_push (TV_GRAPHITE_DATA_DEPS); - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), i, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), j, pdr2) - if (graphite_carried_dependence_level_k (pdr1, pdr2, level)) - { - timevar_pop (TV_GRAPHITE_DATA_DEPS); - return true; - } - + scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body); + dependences = loop_level_carries_dependences (scop, body, depth); + VEC_free (poly_bb_p, heap, body); timevar_pop (TV_GRAPHITE_DATA_DEPS); - return false; -} -/* When ORIG is true, pretty print to FILE all the original data - dependences of SCoP in DOT format, otherwise print the transformed - data deps. */ - -static void -dot_deps_stmt_2 (FILE *file, scop_p scop, bool orig) -{ - int i, j, k, l; - poly_bb_p pbb1, pbb2; - poly_dr_p pdr1, pdr2; - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1) - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2) - { - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2) - { - poly_ddr_p pddr = new_poly_ddr (pdr1, pdr2, 1, orig); - - if (!pddr_is_empty (pddr)) - { - fprintf (file, orig ? "OS%d -> OS%d\n" : "TS%d -> TS%d\n", - pbb_index (pbb1), pbb_index (pbb2)); - - free_poly_ddr (pddr); - goto done; - } - - free_poly_ddr (pddr); - } - done:; - } -} - -/* Pretty print to FILE all the data dependences of SCoP in DOT - format. */ - -static void -dot_deps_stmt_1 (FILE *file, scop_p scop) -{ - fputs ("digraph all {\n", file); - - dot_deps_stmt_2 (file, scop, true); - dot_deps_stmt_2 (file, scop, false); - - fputs ("}\n\n", file); -} - -/* When ORIG is true, pretty print to FILE all the original data - dependences of SCoP in DOT format, otherwise print the transformed - data deps. */ - -static void -dot_deps_2 (FILE *file, scop_p scop, bool orig) -{ - int i, j, k, l; - poly_bb_p pbb1, pbb2; - poly_dr_p pdr1, pdr2; - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb1) - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), j, pbb2) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb1), k, pdr1) - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb2), l, pdr2) - { - poly_ddr_p pddr = new_poly_ddr (pdr1, pdr2, 1, orig); - - if (!pddr_is_empty (pddr)) - fprintf (file, orig - ? "OS%d_D%d -> OS%d_D%d\n" : "TS%d_D%d -> TS%d_D%d\n", - pbb_index (pbb1), PDR_ID (pdr1), - pbb_index (pbb2), PDR_ID (pdr2)); - - free_poly_ddr (pddr); - } -} - -/* Pretty print to FILE all the data dependences of SCoP in DOT - format. */ - -static void -dot_deps_1 (FILE *file, scop_p scop) -{ - fputs ("digraph all {\n", file); - - dot_deps_2 (file, scop, true); - dot_deps_2 (file, scop, false); - - fputs ("}\n\n", file); -} - -/* Display all the data dependences in SCoP using dotty. */ - -DEBUG_FUNCTION void -dot_deps (scop_p scop) -{ - /* When debugging, enable the following code. This cannot be used - in production compilers because it calls "system". */ -#if 0 - FILE *stream = fopen ("/tmp/scopdeps.dot", "w"); - gcc_assert (stream); - - dot_deps_1 (stream, scop); - fclose (stream); - - system ("dotty /tmp/scopdeps.dot &"); -#else - dot_deps_1 (stderr, scop); -#endif -} - -/* Display all the statement dependences in SCoP using dotty. */ - -DEBUG_FUNCTION void -dot_deps_stmt (scop_p scop) -{ - /* When debugging, enable the following code. This cannot be used - in production compilers because it calls "system". */ -#if 0 - FILE *stream = fopen ("/tmp/scopdeps.dot", "w"); - gcc_assert (stream); - - dot_deps_stmt_1 (stream, scop); - fclose (stream); - - system ("dotty /tmp/scopdeps.dot &"); -#else - dot_deps_stmt_1 (stderr, scop); -#endif + return !dependences; } #endif diff --git a/gcc/graphite-dependences.h b/gcc/graphite-dependences.h deleted file mode 100644 index 5f2a4a03acc..00000000000 --- a/gcc/graphite-dependences.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Graphite polyhedral representation. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. - Contributed by Konrad Trifunovic - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#ifndef GCC_GRAPHITE_DEPENDENCES_H -#define GCC_GRAPHITE_DEPENDENCES_H - -extern bool graphite_legal_transform (scop_p); -extern bool dependency_between_pbbs_p (poly_bb_p, poly_bb_p, int); - -enum poly_dependence_kind { - unknown_dependence, - no_dependence, - has_dependence -}; - -/* Represents a Polyhedral Data Dependence Relation. */ - -typedef struct poly_ddr -{ - /* Source and sink data references of the dependence. */ - poly_dr_p source, sink; - - /* Data dependence polyhedron. */ - ppl_Pointset_Powerset_C_Polyhedron_t ddp; - - enum poly_dependence_kind kind; - - /* True when the dependence relation is for the original scattering. */ - bool original_scattering_p; - -} *poly_ddr_p; - -#define PDDR_SOURCE(PDDR) (PDDR->source) -#define PDDR_SINK(PDDR) (PDDR->sink) -#define PDDR_DDP(PDDR) (PDDR->ddp) -#define PDDR_KIND(PDDR) (PDDR->kind) -#define PDDR_ORIGINAL_SCATTERING_P(PDDR) (PDDR->original_scattering_p) - -extern int eq_poly_ddr_p (const void *, const void *); -extern hashval_t hash_poly_ddr_p (const void *); -extern void free_poly_ddr (void *); -extern void dot_deps (scop_p); -extern void dot_deps_stmt (scop_p); -extern void print_pddr (FILE *, poly_ddr_p); -extern void debug_pddr (poly_ddr_p); - -#endif diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c index ae3262a6a61..dbef03a0422 100644 --- a/gcc/graphite-interchange.c +++ b/gcc/graphite-interchange.c @@ -1,7 +1,7 @@ /* Interchange heuristics and transform for loop interchange on polyhedral representation. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop and Harsha Jagasia . @@ -20,7 +20,19 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ + #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "tree-flow.h" @@ -32,10 +44,9 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" +/* XXX isl rewrite following comment */ /* Builds a linear expression, of dimension DIM, representing PDR's memory access: @@ -53,87 +64,90 @@ along with GCC; see the file COPYING3. If not see where the expression itself is: c_0 * s_0 + c_1 * s_1 + ... c_n * s_n. */ -static ppl_Linear_Expression_t -build_linearized_memory_access (ppl_dimension_type offset, poly_dr_p pdr) +static isl_constraint * +build_linearized_memory_access (isl_map *map, poly_dr_p pdr) { - ppl_Linear_Expression_t res; - ppl_Linear_Expression_t le; - ppl_dimension_type i; - ppl_dimension_type first = pdr_subscript_dim (pdr, 0); - ppl_dimension_type last = pdr_subscript_dim (pdr, PDR_NB_SUBSCRIPTS (pdr)); - mpz_t size, sub_size; - graphite_dim_t dim = offset + pdr_dim (pdr); + isl_constraint *res; + isl_local_space *ls = isl_local_space_from_space (isl_map_get_space (map)); + unsigned offset, nsubs; + int i; + isl_int size, subsize; - ppl_new_Linear_Expression_with_dimension (&res, dim); + res = isl_equality_alloc (ls); + isl_int_init (size); + isl_int_set_ui (size, 1); + isl_int_init (subsize); + isl_int_set_ui (subsize, 1); - mpz_init (size); - mpz_set_si (size, 1); - mpz_init (sub_size); - mpz_set_si (sub_size, 1); - - for (i = last - 1; i >= first; i--) + nsubs = isl_set_dim (pdr->extent, isl_dim_set); + /* -1 for the already included L dimension. */ + offset = isl_map_dim (map, isl_dim_out) - 1 - nsubs; + res = isl_constraint_set_coefficient_si (res, isl_dim_out, offset + nsubs, -1); + /* Go through all subscripts from last to first. First dimension + is the alias set, ignore it. */ + for (i = nsubs - 1; i >= 1; i--) { - ppl_set_coef_gmp (res, i + offset, size); + isl_space *dc; + isl_aff *aff; - ppl_new_Linear_Expression_with_dimension (&le, dim - offset); - ppl_set_coef (le, i, 1); - ppl_max_for_le_pointset (PDR_ACCESSES (pdr), le, sub_size); - mpz_mul (size, size, sub_size); - ppl_delete_Linear_Expression (le); + res = isl_constraint_set_coefficient (res, isl_dim_out, offset + i, size); + + dc = isl_set_get_space (pdr->extent); + aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc)); + aff = isl_aff_set_coefficient_si (aff, isl_dim_in, i, 1); + isl_set_max (pdr->extent, aff, &subsize); + isl_aff_free (aff); + isl_int_mul (size, size, subsize); } - mpz_clear (sub_size); - mpz_clear (size); + isl_int_clear (subsize); + isl_int_clear (size); + return res; } -/* Builds a partial difference equations and inserts them - into pointset powerset polyhedron P. Polyhedron is assumed - to have the format: T|I|T'|I'|G|S|S'|l1|l2. - - TIME_DEPTH is the time dimension w.r.t. which we are - differentiating. - OFFSET represents the number of dimensions between - columns t_{time_depth} and t'_{time_depth}. - DIM_SCTR is the number of scattering dimensions. It is - essentially the dimensionality of the T vector. - - The following equations are inserted into the polyhedron P: - | t_1 = t_1' - | ... - | t_{time_depth-1} = t'_{time_depth-1} - | t_{time_depth} = t'_{time_depth} + 1 - | t_{time_depth+1} = t'_{time_depth + 1} - | ... - | t_{dim_sctr} = t'_{dim_sctr}. */ +/* Set STRIDE to the stride of PDR in memory by advancing by one in + the loop at DEPTH. */ static void -build_partial_difference (ppl_Pointset_Powerset_C_Polyhedron_t *p, - ppl_dimension_type time_depth, - ppl_dimension_type offset, - ppl_dimension_type dim_sctr) +pdr_stride_in_loop (mpz_t stride, graphite_dim_t depth, poly_dr_p pdr) { - ppl_Constraint_t new_cstr; - ppl_Linear_Expression_t le; - ppl_dimension_type i; - ppl_dimension_type dim; - ppl_Pointset_Powerset_C_Polyhedron_t temp; + poly_bb_p pbb = PDR_PBB (pdr); + isl_map *map; + isl_set *set; + isl_aff *aff; + isl_space *dc; + isl_constraint *lma, *c; + isl_int islstride; + graphite_dim_t time_depth; + unsigned offset, nt; + unsigned i; + /* XXX isl rewrite following comments. */ + /* Builds a partial difference equations and inserts them + into pointset powerset polyhedron P. Polyhedron is assumed + to have the format: T|I|T'|I'|G|S|S'|l1|l2. + + TIME_DEPTH is the time dimension w.r.t. which we are + differentiating. + OFFSET represents the number of dimensions between + columns t_{time_depth} and t'_{time_depth}. + DIM_SCTR is the number of scattering dimensions. It is + essentially the dimensionality of the T vector. + + The following equations are inserted into the polyhedron P: + | t_1 = t_1' + | ... + | t_{time_depth-1} = t'_{time_depth-1} + | t_{time_depth} = t'_{time_depth} + 1 + | t_{time_depth+1} = t'_{time_depth + 1} + | ... + | t_{dim_sctr} = t'_{dim_sctr}. */ /* Add the equality: t_{time_depth} = t'_{time_depth} + 1. This is the core part of this alogrithm, since this constraint asks for the memory access stride (difference) between two consecutive points in time dimensions. */ - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (*p, &dim); - ppl_new_Linear_Expression_with_dimension (&le, dim); - ppl_set_coef (le, time_depth, 1); - ppl_set_coef (le, time_depth + offset, -1); - ppl_set_inhomogeneous (le, 1); - ppl_new_Constraint (&new_cstr, le, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Pointset_Powerset_C_Polyhedron_add_constraint (*p, new_cstr); - ppl_delete_Linear_Expression (le); - ppl_delete_Constraint (new_cstr); - /* Add equalities: | t1 = t1' | ... @@ -149,156 +163,80 @@ build_partial_difference (ppl_Pointset_Powerset_C_Polyhedron_t *p, is stripmined dimension, and the other dimension corresponds to the point loop inside stripmined dimension. */ - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron (&temp, *p); + /* pdr->accesses: [P1..nb_param,I1..nb_domain]->[a,S1..nb_subscript] + ??? [P] not used for PDRs? + pdr->extent: [a,S1..nb_subscript] + pbb->domain: [P1..nb_param,I1..nb_domain] + pbb->transformed: [P1..nb_param,I1..nb_domain]->[T1..Tnb_sctr] + [T] includes local vars (currently unused) + + First we create [P,I] -> [T,a,S]. */ + + map = isl_map_flat_range_product (isl_map_copy (pbb->transformed), + isl_map_copy (pdr->accesses)); + /* Add a dimension for L: [P,I] -> [T,a,S,L].*/ + map = isl_map_add_dims (map, isl_dim_out, 1); + /* Build a constraint for "lma[S] - L == 0", effectively calculating + L in terms of subscripts. */ + lma = build_linearized_memory_access (map, pdr); + /* And add it to the map, so we now have: + [P,I] -> [T,a,S,L] : lma([S]) == L. */ + map = isl_map_add_constraint (map, lma); - for (i = 0; i < dim_sctr; i++) + /* Then we create [P,I,P',I'] -> [T,a,S,L,T',a',S',L']. */ + map = isl_map_flat_product (map, isl_map_copy (map)); + + /* Now add the equality T[time_depth] == T'[time_depth]+1. This will + force L' to be the linear address at T[time_depth] + 1. */ + time_depth = psct_dynamic_dim (pbb, depth); + /* Length of [a,S] plus [L] ... */ + offset = 1 + isl_map_dim (pdr->accesses, isl_dim_out); + /* ... plus [T]. */ + offset += isl_map_dim (pbb->transformed, isl_dim_out); + + c = isl_equality_alloc (isl_local_space_from_space (isl_map_get_space (map))); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, time_depth, 1); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, + offset + time_depth, -1); + c = isl_constraint_set_constant_si (c, 1); + map = isl_map_add_constraint (map, c); + + /* Now we equate most of the T/T' elements (making PITaSL nearly + the same is (PITaSL)', except for one dimension, namely for 'depth' + (an index into [I]), after translating to index into [T]. Take care + to not produce an empty map, which indicates we wanted to equate + two dimensions that are already coupled via the above time_depth + dimension. Happens with strip mining where several scatter dimension + are interdependend. */ + /* Length of [T]. */ + nt = pbb_nb_scattering_transform (pbb) + pbb_nb_local_vars (pbb); + for (i = 0; i < nt; i++) if (i != time_depth) { - ppl_new_Linear_Expression_with_dimension (&le, dim); - ppl_set_coef (le, i, 1); - ppl_set_coef (le, i + offset, -1); - ppl_new_Constraint (&new_cstr, le, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Pointset_Powerset_C_Polyhedron_add_constraint (temp, new_cstr); - - if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (temp)) - { - ppl_delete_Pointset_Powerset_C_Polyhedron (temp); - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron (&temp, *p); - } - else - ppl_Pointset_Powerset_C_Polyhedron_add_constraint (*p, new_cstr); - ppl_delete_Linear_Expression (le); - ppl_delete_Constraint (new_cstr); + isl_map *temp = isl_map_equate (isl_map_copy (map), + isl_dim_out, i, + isl_dim_out, offset + i); + if (isl_map_is_empty (temp)) + isl_map_free (temp); + else + { + isl_map_free (map); + map = temp; + } } - ppl_delete_Pointset_Powerset_C_Polyhedron (temp); -} - - -/* Set STRIDE to the stride of PDR in memory by advancing by one in - the loop at DEPTH. */ - -static void -pdr_stride_in_loop (mpz_t stride, graphite_dim_t depth, poly_dr_p pdr) -{ - ppl_dimension_type time_depth; - ppl_Linear_Expression_t le, lma; - ppl_Constraint_t new_cstr; - ppl_dimension_type i, *map; - ppl_Pointset_Powerset_C_Polyhedron_t p1, p2, sctr; - graphite_dim_t nb_subscripts = PDR_NB_SUBSCRIPTS (pdr) + 1; - poly_bb_p pbb = PDR_PBB (pdr); - ppl_dimension_type offset = pbb_nb_scattering_transform (pbb) - + pbb_nb_local_vars (pbb) - + pbb_dim_iter_domain (pbb); - ppl_dimension_type offsetg = offset + pbb_nb_params (pbb); - ppl_dimension_type dim_sctr = pbb_nb_scattering_transform (pbb) - + pbb_nb_local_vars (pbb); - ppl_dimension_type dim_L1 = offset + offsetg + 2 * nb_subscripts; - ppl_dimension_type dim_L2 = offset + offsetg + 2 * nb_subscripts + 1; - ppl_dimension_type new_dim = offset + offsetg + 2 * nb_subscripts + 2; - - /* The resulting polyhedron should have the following format: - T|I|T'|I'|G|S|S'|l1|l2 - where: - | T = t_1..t_{dim_sctr} - | I = i_1..i_{dim_iter_domain} - | T'= t'_1..t'_{dim_sctr} - | I'= i'_1..i'_{dim_iter_domain} - | G = g_1..g_{nb_params} - | S = s_1..s_{nb_subscripts} - | S'= s'_1..s'_{nb_subscripts} - | l1 and l2 are scalars. - - Some invariants: - offset = dim_sctr + dim_iter_domain + nb_local_vars - offsetg = dim_sctr + dim_iter_domain + nb_local_vars + nb_params. */ - - /* Construct the T|I|0|0|G|0|0|0|0 part. */ - { - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&sctr, PBB_TRANSFORMED_SCATTERING (pbb)); - ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed - (sctr, 2 * nb_subscripts + 2); - ppl_insert_dimensions_pointset (sctr, offset, offset); - } - - /* Construct the 0|I|0|0|G|S|0|0|0 part. */ - { - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&p1, PDR_ACCESSES (pdr)); - ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed - (p1, nb_subscripts + 2); - ppl_insert_dimensions_pointset (p1, 0, dim_sctr); - ppl_insert_dimensions_pointset (p1, offset, offset); - } - - /* Construct the 0|0|0|0|0|S|0|l1|0 part. */ - { - lma = build_linearized_memory_access (offset + dim_sctr, pdr); - ppl_set_coef (lma, dim_L1, -1); - ppl_new_Constraint (&new_cstr, lma, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Pointset_Powerset_C_Polyhedron_add_constraint (p1, new_cstr); - ppl_delete_Linear_Expression (lma); - ppl_delete_Constraint (new_cstr); - } - - /* Now intersect all the parts to get the polyhedron P1: - T|I|0|0|G|0|0|0 |0 - 0|I|0|0|G|S|0|0 |0 - 0|0|0|0|0|S|0|l1|0 - ------------------ - T|I|0|0|G|S|0|l1|0. */ - - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (p1, sctr); - ppl_delete_Pointset_Powerset_C_Polyhedron (sctr); - - /* Build P2, which would have the following form: - 0|0|T'|I'|G|0|S'|0|l2 - - P2 is built, by remapping the P1 polyhedron: - T|I|0|0|G|S|0|l1|0 - - using the following mapping: - T->T' - I->I' - S->S' - l1->l2. */ - { - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&p2, p1); - - map = ppl_new_id_map (new_dim); - - /* TI -> T'I'. */ - for (i = 0; i < offset; i++) - ppl_interchange (map, i, i + offset); - - /* l1 -> l2. */ - ppl_interchange (map, dim_L1, dim_L2); - - /* S -> S'. */ - for (i = 0; i < nb_subscripts; i++) - ppl_interchange (map, offset + offsetg + i, - offset + offsetg + nb_subscripts + i); - - ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (p2, map, new_dim); - free (map); - } - - time_depth = psct_dynamic_dim (pbb, depth); - - /* P1 = P1 inter P2. */ - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (p1, p2); - build_partial_difference (&p1, time_depth, offset, dim_sctr); - - /* Maximise the expression L2 - L1. */ - { - ppl_new_Linear_Expression_with_dimension (&le, new_dim); - ppl_set_coef (le, dim_L2, 1); - ppl_set_coef (le, dim_L1, -1); - ppl_max_for_le_pointset (p1, le, stride); - } + /* Now maximize the expression L' - L. */ + set = isl_map_range (map); + dc = isl_set_get_space (set); + aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc)); + aff = isl_aff_set_coefficient_si (aff, isl_dim_in, offset - 1, -1); + aff = isl_aff_set_coefficient_si (aff, isl_dim_in, offset + offset - 1, 1); + isl_int_init (islstride); + isl_set_max (set, aff, &islstride); + isl_int_get_gmp (islstride, stride); + isl_int_clear (islstride); + isl_aff_free (aff); + isl_set_free (set); if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -312,13 +250,8 @@ pdr_stride_in_loop (mpz_t stride, graphite_dim_t depth, poly_dr_p pdr) mp_get_memory_functions (NULL, NULL, &gmp_free); (*gmp_free) (str, strlen (str) + 1); } - - ppl_delete_Pointset_Powerset_C_Polyhedron (p1); - ppl_delete_Pointset_Powerset_C_Polyhedron (p2); - ppl_delete_Linear_Expression (le); } - /* Sets STRIDES to the sum of all the strides of the data references accessed in LOOP at DEPTH. */ @@ -475,23 +408,23 @@ static void pbb_interchange_loop_depths (graphite_dim_t depth1, graphite_dim_t depth2, poly_bb_p pbb) { - ppl_dimension_type i, dim; - ppl_dimension_type *map; - ppl_Polyhedron_t poly = PBB_TRANSFORMED_SCATTERING (pbb); - ppl_dimension_type dim1 = psct_dynamic_dim (pbb, depth1); - ppl_dimension_type dim2 = psct_dynamic_dim (pbb, depth2); + unsigned i; + unsigned dim1 = psct_dynamic_dim (pbb, depth1); + unsigned dim2 = psct_dynamic_dim (pbb, depth2); + isl_space *d = isl_map_get_space (pbb->transformed); + isl_space *d1 = isl_space_range (d); + unsigned n = isl_space_dim (d1, isl_dim_out); + isl_space *d2 = isl_space_add_dims (d1, isl_dim_in, n); + isl_map *x = isl_map_universe (d2); - ppl_Polyhedron_space_dimension (poly, &dim); - map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim); + x = isl_map_equate (x, isl_dim_in, dim1, isl_dim_out, dim2); + x = isl_map_equate (x, isl_dim_in, dim2, isl_dim_out, dim1); - for (i = 0; i < dim; i++) - map[i] = i; + for (i = 0; i < n; i++) + if (i != dim1 && i != dim2) + x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i); - map[dim1] = dim2; - map[dim2] = dim1; - - ppl_Polyhedron_map_space_dimensions (poly, map, dim); - free (map); + pbb->transformed = isl_map_apply_range (pbb->transformed, x); } /* Apply the interchange of loops at depths DEPTH1 and DEPTH2 to all diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 9f3ba1db347..e3563a21a3f 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -1,5 +1,5 @@ /* Graphite polyhedral representation. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop and Tobias Grosser . @@ -18,7 +18,20 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ + #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "diagnostic-core.h" @@ -32,14 +45,24 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" -#include "graphite-dependences.h" -#include "graphite-cloog-util.h" #define OPENSCOP_MAX_STRING 256 + +/* Print to STDERR the GMP value VAL. */ + +DEBUG_FUNCTION void +debug_gmp_value (mpz_t val) +{ + char *str = mpz_get_str (0, 10, val); + void (*gmp_free) (void *, size_t); + + fprintf (stderr, "%s", str); + mp_get_memory_functions (NULL, NULL, &gmp_free); + (*gmp_free) (str, strlen (str) + 1); +} + /* Return the maximal loop depth in SCOP. */ int @@ -59,223 +82,6 @@ scop_max_loop_depth (scop_p scop) return max_nb_loops; } -/* Extend the scattering matrix of PBB to MAX_SCATTERING scattering - dimensions. */ - -static void -extend_scattering (poly_bb_p pbb, int max_scattering) -{ - ppl_dimension_type nb_old_dims, nb_new_dims; - int nb_added_dims, i; - ppl_Coefficient_t coef; - mpz_t one; - - nb_added_dims = max_scattering - pbb_nb_scattering_transform (pbb); - mpz_init (one); - mpz_set_si (one, 1); - ppl_new_Coefficient (&coef); - ppl_assign_Coefficient_from_mpz_t (coef, one); - - gcc_assert (nb_added_dims >= 0); - - nb_old_dims = pbb_nb_scattering_transform (pbb) + pbb_dim_iter_domain (pbb) - + scop_nb_params (PBB_SCOP (pbb)); - nb_new_dims = nb_old_dims + nb_added_dims; - - ppl_insert_dimensions (PBB_TRANSFORMED_SCATTERING (pbb), - pbb_nb_scattering_transform (pbb), nb_added_dims); - PBB_NB_SCATTERING_TRANSFORM (pbb) += nb_added_dims; - - /* Add identity matrix for the added dimensions. */ - for (i = max_scattering - nb_added_dims; i < max_scattering; i++) - { - ppl_Constraint_t cstr; - ppl_Linear_Expression_t expr; - - ppl_new_Linear_Expression_with_dimension (&expr, nb_new_dims); - ppl_Linear_Expression_add_to_coefficient (expr, i, coef); - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (PBB_TRANSFORMED_SCATTERING (pbb), cstr); - ppl_delete_Constraint (cstr); - ppl_delete_Linear_Expression (expr); - } - - ppl_delete_Coefficient (coef); - mpz_clear (one); -} - -/* All scattering matrices in SCOP will have the same number of scattering - dimensions. */ - -int -unify_scattering_dimensions (scop_p scop) -{ - int i; - poly_bb_p pbb; - graphite_dim_t max_scattering = 0; - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) - max_scattering = MAX (pbb_nb_scattering_transform (pbb), max_scattering); - - FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) - extend_scattering (pbb, max_scattering); - - return max_scattering; -} - -/* Print to FILE the pdr PH in OpenScop format. NB_SUBSCRIPTS is the number - of subscripts in PH, ALIAS_SET_DIM is the dimension of the alias set and - NB_PARAMS is the number of parameters in PH. */ - -static void -openscop_print_pdr_polyhedron (FILE *file, ppl_const_Polyhedron_t ph, - int nb_subscripts, int alias_set_dimension, - int nb_params) -{ - int input, locals, output; - ppl_dimension_type alias_set_dim = (ppl_dimension_type) alias_set_dimension; - ppl_dimension_type sub_dim_last = alias_set_dim + nb_subscripts; - ppl_dimension_type *map, i, ph_space_dim = sub_dim_last + 1; - ppl_Polyhedron_t pph; - - ppl_new_C_Polyhedron_from_C_Polyhedron (&pph, ph); - - map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, ph_space_dim); - - for (i = 0; i < alias_set_dim - 1; i++) - map[i] = nb_subscripts + 1 + i; - - for (i = alias_set_dim - 1; i < sub_dim_last; i++) - map[i] = i - alias_set_dim + 1; - - ppl_Polyhedron_map_space_dimensions (pph, map, ph_space_dim - 1); - - locals = 0; - input = alias_set_dim - nb_params - 1; - - /* According to OpenScop specification, the alias set column is a part of - the output columns. */ - output = nb_subscripts + 1; - - openscop_print_polyhedron_matrix (file, pph, output, input, locals, nb_params); -} - -/* Print to FILE the powerset PDR. NB_SUBSCRIPTS is the number of subscripts - in PDR, ALIAS_SET_DIM is the dimension of the alias set in PDR and - NB_PARAMS is the number of parameters in PDR. */ - -static void -openscop_print_pdr_powerset (FILE *file, - ppl_Pointset_Powerset_C_Polyhedron_t ps, - int nb_subscripts, - int alias_set_dim, - int nb_params) -{ - size_t nb_disjuncts; - ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; - - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it); - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end); - - ppl_Pointset_Powerset_C_Polyhedron_size (ps, &nb_disjuncts); - fprintf (file, "%d\n", (int) nb_disjuncts); - - for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it), - ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end); - !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end); - ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it)) - { - ppl_const_Polyhedron_t ph; - - ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph); - openscop_print_pdr_polyhedron (file, ph, nb_subscripts, alias_set_dim, - nb_params); - } - - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it); - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end); -} - -/* Print to FILE the powerset PS in its OpenScop matrix form. */ - -static void -openscop_print_powerset_matrix (FILE *file, - ppl_Pointset_Powerset_C_Polyhedron_t ps, - int output, int input, int locals, - int params) -{ - size_t nb_disjuncts; - ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; - - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it); - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end); - - ppl_Pointset_Powerset_C_Polyhedron_size (ps, &nb_disjuncts); - fprintf (file, "%d\n", (int) nb_disjuncts); - - for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it), - ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end); - !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end); - ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it)) - { - ppl_const_Polyhedron_t ph; - - ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph); - openscop_print_polyhedron_matrix (file, ph, output, input, locals, - params); - } - - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it); - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end); -} - -/* Prints to FILE the scattering function of PBB in OpenScop format, at some - VERBOSITY level. */ - -static void -openscop_print_scattering_function_1 (FILE *file, poly_bb_p pbb, int verbosity) -{ - graphite_dim_t i; - ppl_const_Polyhedron_t ph; - - if (verbosity > 0) - { - fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb)); - fprintf (file, "#eq"); - - for (i = 0; i < pbb_nb_scattering_transform (pbb); i++) - fprintf (file, " s%d", (int) i); - - for (i = 0; i < pbb_nb_local_vars (pbb); i++) - fprintf (file, " lv%d", (int) i); - - for (i = 0; i < pbb_dim_iter_domain (pbb); i++) - fprintf (file, " i%d", (int) i); - - for (i = 0; i < pbb_nb_params (pbb); i++) - fprintf (file, " p%d", (int) i); - - fprintf (file, " cst\n"); - } - - /* Number of disjunct components. Remove this when - PBB_TRANSFORMED_SCATTERING will be a pointset_powerset. */ - fprintf (file, "1\n"); - - ph = PBB_TRANSFORMED_SCATTERING (pbb) - ? PBB_TRANSFORMED_SCATTERING (pbb) - : PBB_ORIGINAL_SCATTERING (pbb); - - openscop_print_polyhedron_matrix (file, ph, - pbb_nb_scattering_transform (pbb), - pbb_dim_iter_domain (pbb), - pbb_nb_local_vars (pbb), - pbb_nb_params (pbb)); - - if (verbosity > 0) - fprintf (file, "#)\n"); -} - /* Prints to FILE the scattering function of PBB, at some VERBOSITY level. */ @@ -304,12 +110,8 @@ print_scattering_function_1 (FILE *file, poly_bb_p pbb, int verbosity) fprintf (file, " cst\n"); } - /* Number of disjunct components. Remove this when - PBB_TRANSFORMED_SCATTERING will be a pointset_powerset. */ - fprintf (file, "1\n"); - ppl_print_polyhedron_matrix (file, PBB_TRANSFORMED_SCATTERING (pbb) - ? PBB_TRANSFORMED_SCATTERING (pbb) - : PBB_ORIGINAL_SCATTERING (pbb)); + fprintf (file, "isl\n"); + print_isl_map (file, pbb->transformed ? pbb->transformed : pbb->schedule); if (verbosity > 0) fprintf (file, "#)\n"); @@ -324,8 +126,7 @@ print_scattering_function (FILE *file, poly_bb_p pbb, int verbosity) if (!PBB_TRANSFORMED (pbb)) return; - if (PBB_TRANSFORMED_SCATTERING (pbb) - || PBB_ORIGINAL_SCATTERING (pbb)) + if (pbb->schedule || pbb->transformed) { if (verbosity > 0) fprintf (file, "# Scattering function is provided\n"); @@ -341,7 +142,7 @@ print_scattering_function (FILE *file, poly_bb_p pbb, int verbosity) return; } - openscop_print_scattering_function_1 (file, pbb, verbosity); + print_scattering_function_1 (file, pbb, verbosity); if (verbosity > 0) fprintf (file, "# Scattering names are not provided\n"); @@ -420,334 +221,12 @@ debug_iteration_domains (scop_p scop, int verbosity) print_iteration_domains (stderr, scop, verbosity); } -/* Read N integer from FILE. */ - -int * -openscop_read_N_int (FILE *file, int N) -{ - char s[OPENSCOP_MAX_STRING]; - char *str; - int i, *res = (int *) xmalloc (OPENSCOP_MAX_STRING * sizeof (int)); - - /* Skip blank and commented lines. */ - while (fgets (s, sizeof s, file) == (char *) 0 - || s[0] == '#' - || ISSPACE (s[0])) - ; - - str = s; - - for (i = 0; i < N; i++) - { - sscanf (str, "%d", &res[i]); - - /* Jump the integer that was read. */ - while ((*str) && !ISSPACE (*str) && (*str != '#')) - str++; - - /* Jump spaces. */ - while ((*str) && ISSPACE (*str) && (*str != '#')) - str++; - } - - return res; -} - -/* Read one integer from FILE. */ - -static int -openscop_read_one_int (FILE *file) -{ - int *x = openscop_read_N_int (file, 1); - int res = *x; - - free (x); - return res; -} - -/* Read N string from FILE. */ - -static char * -openscop_read_N_string (FILE *file, int N) -{ - int count, i; - char str[OPENSCOP_MAX_STRING]; - char *tmp = (char *) xmalloc (sizeof (char) * OPENSCOP_MAX_STRING); - char *s = NULL; - - /* Skip blank and commented lines. */ - while (fgets (str, sizeof str, file) == (char *) 0 - || str[0] == '#' - || ISSPACE (str[0])) - ; - - s = str; - count = 0; - - for (i = 0; i < N; i++) - { - /* Read the first word. */ - for (; (*s) && (!ISSPACE (*s)) && (*s != '#'); ++count) - tmp[count] = *(s++); - - tmp[count] = ' '; - count++; - - /* Jump spaces. */ - while ((*s) && ISSPACE (*s) && (*s != '#')) - s++; - } - - tmp[count-1] = '\0'; - - return tmp; -} - -/* Read one string from FILE. */ - -static char * -openscop_read_one_string (FILE *file) -{ - return openscop_read_N_string (file, 1); -} - -/* Read from FILE the powerset PS in its OpenScop matrix form. OUTPUT is the - number of output dimensions, INPUT is the number of input dimensions, - LOCALS is the number of existentially quantified variables and PARAMS is - the number of parameters. */ - -static void -openscop_read_powerset_matrix (FILE *file, - ppl_Pointset_Powerset_C_Polyhedron_t *ps, - int *output, int *input, int *locals, - int *params) -{ - int nb_disjuncts, i; - - nb_disjuncts = openscop_read_one_int (file); - - for (i = 0; i < nb_disjuncts; i++) - { - ppl_Polyhedron_t ph; - - openscop_read_polyhedron_matrix (file, &ph, output, input, locals, - params); - if (!ph) - *ps = NULL; - else if (i == 0) - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (ps, ph); - else - ppl_Pointset_Powerset_C_Polyhedron_add_disjunct (*ps, ph); - } -} - -/* Read a scattering function from FILE and save it to PBB. Return whether - the scattering function was provided or not. */ - -static bool -graphite_read_scatt (FILE *file, poly_bb_p pbb) -{ - bool scattering_provided = false; - int output, input, locals, params; - ppl_Polyhedron_t newp; - - if (openscop_read_one_int (file) > 0) - { - /* Read number of disjunct components. */ - openscop_read_one_int (file); - - /* Read scattering function. */ - openscop_read_polyhedron_matrix (file, &newp, &output, &input, - &locals, ¶ms); - store_scattering (PBB_SCOP (pbb)); - PBB_TRANSFORMED (pbb) = poly_scattering_new (); - PBB_TRANSFORMED_SCATTERING (pbb) = newp; - PBB_NB_LOCAL_VARIABLES (pbb) = locals; - - /* New scattering dimension. */ - PBB_NB_SCATTERING_TRANSFORM (pbb) = output; - - scattering_provided = true; - } - - return scattering_provided; -} - -/* Read a scop file. Return true if the scop is transformed. */ - -static bool -graphite_read_scop_file (FILE *file, scop_p scop) -{ - char *tmp, *language; - size_t i, j, nb_statements, nbr, nbw; - int input, output, locals, params; - ppl_Pointset_Powerset_C_Polyhedron_t ps; - poly_bb_p pbb; - bool transform_done = false; - - /* Ensure that the file is in OpenScop format. */ - tmp = openscop_read_N_string (file, 2); - - if (strcmp (tmp, "SCoP 1")) - { - error ("the file is not in OpenScop format"); - return false; - } - - free (tmp); - - /* Read the language. */ - language = openscop_read_one_string (file); - - if (strcmp (language, "Gimple")) - { - error ("the language is not recognized"); - return false; - } - - free (language); - - /* Read the context but do not use it. */ - openscop_read_powerset_matrix (file, &ps, &input, &output, &locals, ¶ms); - - if ((size_t) params != scop->nb_params) - { - error ("parameters number in the scop file is different from the" - " internal scop parameter number"); - return false; - } - - /* Read parameter names if provided. */ - if (openscop_read_one_int (file)) - openscop_read_N_string (file, scop->nb_params); - - nb_statements = openscop_read_one_int (file); - - if (nb_statements != VEC_length (poly_bb_p, SCOP_BBS (scop))) - { - error ("number of statements in the OpenScop file does not match" - " the graphite internal statements number"); - return false; - } - - for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++) - { - /* Read iteration domain. */ - openscop_read_powerset_matrix (file, &ps, &input, &output, &locals, - ¶ms); - - /* Read scattering. */ - transform_done = graphite_read_scatt (file, pbb); - - /* Scattering names. */ - openscop_read_one_int (file); - - /* Read access functions. */ - if (openscop_read_one_int (file) > 0) - { - nbr = openscop_read_one_int (file); - - /* Read access functions. */ - for (j = 0; j < nbr; j++) - openscop_read_powerset_matrix (file, &ps, &input, &output, &locals, - ¶ms); - - nbw = openscop_read_one_int (file); - - /* Write access functions. */ - for (j = 0; j < nbw; j++) - openscop_read_powerset_matrix (file, &ps, &input, &output, &locals, - ¶ms); - } - - /* Statement body. */ - openscop_read_one_int (file); - } - - return transform_done; -} - -/* Initialize and return a file that will be used to write a scop. SCOP_NUMBER - is a sequential number (identifier) used to differentiate scop files. - Examples of the generated file names: dump_base_name.0.graphite, - dump_base_name.1.graphite, dump_base_name.2.graphite, etc. */ - -static FILE * -init_graphite_out_file (int scop_number) -{ - FILE *graphite_out_file; - int len = strlen (dump_base_name); - char *dumpname = XNEWVEC (char, len + 25); - char *s_scop_number = XNEWVEC (char, 15); - - memcpy (dumpname, dump_base_name, len + 1); - strip_off_ending (dumpname, len); - sprintf (s_scop_number, ".%d", scop_number); - strcat (dumpname, s_scop_number); - strcat (dumpname, ".graphite"); - graphite_out_file = fopen (dumpname, "w+b"); - - if (graphite_out_file == 0) - fatal_error ("can%'t open %s for writing: %m", dumpname); - - free (dumpname); - - return graphite_out_file; -} - -/* Open and return a file used for scop reading. SCOP_NUMBER is a sequential - number (identifier) used to differentiate scop files. Examples of the - generated file names: dump_base_name.0.graphite, dump_base_name.1.graphite, - dump_base_name.2.graphite, etc. */ - -static FILE * -init_graphite_in_file (int scop_number) -{ - FILE *graphite_in_file; - int len = strlen (dump_base_name); - char *dumpname = XNEWVEC (char, len + 25); - char *s_scop_number = XNEWVEC (char, 15); - - memcpy (dumpname, dump_base_name, len + 1); - strip_off_ending (dumpname, len); - sprintf (s_scop_number, ".%d", scop_number); - strcat (dumpname, s_scop_number); - strcat (dumpname, ".graphite"); - graphite_in_file = fopen (dumpname, "r+b"); - - if (graphite_in_file == 0) - fatal_error ("can%'t open %s for reading: %m", dumpname); - - free (dumpname); - - return graphite_in_file; -} - /* Apply graphite transformations to all the basic blocks of SCOP. */ bool apply_poly_transforms (scop_p scop) { bool transform_done = false; - FILE *graphite_file; - static size_t file_scop_number = 0; - - /* This feature is only enabled in the Graphite branch. */ - if (0) - { - graphite_file = init_graphite_in_file (file_scop_number); - transform_done |= graphite_read_scop_file (graphite_file, scop); - - /* We cannot check for the legality of the transform here: there - are cases where graphite_legal_transform cannot determine the - dependence at compile time. For an example, see the - explanation of why http://gcc.gnu.org/PR45450 is invalid. */ - if (0 && !graphite_legal_transform (scop)) - fatal_error ("the graphite file read for scop %d does not contain a legal transform", - (int) file_scop_number); - - file_scop_number++; - } /* Generate code even if we did not apply any real transformation. This also allows to check the performance for the identity @@ -771,70 +250,17 @@ apply_poly_transforms (scop_p scop) transform_done |= scop_do_interchange (scop); } - /* This feature is only enabled in the Graphite branch. */ - if (0) - { - graphite_file = init_graphite_out_file (file_scop_number); - print_scop (graphite_file, scop, 1); - file_scop_number++; - } - return transform_done; } -/* Returns true when it PDR1 is a duplicate of PDR2: same PBB, and - their ACCESSES, TYPE, and NB_SUBSCRIPTS are the same. */ - -static inline bool -can_collapse_pdrs (poly_dr_p pdr1, poly_dr_p pdr2) -{ - bool res; - ppl_Pointset_Powerset_C_Polyhedron_t af1, af2, diff; - - if (PDR_PBB (pdr1) != PDR_PBB (pdr2) - || PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2) - || PDR_TYPE (pdr1) != PDR_TYPE (pdr2)) - return false; - - af1 = PDR_ACCESSES (pdr1); - af2 = PDR_ACCESSES (pdr2); - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&diff, af1); - ppl_Pointset_Powerset_C_Polyhedron_difference_assign (diff, af2); - - res = ppl_Pointset_Powerset_C_Polyhedron_is_empty (diff); - ppl_delete_Pointset_Powerset_C_Polyhedron (diff); - return res; -} - -/* Removes duplicated data references in PBB. */ - -void -pbb_remove_duplicate_pdrs (poly_bb_p pbb) -{ - int i, j; - poly_dr_p pdr1, pdr2; - - FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr1) - for (j = i + 1; VEC_iterate (poly_dr_p, PBB_DRS (pbb), j, pdr2); j++) - if (can_collapse_pdrs (pdr1, pdr2)) - { - PDR_NB_REFS (pdr1) += PDR_NB_REFS (pdr2); - free_poly_dr (pdr2); - VEC_ordered_remove (poly_dr_p, PBB_DRS (pbb), j); - } - - PBB_PDR_DUPLICATES_REMOVED (pbb) = true; -} - /* Create a new polyhedral data reference and add it to PBB. It is defined by its ACCESSES, its TYPE, and the number of subscripts NB_SUBSCRIPTS. */ void new_poly_dr (poly_bb_p pbb, int dr_base_object_set, - ppl_Pointset_Powerset_C_Polyhedron_t accesses, - enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts) + enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts, + isl_map *acc, isl_set *extent) { static int id = 0; poly_dr_p pdr = XNEW (struct poly_dr); @@ -843,7 +269,8 @@ new_poly_dr (poly_bb_p pbb, int dr_base_object_set, PDR_BASE_OBJECT_SET (pdr) = dr_base_object_set; PDR_NB_REFS (pdr) = 1; PDR_PBB (pdr) = pbb; - PDR_ACCESSES (pdr) = accesses; + pdr->accesses = acc; + pdr->extent = extent; PDR_TYPE (pdr) = type; PDR_CDR (pdr) = cdr; PDR_NB_SUBSCRIPTS (pdr) = nb_subscripts; @@ -855,7 +282,8 @@ new_poly_dr (poly_bb_p pbb, int dr_base_object_set, void free_poly_dr (poly_dr_p pdr) { - ppl_delete_Pointset_Powerset_C_Polyhedron (PDR_ACCESSES (pdr)); + isl_map_free (pdr->accesses); + isl_set_free (pdr->extent); XDELETE (pdr); } @@ -866,7 +294,10 @@ new_poly_bb (scop_p scop, void *black_box) { poly_bb_p pbb = XNEW (struct poly_bb); - PBB_DOMAIN (pbb) = NULL; + pbb->domain = NULL; + pbb->schedule = NULL; + pbb->transformed = NULL; + pbb->saved = NULL; PBB_SCOP (pbb) = scop; pbb_set_black_box (pbb, black_box); PBB_TRANSFORMED (pbb) = NULL; @@ -874,7 +305,6 @@ new_poly_bb (scop_p scop, void *black_box) PBB_ORIGINAL (pbb) = NULL; PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3); PBB_IS_REDUCTION (pbb) = false; - PBB_PDR_DUPLICATES_REMOVED (pbb) = false; GBB_PBB ((gimple_bb_p) black_box) = pbb; return pbb; @@ -888,16 +318,10 @@ free_poly_bb (poly_bb_p pbb) int i; poly_dr_p pdr; - ppl_delete_Pointset_Powerset_C_Polyhedron (PBB_DOMAIN (pbb)); - - if (PBB_TRANSFORMED (pbb)) - poly_scattering_free (PBB_TRANSFORMED (pbb)); - - if (PBB_SAVED (pbb)) - poly_scattering_free (PBB_SAVED (pbb)); - - if (PBB_ORIGINAL (pbb)) - poly_scattering_free (PBB_ORIGINAL (pbb)); + isl_set_free (pbb->domain); + isl_map_free (pbb->schedule); + isl_map_free (pbb->transformed); + isl_map_free (pbb->saved); if (PBB_DRS (pbb)) FOR_EACH_VEC_ELT (poly_dr_p, PBB_DRS (pbb), i, pdr) @@ -934,8 +358,6 @@ print_pdr_access_layout (FILE *file, poly_bb_p pbb, poly_dr_p pdr) void print_pdr (FILE *file, poly_dr_p pdr, int verbosity) { - int alias_set_dim; - if (verbosity > 1) { fprintf (file, "# pdr_%d (", PDR_ID (pdr)); @@ -967,13 +389,7 @@ print_pdr (FILE *file, poly_dr_p pdr, int verbosity) print_pdr_access_layout (file, PDR_PBB (pdr), pdr); } - alias_set_dim = pdr_alias_set_dim (pdr) + 1; - - openscop_print_pdr_powerset (file, - PDR_ACCESSES (pdr), - PDR_NB_SUBSCRIPTS (pdr), - alias_set_dim, - pbb_nb_params (PDR_PBB (pdr))); + /* XXX isl dump accesses/subscripts */ if (verbosity > 0) fprintf (file, "#)\n"); @@ -998,11 +414,21 @@ new_scop (void *region) { scop_p scop = XNEW (struct scop); - SCOP_CONTEXT (scop) = NULL; + scop->context = NULL; + scop->must_raw = NULL; + scop->may_raw = NULL; + scop->must_raw_no_source = NULL; + scop->may_raw_no_source = NULL; + scop->must_war = NULL; + scop->may_war = NULL; + scop->must_war_no_source = NULL; + scop->may_war_no_source = NULL; + scop->must_waw = NULL; + scop->may_waw = NULL; + scop->must_waw_no_source = NULL; + scop->may_waw_no_source = NULL; scop_set_region (scop, region); SCOP_BBS (scop) = VEC_alloc (poly_bb_p, heap, 3); - SCOP_ORIGINAL_PDDRS (scop) = htab_create (10, hash_poly_ddr_p, - eq_poly_ddr_p, free_poly_ddr); SCOP_ORIGINAL_SCHEDULE (scop) = NULL; SCOP_TRANSFORMED_SCHEDULE (scop) = NULL; SCOP_SAVED_SCHEDULE (scop) = NULL; @@ -1024,10 +450,19 @@ free_scop (scop_p scop) VEC_free (poly_bb_p, heap, SCOP_BBS (scop)); - if (SCOP_CONTEXT (scop)) - ppl_delete_Pointset_Powerset_C_Polyhedron (SCOP_CONTEXT (scop)); - - htab_delete (SCOP_ORIGINAL_PDDRS (scop)); + isl_set_free (scop->context); + isl_union_map_free (scop->must_raw); + isl_union_map_free (scop->may_raw); + isl_union_map_free (scop->must_raw_no_source); + isl_union_map_free (scop->may_raw_no_source); + isl_union_map_free (scop->must_war); + isl_union_map_free (scop->may_war); + isl_union_map_free (scop->must_war_no_source); + isl_union_map_free (scop->may_war_no_source); + isl_union_map_free (scop->must_waw); + isl_union_map_free (scop->may_waw); + isl_union_map_free (scop->must_waw_no_source); + isl_union_map_free (scop->may_waw_no_source); free_lst (SCOP_ORIGINAL_SCHEDULE (scop)); free_lst (SCOP_TRANSFORMED_SCHEDULE (scop)); free_lst (SCOP_SAVED_SCHEDULE (scop)); @@ -1043,7 +478,7 @@ openscop_print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity) graphite_dim_t i; gimple_bb_p gbb = PBB_BLACK_BOX (pbb); - if (!PBB_DOMAIN (pbb)) + if (!pbb->domain) return; if (verbosity > 0) @@ -1060,14 +495,7 @@ openscop_print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity) fprintf (file, " cst\n"); } - if (PBB_DOMAIN (pbb)) - openscop_print_powerset_matrix (file, PBB_DOMAIN (pbb), - pbb_dim_iter_domain (pbb), - 0, - 0, - pbb_nb_params (pbb)); - else - fprintf (file, "0\n"); + fprintf (file, "XXX isl\n"); if (verbosity > 0) fprintf (file, "#)\n"); @@ -1076,35 +504,9 @@ openscop_print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity) /* Print to FILE the domain of PBB, at some VERBOSITY level. */ void -print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity) +print_pbb_domain (FILE *file, poly_bb_p pbb, int verbosity ATTRIBUTE_UNUSED) { - graphite_dim_t i; - gimple_bb_p gbb = PBB_BLACK_BOX (pbb); - - if (!PBB_DOMAIN (pbb)) - return; - - if (verbosity > 0) - { - fprintf (file, "# Iteration domain of bb_%d (\n", GBB_BB (gbb)->index); - fprintf (file, "# eq"); - - for (i = 0; i < pbb_dim_iter_domain (pbb); i++) - fprintf (file, " i%d", (int) i); - - for (i = 0; i < pbb_nb_params (pbb); i++) - fprintf (file, " p%d", (int) i); - - fprintf (file, " cst\n"); - } - - if (PBB_DOMAIN (pbb)) - ppl_print_powerset_matrix (file, PBB_DOMAIN (pbb)); - else - fprintf (file, "0\n"); - - if (verbosity > 0) - fprintf (file, "#)\n"); + print_isl_set (file, pbb->domain); } /* Dump the cases of a graphite basic block GBB on FILE. */ @@ -1354,9 +756,9 @@ openscop_print_scop_context (FILE *file, scop_p scop, int verbosity) fprintf (file, " cst\n"); } - if (SCOP_CONTEXT (scop)) - openscop_print_powerset_matrix (file, SCOP_CONTEXT (scop), 0, 0, 0, - scop_nb_params (scop)); + if (scop->context) + /* XXX isl print context */ + fprintf (file, "XXX isl\n"); else fprintf (file, "0 %d 0 0 0 %d\n", (int) scop_nb_params (scop) + 2, (int) scop_nb_params (scop)); @@ -1383,10 +785,10 @@ print_scop_context (FILE *file, scop_p scop, int verbosity) fprintf (file, " cst\n"); } - if (SCOP_CONTEXT (scop)) - ppl_print_powerset_matrix (file, SCOP_CONTEXT (scop)); + if (scop->context) + print_isl_set (file, scop->context); else - fprintf (file, "0 %d\n", (int) scop_nb_params (scop) + 2); + fprintf (file, "no isl context %d\n", (int) scop_nb_params (scop) + 2); if (verbosity > 0) fprintf (file, "# )\n"); @@ -1476,13 +878,10 @@ print_cloog (FILE *file, scop_p scop, int verbosity) fprintf (file, "# Number of scattering functions\n"); fprintf (file, "%d\n", VEC_length (poly_bb_p, SCOP_BBS (scop))); - unify_scattering_dimensions (scop); FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) { - if (!PBB_TRANSFORMED (pbb) - || !(PBB_TRANSFORMED_SCATTERING (pbb) - || PBB_ORIGINAL_SCATTERING (pbb))) + if (!(pbb->transformed || pbb->schedule)) continue; if (verbosity > 1) @@ -1554,66 +953,61 @@ debug_scop_params (scop_p scop, int verbosity) print_scop_params (stderr, scop, verbosity); } - -/* The dimension in the transformed scattering polyhedron of PBB - containing the scattering iterator for the loop at depth LOOP_DEPTH. */ - -ppl_dimension_type -psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth) +extern isl_ctx *the_isl_ctx; +void +print_isl_set (FILE *f, isl_set *set) { - ppl_const_Constraint_System_t pcs; - ppl_Constraint_System_const_iterator_t cit, cend; - ppl_const_Constraint_t cstr; - ppl_Polyhedron_t ph = PBB_TRANSFORMED_SCATTERING (pbb); - ppl_dimension_type iter = psct_iterator_dim (pbb, loop_depth); - ppl_Linear_Expression_t expr; - ppl_Coefficient_t coef; - mpz_t val; - graphite_dim_t i; + isl_printer *p = isl_printer_to_file (the_isl_ctx, f); + p = isl_printer_print_set (p, set); + isl_printer_free (p); +} - mpz_init (val); - ppl_new_Coefficient (&coef); - ppl_Polyhedron_get_constraints (ph, &pcs); - ppl_new_Constraint_System_const_iterator (&cit); - ppl_new_Constraint_System_const_iterator (&cend); +DEBUG_FUNCTION void +debug_isl_set (isl_set *set) +{ + print_isl_set (stderr, set); +} - for (ppl_Constraint_System_begin (pcs, cit), - ppl_Constraint_System_end (pcs, cend); - !ppl_Constraint_System_const_iterator_equal_test (cit, cend); - ppl_Constraint_System_const_iterator_increment (cit)) - { - ppl_Constraint_System_const_iterator_dereference (cit, &cstr); - ppl_new_Linear_Expression_from_Constraint (&expr, cstr); - ppl_Linear_Expression_coefficient (expr, iter, coef); - ppl_Coefficient_to_mpz_t (coef, val); +void +print_isl_map (FILE *f, isl_map *map) +{ + isl_printer *p = isl_printer_to_file (the_isl_ctx, f); + p = isl_printer_print_map (p, map); + isl_printer_free (p); +} - if (mpz_sgn (val) == 0) - { - ppl_delete_Linear_Expression (expr); - continue; - } +DEBUG_FUNCTION void +debug_isl_map (isl_map *map) +{ + print_isl_map (stderr, map); +} - for (i = 0; i < pbb_nb_scattering_transform (pbb); i++) - { - ppl_dimension_type scatter = psct_scattering_dim (pbb, i); +void +print_isl_aff (FILE *f, isl_aff *aff) +{ + isl_printer *p = isl_printer_to_file (the_isl_ctx, f); + p = isl_printer_print_aff (p, aff); + isl_printer_free (p); +} - ppl_Linear_Expression_coefficient (expr, scatter, coef); - ppl_Coefficient_to_mpz_t (coef, val); +DEBUG_FUNCTION void +debug_isl_aff (isl_aff *aff) +{ + print_isl_aff (stderr, aff); +} - if (mpz_sgn (val) != 0) - { - mpz_clear (val); - ppl_delete_Linear_Expression (expr); - ppl_delete_Coefficient (coef); - ppl_delete_Constraint_System_const_iterator (cit); - ppl_delete_Constraint_System_const_iterator (cend); +void +print_isl_constraint (FILE *f, isl_constraint *c) +{ + isl_printer *p = isl_printer_to_file (the_isl_ctx, f); + p = isl_printer_print_constraint (p, c); + isl_printer_free (p); +} - return scatter; - } - } - } - - gcc_unreachable (); +DEBUG_FUNCTION void +debug_isl_constraint (isl_constraint *c) +{ + print_isl_constraint (stderr, c); } /* Returns the number of iterations RES of the loop around PBB at @@ -1624,112 +1018,37 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb, graphite_dim_t time_depth, mpz_t res) { - ppl_Pointset_Powerset_C_Polyhedron_t domain, sctr_lb, sctr_ub; - ppl_dimension_type domain_dim, sctr_dim; - graphite_dim_t dim_iter_domain = pbb_dim_iter_domain (pbb); - ppl_Linear_Expression_t le; - mpz_t lb, ub, diff, one; - int i; + isl_set *transdomain; + isl_space *dc; + isl_aff *aff; + isl_int isllb, islub; - ppl_Polyhedron_space_dimension (PBB_TRANSFORMED_SCATTERING (pbb), &sctr_dim); + isl_int_init (isllb); + isl_int_init (islub); - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&domain, PBB_DOMAIN (pbb)); + /* Map the iteration domain through the current scatter, and work + on the resulting set. */ + transdomain = isl_set_apply (isl_set_copy (pbb->domain), + isl_map_copy (pbb->transformed)); - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (domain, &domain_dim); + /* Select the time_depth' dimension via an affine expression. */ + dc = isl_set_get_space (transdomain); + aff = isl_aff_zero_on_domain (isl_local_space_from_space (dc)); + aff = isl_aff_set_coefficient_si (aff, isl_dim_in, time_depth, 1); - mpz_init (diff); - mpz_init (lb); - mpz_init (ub); - mpz_init (one); - mpz_set_si (one, 1); + /* And find the min/max for that function. */ + /* XXX isl check results? */ + isl_set_min (transdomain, aff, &isllb); + isl_set_max (transdomain, aff, &islub); - /* Compute the upper bound on the original iteration domain and add - that upper bound to the scattering. */ - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&sctr_ub, PBB_TRANSFORMED_SCATTERING (pbb)); - for (i = 0; i < (int) dim_iter_domain; i++) - { - ppl_Linear_Expression_t eq; - ppl_Constraint_t pc; - ppl_Constraint_System_t cs; - ppl_Polyhedron_t ph; - ppl_Pointset_Powerset_C_Polyhedron_t pph; + isl_int_sub (islub, islub, isllb); + isl_int_add_ui (islub, islub, 1); + isl_int_get_gmp (islub, res); - ppl_new_Linear_Expression_with_dimension (&le, domain_dim); - ppl_set_coef (le, i, 1); - ppl_min_for_le_pointset (domain, le, lb); - ppl_max_for_le_pointset (domain, le, ub); - mpz_sub (diff, ub, lb); - mpz_add (diff, diff, one); - - ppl_new_Linear_Expression_with_dimension (&eq, sctr_dim); - ppl_set_coef (eq, psct_iterator_dim (pbb, i), -1); - ppl_set_inhomogeneous_gmp (eq, diff); - - ppl_new_Constraint (&pc, eq, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_new_Constraint_System_from_Constraint (&cs, pc); - ppl_new_C_Polyhedron_from_Constraint_System (&ph, cs); - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&pph, ph); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (sctr_ub, pph); - - ppl_delete_Linear_Expression (le); - ppl_delete_Linear_Expression (eq); - ppl_delete_Polyhedron (ph); - ppl_delete_Pointset_Powerset_C_Polyhedron (pph); - ppl_delete_Constraint (pc); - ppl_delete_Constraint_System (cs); - } - - /* Compute the lower bound on the original iteration domain and add - it to the scattering. */ - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&sctr_lb, PBB_TRANSFORMED_SCATTERING (pbb)); - for (i = 0; i < (int) dim_iter_domain; i++) - { - ppl_Linear_Expression_t eq; - ppl_Constraint_t pc; - ppl_Constraint_System_t cs; - ppl_Polyhedron_t ph; - ppl_Pointset_Powerset_C_Polyhedron_t pph; - - ppl_new_Linear_Expression_with_dimension (&le, domain_dim); - ppl_set_coef (le, i, 1); - ppl_min_for_le_pointset (domain, le, lb); - - ppl_new_Linear_Expression_with_dimension (&eq, sctr_dim); - ppl_set_coef (eq, psct_iterator_dim (pbb, i), -1); - ppl_set_inhomogeneous_gmp (eq, lb); - - ppl_new_Constraint (&pc, eq, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_new_Constraint_System_from_Constraint (&cs, pc); - ppl_new_C_Polyhedron_from_Constraint_System (&ph, cs); - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&pph, ph); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (sctr_lb, pph); - - ppl_delete_Linear_Expression (le); - ppl_delete_Linear_Expression (eq); - ppl_delete_Polyhedron (ph); - ppl_delete_Pointset_Powerset_C_Polyhedron (pph); - ppl_delete_Constraint (pc); - ppl_delete_Constraint_System (cs); - } - - /* Extract the number of iterations. */ - ppl_new_Linear_Expression_with_dimension (&le, sctr_dim); - ppl_set_coef (le, time_depth, 1); - ppl_min_for_le_pointset (sctr_lb, le, lb); - ppl_max_for_le_pointset (sctr_ub, le, ub); - mpz_sub (res, ub, lb); - - mpz_clear (one); - mpz_clear (diff); - mpz_clear (lb); - mpz_clear (ub); - ppl_delete_Linear_Expression (le); - ppl_delete_Pointset_Powerset_C_Polyhedron (sctr_ub); - ppl_delete_Pointset_Powerset_C_Polyhedron (sctr_lb); - ppl_delete_Pointset_Powerset_C_Polyhedron (domain); + isl_int_clear (isllb); + isl_int_clear (islub); + isl_aff_free (aff); + isl_set_free (transdomain); } /* Translates LOOP to LST. */ @@ -1927,5 +1246,45 @@ cloog_checksum (scop_p scop ATTRIBUTE_UNUSED) #endif } +/* Reverse the loop around PBB at level DEPTH. */ + +isl_map * +reverse_loop_at_level (poly_bb_p pbb, int depth) +{ + unsigned i, depth_dim = psct_dynamic_dim (pbb, depth); + isl_space *d = isl_map_get_space (pbb->transformed); + isl_space *d1 = isl_space_range (d); + unsigned n = isl_space_dim (d1, isl_dim_out); + isl_space *d2 = isl_space_add_dims (d1, isl_dim_in, n); + isl_map *x = isl_map_universe (isl_space_copy (d2)); + isl_constraint *c = isl_equality_alloc (isl_local_space_from_space (d2)); + + for (i = 0; i < n; i++) + if (i != depth_dim) + x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i); + + c = isl_constraint_set_coefficient_si (c, isl_dim_in, depth_dim, 1); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, depth_dim, 1); + x = isl_map_add_constraint (x, c); + return x; +} + +/* Reverse the loop at level DEPTH for all the PBBS. */ + +isl_union_map * +reverse_loop_for_pbbs (scop_p scop, VEC (poly_bb_p, heap) *pbbs, int depth) +{ + poly_bb_p pbb; + int i; + isl_space *space = isl_space_from_domain (isl_set_get_space (scop->context)); + isl_union_map *res = isl_union_map_empty (space); + + for (i = 0; VEC_iterate (poly_bb_p, pbbs, i, pbb); i++) + res = isl_union_map_add_map (res, reverse_loop_at_level (pbb, depth)); + + return res; +} + + #endif diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 417e99eef25..0b95662932d 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -1,5 +1,5 @@ /* Graphite polyhedral representation. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop and Tobias Grosser . @@ -34,7 +34,7 @@ typedef struct scop *scop_p; DEF_VEC_P(scop_p); DEF_VEC_ALLOC_P (scop_p, heap); -typedef ppl_dimension_type graphite_dim_t; +typedef unsigned graphite_dim_t; static inline graphite_dim_t pbb_dim_iter_domain (const struct poly_bb *); static inline graphite_dim_t pbb_nb_params (const struct poly_bb *); @@ -180,7 +180,8 @@ struct poly_dr - P: Number of parameters. In the example, the vector "R C O I L P" is "7 7 3 2 0 1". */ - ppl_Pointset_Powerset_C_Polyhedron_t accesses; + isl_map *accesses; + isl_set *extent; /* Data reference's base object set number, we must assure 2 pdrs are in the same base object set before dependency checking. */ @@ -195,31 +196,20 @@ struct poly_dr #define PDR_CDR(PDR) (PDR->compiler_dr) #define PDR_PBB(PDR) (PDR->pbb) #define PDR_TYPE(PDR) (PDR->type) -#define PDR_ACCESSES(PDR) (PDR->accesses) +#define PDR_ACCESSES(PDR) (NULL) #define PDR_BASE_OBJECT_SET(PDR) (PDR->dr_base_object_set) #define PDR_NB_SUBSCRIPTS(PDR) (PDR->nb_subscripts) -void new_poly_dr (poly_bb_p, int, ppl_Pointset_Powerset_C_Polyhedron_t, - enum poly_dr_type, void *, graphite_dim_t); +void new_poly_dr (poly_bb_p, int, enum poly_dr_type, void *, + graphite_dim_t, isl_map *, isl_set *); void free_poly_dr (poly_dr_p); void debug_pdr (poly_dr_p, int); void print_pdr (FILE *, poly_dr_p, int); static inline scop_p pdr_scop (poly_dr_p pdr); -/* The dimension of the PDR_ACCESSES polyhedron of PDR. */ - -static inline ppl_dimension_type -pdr_dim (poly_dr_p pdr) -{ - ppl_dimension_type dim; - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PDR_ACCESSES (pdr), - &dim); - return dim; -} - /* The dimension of the iteration domain of the scop of PDR. */ -static inline ppl_dimension_type +static inline graphite_dim_t pdr_dim_iter_domain (poly_dr_p pdr) { return pbb_dim_iter_domain (PDR_PBB (pdr)); @@ -227,7 +217,7 @@ pdr_dim_iter_domain (poly_dr_p pdr) /* The number of parameters of the scop of PDR. */ -static inline ppl_dimension_type +static inline graphite_dim_t pdr_nb_params (poly_dr_p pdr) { return scop_nb_params (pdr_scop (pdr)); @@ -235,7 +225,7 @@ pdr_nb_params (poly_dr_p pdr) /* The dimension of the alias set in PDR. */ -static inline ppl_dimension_type +static inline graphite_dim_t pdr_alias_set_dim (poly_dr_p pdr) { poly_bb_p pbb = PDR_PBB (pdr); @@ -245,7 +235,7 @@ pdr_alias_set_dim (poly_dr_p pdr) /* The dimension in PDR containing subscript S. */ -static inline ppl_dimension_type +static inline graphite_dim_t pdr_subscript_dim (poly_dr_p pdr, graphite_dim_t s) { poly_bb_p pbb = PDR_PBB (pdr); @@ -255,7 +245,7 @@ pdr_subscript_dim (poly_dr_p pdr, graphite_dim_t s) /* The dimension in PDR containing the loop iterator ITER. */ -static inline ppl_dimension_type +static inline graphite_dim_t pdr_iterator_dim (poly_dr_p pdr ATTRIBUTE_UNUSED, graphite_dim_t iter) { return iter; @@ -263,7 +253,7 @@ pdr_iterator_dim (poly_dr_p pdr ATTRIBUTE_UNUSED, graphite_dim_t iter) /* The dimension in PDR containing parameter PARAM. */ -static inline ppl_dimension_type +static inline graphite_dim_t pdr_parameter_dim (poly_dr_p pdr, graphite_dim_t param) { poly_bb_p pbb = PDR_PBB (pdr); @@ -309,11 +299,6 @@ typedef struct poly_scattering *poly_scattering_p; struct poly_scattering { - /* The scattering function containing the transformations: the - layout of this polyhedron is: T|I|G with T the transform - scattering, I the iteration domain, G the context parameters. */ - ppl_Polyhedron_t scattering; - /* The number of local variables. */ int nb_local_variables; @@ -353,22 +338,22 @@ struct poly_bb The number of variables in the DOMAIN may change and is not related to the number of loops in the original code. */ - ppl_Pointset_Powerset_C_Polyhedron_t domain; + isl_set *domain; /* The data references we access. */ VEC (poly_dr_p, heap) *drs; /* The original scattering. */ - poly_scattering_p original; + poly_scattering_p _original; + isl_map *schedule; /* The transformed scattering. */ - poly_scattering_p transformed; + poly_scattering_p _transformed; + isl_map *transformed; /* A copy of the transformed scattering. */ - poly_scattering_p saved; - - /* True when the PDR duplicates have already been removed. */ - bool pdr_duplicates_removed; + poly_scattering_p _saved; + isl_map *saved; /* True when this PBB contains only a reduction statement. */ bool is_reduction; @@ -376,16 +361,18 @@ struct poly_bb #define PBB_BLACK_BOX(PBB) ((gimple_bb_p) PBB->black_box) #define PBB_SCOP(PBB) (PBB->scop) -#define PBB_DOMAIN(PBB) (PBB->domain) +#define PBB_DOMAIN(PBB) (NULL) #define PBB_DRS(PBB) (PBB->drs) -#define PBB_ORIGINAL(PBB) (PBB->original) -#define PBB_ORIGINAL_SCATTERING(PBB) (PBB->original->scattering) -#define PBB_TRANSFORMED(PBB) (PBB->transformed) -#define PBB_TRANSFORMED_SCATTERING(PBB) (PBB->transformed->scattering) -#define PBB_SAVED(PBB) (PBB->saved) -#define PBB_NB_LOCAL_VARIABLES(PBB) (PBB->transformed->nb_local_variables) -#define PBB_NB_SCATTERING_TRANSFORM(PBB) (PBB->transformed->nb_scattering) -#define PBB_PDR_DUPLICATES_REMOVED(PBB) (PBB->pdr_duplicates_removed) +#define PBB_ORIGINAL(PBB) (PBB->_original) +#define PBB_ORIGINAL_SCATTERING(PBB) (NULL) +#define PBB_TRANSFORMED(PBB) (PBB->_transformed) +#define PBB_TRANSFORMED_SCATTERING(PBB) (NULL) +#define PBB_SAVED(PBB) (PBB->_saved) +/* XXX isl if we ever need local vars in the scatter, we can't use the + out dimension of transformed to count the scatterting transform dimension. + */ +#define PBB_NB_LOCAL_VARIABLES(PBB) (0) +#define PBB_NB_SCATTERING_TRANSFORM(PBB) (isl_map_n_out (PBB->transformed)) #define PBB_IS_REDUCTION(PBB) (PBB->is_reduction) extern poly_bb_p new_poly_bb (scop_p, void *); @@ -410,12 +397,20 @@ extern void print_iteration_domain (FILE *, poly_bb_p, int); extern void print_iteration_domains (FILE *, scop_p, int); extern void debug_iteration_domain (poly_bb_p, int); extern void debug_iteration_domains (scop_p, int); +extern void print_isl_set (FILE *, isl_set *); +extern void print_isl_map (FILE *, isl_map *); +extern void print_isl_aff (FILE *, isl_aff *); +extern void print_isl_constraint (FILE *, isl_constraint *); +extern void debug_isl_set (isl_set *); +extern void debug_isl_map (isl_map *); +extern void debug_isl_aff (isl_aff *); +extern void debug_isl_constraint (isl_constraint *); extern int scop_do_interchange (scop_p); extern int scop_do_strip_mine (scop_p, int); extern bool scop_do_block (scop_p); extern bool flatten_all_loops (scop_p); extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t); -extern void pbb_remove_duplicate_pdrs (poly_bb_p); +extern void debug_gmp_value (mpz_t); /* Return the number of write data references in PBB. */ @@ -495,11 +490,7 @@ pbb_set_black_box (poly_bb_p pbb, void *black_box) static inline graphite_dim_t pbb_dim_iter_domain (const struct poly_bb *pbb) { - scop_p scop = PBB_SCOP (pbb); - ppl_dimension_type dim; - - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim); - return dim - scop_nb_params (scop); + return isl_set_dim (pbb->domain, isl_dim_set); } /* The number of params defined in PBB. */ @@ -544,7 +535,7 @@ pbb_nb_dynamic_scattering_transform (const struct poly_bb *pbb) scattering polyhedron of PBB. */ static inline graphite_dim_t -pbb_nb_local_vars (const struct poly_bb *pbb) +pbb_nb_local_vars (const struct poly_bb *pbb ATTRIBUTE_UNUSED) { /* For now we do not have any local variables, as we do not do strip mining for example. */ @@ -553,7 +544,7 @@ pbb_nb_local_vars (const struct poly_bb *pbb) /* The dimension in the domain of PBB containing the iterator ITER. */ -static inline ppl_dimension_type +static inline graphite_dim_t pbb_iterator_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t iter) { return iter; @@ -561,7 +552,7 @@ pbb_iterator_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t iter) /* The dimension in the domain of PBB containing the iterator ITER. */ -static inline ppl_dimension_type +static inline graphite_dim_t pbb_parameter_dim (poly_bb_p pbb, graphite_dim_t param) { return param @@ -571,7 +562,7 @@ pbb_parameter_dim (poly_bb_p pbb, graphite_dim_t param) /* The dimension in the original scattering polyhedron of PBB containing the scattering iterator SCATTER. */ -static inline ppl_dimension_type +static inline graphite_dim_t psco_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter) { gcc_assert (scatter < pbb_nb_scattering_orig (pbb)); @@ -581,20 +572,17 @@ psco_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter) /* The dimension in the transformed scattering polyhedron of PBB containing the scattering iterator SCATTER. */ -static inline ppl_dimension_type +static inline graphite_dim_t psct_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter) { gcc_assert (scatter <= pbb_nb_scattering_transform (pbb)); return scatter; } -ppl_dimension_type psct_scattering_dim_for_loop_depth (poly_bb_p, - graphite_dim_t); - /* The dimension in the transformed scattering polyhedron of PBB of the local variable LV. */ -static inline ppl_dimension_type +static inline graphite_dim_t psct_local_var_dim (poly_bb_p pbb, graphite_dim_t lv) { gcc_assert (lv <= pbb_nb_local_vars (pbb)); @@ -604,7 +592,7 @@ psct_local_var_dim (poly_bb_p pbb, graphite_dim_t lv) /* The dimension in the original scattering polyhedron of PBB containing the loop iterator ITER. */ -static inline ppl_dimension_type +static inline graphite_dim_t psco_iterator_dim (poly_bb_p pbb, graphite_dim_t iter) { gcc_assert (iter < pbb_dim_iter_domain (pbb)); @@ -614,7 +602,7 @@ psco_iterator_dim (poly_bb_p pbb, graphite_dim_t iter) /* The dimension in the transformed scattering polyhedron of PBB containing the loop iterator ITER. */ -static inline ppl_dimension_type +static inline graphite_dim_t psct_iterator_dim (poly_bb_p pbb, graphite_dim_t iter) { gcc_assert (iter < pbb_dim_iter_domain (pbb)); @@ -626,7 +614,7 @@ psct_iterator_dim (poly_bb_p pbb, graphite_dim_t iter) /* The dimension in the original scattering polyhedron of PBB containing parameter PARAM. */ -static inline ppl_dimension_type +static inline graphite_dim_t psco_parameter_dim (poly_bb_p pbb, graphite_dim_t param) { gcc_assert (param < pbb_nb_params (pbb)); @@ -638,7 +626,7 @@ psco_parameter_dim (poly_bb_p pbb, graphite_dim_t param) /* The dimension in the transformed scattering polyhedron of PBB containing parameter PARAM. */ -static inline ppl_dimension_type +static inline graphite_dim_t psct_parameter_dim (poly_bb_p pbb, graphite_dim_t param) { gcc_assert (param < pbb_nb_params (pbb)); @@ -651,7 +639,7 @@ psct_parameter_dim (poly_bb_p pbb, graphite_dim_t param) /* The scattering dimension of PBB corresponding to the dynamic level LEVEL. */ -static inline ppl_dimension_type +static inline graphite_dim_t psct_dynamic_dim (poly_bb_p pbb, graphite_dim_t level) { graphite_dim_t result = 1 + 2 * level; @@ -663,7 +651,7 @@ psct_dynamic_dim (poly_bb_p pbb, graphite_dim_t level) /* The scattering dimension of PBB corresponding to the static sequence of the loop level LEVEL. */ -static inline ppl_dimension_type +static inline graphite_dim_t psct_static_dim (poly_bb_p pbb, graphite_dim_t level) { graphite_dim_t result = 2 * level; @@ -676,25 +664,10 @@ psct_static_dim (poly_bb_p pbb, graphite_dim_t level) variable and returns its index. */ static inline graphite_dim_t -psct_add_local_variable (poly_bb_p pbb) +psct_add_local_variable (poly_bb_p pbb ATTRIBUTE_UNUSED) { - graphite_dim_t nlv = pbb_nb_local_vars (pbb); - ppl_dimension_type lv_column = psct_local_var_dim (pbb, nlv); - ppl_insert_dimensions (PBB_TRANSFORMED_SCATTERING (pbb), lv_column, 1); - PBB_NB_LOCAL_VARIABLES (pbb) += 1; - return nlv; -} - -/* Adds a dimension to the transformed scattering polyhedron of PBB at - INDEX. */ - -static inline void -psct_add_scattering_dimension (poly_bb_p pbb, ppl_dimension_type index) -{ - gcc_assert (index < pbb_nb_scattering_transform (pbb)); - - ppl_insert_dimensions (PBB_TRANSFORMED_SCATTERING (pbb), index, 1); - PBB_NB_SCATTERING_TRANSFORM (pbb) += 1; + gcc_unreachable (); + return 0; } typedef struct lst *lst_p; @@ -1116,25 +1089,20 @@ lst_niter_for_loop (lst_p lst, mpz_t niter) static inline void pbb_update_scattering (poly_bb_p pbb, graphite_dim_t level, int dewey) { - ppl_Polyhedron_t ph = PBB_TRANSFORMED_SCATTERING (pbb); - ppl_dimension_type sched = psct_static_dim (pbb, level); - ppl_dimension_type ds[1]; - ppl_Constraint_t new_cstr; - ppl_Linear_Expression_t expr; - ppl_dimension_type dim; + graphite_dim_t sched = psct_static_dim (pbb, level); + isl_space *d = isl_map_get_space (pbb->transformed); + isl_space *d1 = isl_space_range (d); + unsigned i, n = isl_space_dim (d1, isl_dim_out); + isl_space *d2 = isl_space_add_dims (d1, isl_dim_in, n); + isl_map *x = isl_map_universe (d2); - ppl_Polyhedron_space_dimension (ph, &dim); - ds[0] = sched; - ppl_Polyhedron_remove_space_dimensions (ph, ds, 1); - ppl_insert_dimensions (ph, sched, 1); + x = isl_map_fix_si (x, isl_dim_out, sched, dewey); - ppl_new_Linear_Expression_with_dimension (&expr, dim); - ppl_set_coef (expr, sched, -1); - ppl_set_inhomogeneous (expr, dewey); - ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_delete_Linear_Expression (expr); - ppl_Polyhedron_add_constraint (ph, new_cstr); - ppl_delete_Constraint (new_cstr); + for (i = 0; i < n; i++) + if (i != sched) + x = isl_map_equate (x, isl_dim_in, i, isl_dim_out, i); + + pbb->transformed = isl_map_apply_range (pbb->transformed, x); } /* Updates the scattering of all the PBBs under LST to be at the DEWEY @@ -1401,7 +1369,18 @@ struct scop -128 >= a >= 127 0 >= b >= 65,535 c = 2a + b */ - ppl_Pointset_Powerset_C_Polyhedron_t context; + isl_set *context; + + /* The context used internally by ISL. */ + isl_ctx *ctx; + + /* The original dependence relations: + RAW are read after write dependences, + WAR are write after read dependences, + WAW are write after write dependences. */ + isl_union_map *must_raw, *may_raw, *must_raw_no_source, *may_raw_no_source, + *must_war, *may_war, *must_war_no_source, *may_war_no_source, + *must_waw, *may_waw, *must_waw_no_source, *may_waw_no_source; /* A hashtable of the data dependence relations for the original scattering. */ @@ -1414,7 +1393,7 @@ struct scop #define SCOP_BBS(S) (S->bbs) #define SCOP_REGION(S) ((sese) S->region) -#define SCOP_CONTEXT(S) (S->context) +#define SCOP_CONTEXT(S) (NULL) #define SCOP_ORIGINAL_PDDRS(S) (S->original_pddrs) #define SCOP_ORIGINAL_SCHEDULE(S) (S->original_schedule) #define SCOP_TRANSFORMED_SCHEDULE(S) (S->transformed_schedule) @@ -1467,7 +1446,6 @@ poly_scattering_new (void) { poly_scattering_p res = XNEW (struct poly_scattering); - res->scattering = NULL; res->nb_local_variables = 0; res->nb_scattering = 0; return res; @@ -1478,7 +1456,6 @@ poly_scattering_new (void) static inline void poly_scattering_free (poly_scattering_p s) { - ppl_delete_Polyhedron (s->scattering); free (s); } @@ -1489,7 +1466,6 @@ poly_scattering_copy (poly_scattering_p s) { poly_scattering_p res = poly_scattering_new (); - ppl_new_C_Polyhedron_from_C_Polyhedron (&(res->scattering), s->scattering); res->nb_local_variables = s->nb_local_variables; res->nb_scattering = s->nb_scattering; return res; @@ -1500,12 +1476,8 @@ poly_scattering_copy (poly_scattering_p s) static inline void store_scattering_pbb (poly_bb_p pbb) { - gcc_assert (PBB_TRANSFORMED (pbb)); - - if (PBB_SAVED (pbb)) - poly_scattering_free (PBB_SAVED (pbb)); - - PBB_SAVED (pbb) = poly_scattering_copy (PBB_TRANSFORMED (pbb)); + isl_map_free (pbb->saved); + pbb->saved = isl_map_copy (pbb->transformed); } /* Stores the SCOP_TRANSFORMED_SCHEDULE to SCOP_SAVED_SCHEDULE. */ @@ -1549,10 +1521,10 @@ store_scattering (scop_p scop) static inline void restore_scattering_pbb (poly_bb_p pbb) { - gcc_assert (PBB_SAVED (pbb)); + gcc_assert (pbb->saved); - poly_scattering_free (PBB_TRANSFORMED (pbb)); - PBB_TRANSFORMED (pbb) = poly_scattering_copy (PBB_SAVED (pbb)); + isl_map_free (pbb->transformed); + pbb->transformed = isl_map_copy (pbb->saved); } /* Restores the scattering for all the pbbs in the SCOP. */ @@ -1569,49 +1541,12 @@ restore_scattering (scop_p scop) restore_lst_schedule (scop); } -/* For a given PBB, add to RES the scop context, the iteration domain, - the original scattering when ORIGINAL_P is true, otherwise add the - transformed scattering. */ - -static inline void -combine_context_id_scat (ppl_Pointset_Powerset_C_Polyhedron_t *res, - poly_bb_p pbb, bool original_p) -{ - ppl_Pointset_Powerset_C_Polyhedron_t context; - ppl_Pointset_Powerset_C_Polyhedron_t id; - - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (res, original_p ? - PBB_ORIGINAL_SCATTERING (pbb) : PBB_TRANSFORMED_SCATTERING (pbb)); - - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&context, SCOP_CONTEXT (PBB_SCOP (pbb))); - - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&id, PBB_DOMAIN (pbb)); - - /* Extend the context and the iteration domain to the dimension of - the scattering: T|I|G. */ - { - ppl_dimension_type gdim, tdim, idim; - - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (*res, &tdim); - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (context, &gdim); - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (id, &idim); - - if (tdim > gdim) - ppl_insert_dimensions_pointset (context, 0, tdim - gdim); - - if (tdim > idim) - ppl_insert_dimensions_pointset (id, 0, tdim - idim); - } - - /* Add the context and the iteration domain to the result. */ - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*res, context); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*res, id); - - ppl_delete_Pointset_Powerset_C_Polyhedron (context); - ppl_delete_Pointset_Powerset_C_Polyhedron (id); -} +bool graphite_legal_transform (scop_p); +poly_bb_p find_pbb_via_hash (htab_t, basic_block); +bool loop_is_parallel_p (loop_p, htab_t, int); +scop_p get_loop_body_pbbs (loop_p, htab_t, VEC (poly_bb_p, heap) **); +isl_map *reverse_loop_at_level (poly_bb_p, int); +isl_union_map *reverse_loop_for_pbbs (scop_p, VEC (poly_bb_p, heap) *, int); +__isl_give isl_union_map *extend_schedule (__isl_take isl_union_map *); #endif diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c deleted file mode 100644 index 9762ca46770..00000000000 --- a/gcc/graphite-ppl.c +++ /dev/null @@ -1,566 +0,0 @@ -/* Gimple Represented as Polyhedra. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. - Contributed by Sebastian Pop - and Tobias Grosser - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ - -#include "config.h" -#include "system.h" -#include "coretypes.h" - -#ifdef HAVE_cloog - -#include "ppl_c.h" -#include "graphite-cloog-util.h" -#include "graphite-ppl.h" - -/* Set the inhomogeneous term of E to X. */ - -void -ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t e, mpz_t x) -{ - mpz_t v0, v1; - ppl_Coefficient_t c; - - mpz_init (v0); - mpz_init (v1); - ppl_new_Coefficient (&c); - - ppl_Linear_Expression_inhomogeneous_term (e, c); - ppl_Coefficient_to_mpz_t (c, v1); - mpz_neg (v1, v1); - mpz_set (v0, x); - mpz_add (v0, v0, v1); - ppl_assign_Coefficient_from_mpz_t (c, v0); - ppl_Linear_Expression_add_to_inhomogeneous (e, c); - - mpz_clear (v0); - mpz_clear (v1); - ppl_delete_Coefficient (c); -} - -/* Set E[I] to X. */ - -void -ppl_set_coef_gmp (ppl_Linear_Expression_t e, ppl_dimension_type i, mpz_t x) -{ - mpz_t v0, v1; - ppl_Coefficient_t c; - - mpz_init (v0); - mpz_init (v1); - ppl_new_Coefficient (&c); - - ppl_Linear_Expression_coefficient (e, i, c); - ppl_Coefficient_to_mpz_t (c, v1); - mpz_neg (v1, v1); - mpz_set (v0, x); - mpz_add (v0, v0, v1); - ppl_assign_Coefficient_from_mpz_t (c, v0); - ppl_Linear_Expression_add_to_coefficient (e, i, c); - - mpz_clear (v0); - mpz_clear (v1); - ppl_delete_Coefficient (c); -} - -/* Insert after X NB_NEW_DIMS empty dimensions into PH. - - With x = 3 and nb_new_dims = 4 - - | d0 d1 d2 d3 d4 - - is transformed to - - | d0 d1 d2 x0 x1 x2 x3 d3 d4 - - | map = {0, 1, 2, 7, 8, 3, 4, 5, 6} -*/ - -void -ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ph, int x, - int nb_new_dims) -{ - ppl_dimension_type i, dim; - ppl_dimension_type *map; - ppl_dimension_type x_ppl, nb_new_dims_ppl; - - x_ppl = (ppl_dimension_type) x; - nb_new_dims_ppl = (ppl_dimension_type) nb_new_dims; - - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (ph, &dim); - ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed (ph, nb_new_dims); - - map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim + nb_new_dims); - - for (i = 0; i < x_ppl; i++) - map[i] = i; - - for (i = x_ppl; i < x_ppl + nb_new_dims_ppl; i++) - map[dim + i - x_ppl] = i; - - for (i = x_ppl + nb_new_dims_ppl; i < dim + nb_new_dims_ppl; i++) - map[i - nb_new_dims_ppl] = i; - - ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (ph, map, dim + nb_new_dims); - free (map); -} - -/* Insert after X NB_NEW_DIMS empty dimensions into PH. - - With x = 3 and nb_new_dims = 4 - - | d0 d1 d2 d3 d4 - - is transformed to - - | d0 d1 d2 x0 x1 x2 x3 d3 d4 - - | map = {0, 1, 2, 7, 8, 3, 4, 5, 6} -*/ - -void -ppl_insert_dimensions (ppl_Polyhedron_t ph, int x, - int nb_new_dims) -{ - ppl_dimension_type i, dim; - ppl_dimension_type *map; - ppl_dimension_type x_ppl, nb_new_dims_ppl; - - x_ppl = (ppl_dimension_type) x; - nb_new_dims_ppl = (ppl_dimension_type) nb_new_dims; - - ppl_Polyhedron_space_dimension (ph, &dim); - ppl_Polyhedron_add_space_dimensions_and_embed (ph, nb_new_dims); - - map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim + nb_new_dims); - - for (i = 0; i < x_ppl; i++) - map[i] = i; - - for (i = x_ppl; i < x_ppl + nb_new_dims_ppl; i++) - map[dim + i - x_ppl] = i; - - for (i = x_ppl + nb_new_dims_ppl; i < dim + nb_new_dims_ppl; i++) - map[i - nb_new_dims_ppl] = i; - - ppl_Polyhedron_map_space_dimensions (ph, map, dim + nb_new_dims); - free (map); -} - -/* Based on the original polyhedron PH, returns a new polyhedron with - an extra dimension placed at position LOOP + 1 that slices the - dimension LOOP into strips of size STRIDE. */ - -ppl_Polyhedron_t -ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride) -{ - ppl_const_Constraint_System_t pcs; - ppl_Constraint_System_const_iterator_t cit, end; - ppl_const_Constraint_t cstr; - ppl_Linear_Expression_t expr; - int v; - ppl_dimension_type dim; - ppl_Polyhedron_t res; - ppl_Coefficient_t c; - mpz_t val; - - mpz_init (val); - ppl_new_Coefficient (&c); - - ppl_Polyhedron_space_dimension (ph, &dim); - ppl_Polyhedron_get_constraints (ph, &pcs); - - /* Start from a copy of the constraints. */ - ppl_new_C_Polyhedron_from_space_dimension (&res, dim + 1, 0); - ppl_Polyhedron_add_constraints (res, pcs); - - /* Add an empty dimension for the strip loop. */ - ppl_insert_dimensions (res, loop, 1); - - /* Identify the constraints that define the lower and upper bounds - of the strip-mined loop, and add them to the strip loop. */ - { - ppl_Polyhedron_t tmp; - - ppl_new_C_Polyhedron_from_space_dimension (&tmp, dim + 1, 0); - ppl_new_Constraint_System_const_iterator (&cit); - ppl_new_Constraint_System_const_iterator (&end); - - for (ppl_Constraint_System_begin (pcs, cit), - ppl_Constraint_System_end (pcs, end); - !ppl_Constraint_System_const_iterator_equal_test (cit, end); - ppl_Constraint_System_const_iterator_increment (cit)) - { - ppl_Constraint_System_const_iterator_dereference (cit, &cstr); - ppl_new_Linear_Expression_from_Constraint (&expr, cstr); - ppl_Linear_Expression_coefficient (expr, loop, c); - ppl_delete_Linear_Expression (expr); - ppl_Coefficient_to_mpz_t (c, val); - v = mpz_get_si (val); - - if (0 < v || v < 0) - ppl_Polyhedron_add_constraint (tmp, cstr); - } - ppl_delete_Constraint_System_const_iterator (cit); - ppl_delete_Constraint_System_const_iterator (end); - - ppl_insert_dimensions (tmp, loop + 1, 1); - ppl_Polyhedron_get_constraints (tmp, &pcs); - ppl_Polyhedron_add_constraints (res, pcs); - ppl_delete_Polyhedron (tmp); - } - - /* Lower bound of a tile starts at "stride * outer_iv". */ - { - ppl_Constraint_t new_cstr; - ppl_new_Linear_Expression_with_dimension (&expr, dim + 1); - - ppl_set_coef (expr, loop + 1, 1); - ppl_set_coef (expr, loop, -1 * stride); - - ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_delete_Linear_Expression (expr); - ppl_Polyhedron_add_constraint (res, new_cstr); - ppl_delete_Constraint (new_cstr); - } - - /* Upper bound of a tile stops at "stride * outer_iv + stride - 1", - or at the old upper bound that is not modified. */ - { - ppl_Constraint_t new_cstr; - ppl_new_Linear_Expression_with_dimension (&expr, dim + 1); - - ppl_set_coef (expr, loop + 1, -1); - ppl_set_coef (expr, loop, stride); - ppl_set_inhomogeneous (expr, stride - 1); - - ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_delete_Linear_Expression (expr); - ppl_Polyhedron_add_constraint (res, new_cstr); - ppl_delete_Constraint (new_cstr); - } - - mpz_clear (val); - ppl_delete_Coefficient (c); - return res; -} - -/* Lexicographically compares two linear expressions A and B and - returns negative when A < B, 0 when A == B and positive when A > B. */ - -int -ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a, - ppl_Linear_Expression_t b) -{ - ppl_dimension_type min_length, length1, length2; - ppl_dimension_type i; - ppl_Coefficient_t c; - int res; - mpz_t va, vb; - - ppl_Linear_Expression_space_dimension (a, &length1); - ppl_Linear_Expression_space_dimension (b, &length2); - ppl_new_Coefficient (&c); - mpz_init (va); - mpz_init (vb); - - if (length1 < length2) - min_length = length1; - else - min_length = length2; - - for (i = 0; i < min_length; i++) - { - ppl_Linear_Expression_coefficient (a, i, c); - ppl_Coefficient_to_mpz_t (c, va); - ppl_Linear_Expression_coefficient (b, i, c); - ppl_Coefficient_to_mpz_t (c, vb); - res = mpz_cmp (va, vb); - - if (res == 0) - continue; - - mpz_clear (va); - mpz_clear (vb); - ppl_delete_Coefficient (c); - return res; - } - - mpz_clear (va); - mpz_clear (vb); - ppl_delete_Coefficient (c); - return length1 - length2; -} - -/* Print to FILE the polyhedron PH under its PolyLib matrix form. */ - -void -ppl_print_polyhedron_matrix (FILE *file, ppl_const_Polyhedron_t ph) -{ - CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); - cloog_matrix_print (file, mat); - cloog_matrix_free (mat); -} - -/* Print to FILE the linear expression LE. */ - -void -ppl_print_linear_expr (FILE *file, ppl_Linear_Expression_t le) -{ - ppl_Constraint_t c; - ppl_Polyhedron_t pol; - ppl_dimension_type dim; - - ppl_Linear_Expression_space_dimension (le, &dim); - ppl_new_C_Polyhedron_from_space_dimension (&pol, dim, 0); - ppl_new_Constraint (&c, le, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (pol, c); - ppl_print_polyhedron_matrix (file, pol); -} - -/* Print to STDERR the linear expression LE. */ - -DEBUG_FUNCTION void -debug_ppl_linear_expr (ppl_Linear_Expression_t le) -{ - ppl_print_linear_expr (stderr, le); -} - -/* Print to FILE the powerset PS in its PolyLib matrix form. */ - -void -ppl_print_powerset_matrix (FILE *file, - ppl_Pointset_Powerset_C_Polyhedron_t ps) -{ - size_t nb_disjuncts; - ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; - - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it); - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end); - - ppl_Pointset_Powerset_C_Polyhedron_size (ps, &nb_disjuncts); - fprintf (file, "%d\n", (int) nb_disjuncts); - - for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it), - ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end); - !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end); - ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it)) - { - ppl_const_Polyhedron_t ph; - - ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph); - ppl_print_polyhedron_matrix (file, ph); - } - - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it); - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end); -} - -/* Print to STDERR the polyhedron PH under its PolyLib matrix form. */ - -DEBUG_FUNCTION void -debug_ppl_polyhedron_matrix (ppl_Polyhedron_t ph) -{ - ppl_print_polyhedron_matrix (stderr, ph); -} - -/* Print to STDERR the powerset PS in its PolyLib matrix form. */ - -DEBUG_FUNCTION void -debug_ppl_powerset_matrix (ppl_Pointset_Powerset_C_Polyhedron_t ps) -{ - ppl_print_powerset_matrix (stderr, ps); -} - -/* Read from FILE a polyhedron under PolyLib matrix form and return a - PPL polyhedron object. */ - -void -ppl_read_polyhedron_matrix (ppl_Polyhedron_t *ph, FILE *file) -{ - CloogMatrix *mat = cloog_matrix_read (file); - new_C_Polyhedron_from_Cloog_Matrix (ph, mat); - cloog_matrix_free (mat); -} - -/* Return in RES the maximum of the linear expression LE on the - pointset powerset of polyhedra PS. */ - -void -ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps, - ppl_Linear_Expression_t le, mpz_t res) -{ - ppl_Coefficient_t num, denom; - mpz_t dv, nv; - int maximum, err; - - mpz_init (nv); - mpz_init (dv); - ppl_new_Coefficient (&num); - ppl_new_Coefficient (&denom); - err = ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum); - - if (err > 0) - { - ppl_Coefficient_to_mpz_t (num, nv); - ppl_Coefficient_to_mpz_t (denom, dv); - gcc_assert (mpz_sgn (dv) != 0); - mpz_tdiv_q (res, nv, dv); - } - - mpz_clear (nv); - mpz_clear (dv); - ppl_delete_Coefficient (num); - ppl_delete_Coefficient (denom); -} - -/* Return in RES the maximum of the linear expression LE on the - polyhedron POL. */ - -void -ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ps, - ppl_Linear_Expression_t le, mpz_t res) -{ - ppl_Coefficient_t num, denom; - mpz_t dv, nv; - int minimum, err; - - mpz_init (nv); - mpz_init (dv); - ppl_new_Coefficient (&num); - ppl_new_Coefficient (&denom); - err = ppl_Pointset_Powerset_C_Polyhedron_minimize (ps, le, num, denom, &minimum); - - if (err > 0) - { - ppl_Coefficient_to_mpz_t (num, nv); - ppl_Coefficient_to_mpz_t (denom, dv); - gcc_assert (mpz_sgn (dv) != 0); - mpz_tdiv_q (res, nv, dv); - } - - mpz_clear (nv); - mpz_clear (dv); - ppl_delete_Coefficient (num); - ppl_delete_Coefficient (denom); -} - -/* Builds a constraint in dimension DIM relating dimensions POS1 to - POS2 as "POS1 - POS2 + C CSTR_TYPE 0" */ - -ppl_Constraint_t -ppl_build_relation (int dim, int pos1, int pos2, int c, - enum ppl_enum_Constraint_Type cstr_type) -{ - ppl_Linear_Expression_t expr; - ppl_Constraint_t cstr; - ppl_Coefficient_t coef; - mpz_t v, v_op, v_c; - - mpz_init (v); - mpz_init (v_op); - mpz_init (v_c); - - mpz_set_si (v, 1); - mpz_set_si (v_op, -1); - mpz_set_si (v_c, c); - - ppl_new_Coefficient (&coef); - ppl_new_Linear_Expression_with_dimension (&expr, dim); - - ppl_assign_Coefficient_from_mpz_t (coef, v); - ppl_Linear_Expression_add_to_coefficient (expr, pos1, coef); - ppl_assign_Coefficient_from_mpz_t (coef, v_op); - ppl_Linear_Expression_add_to_coefficient (expr, pos2, coef); - ppl_assign_Coefficient_from_mpz_t (coef, v_c); - ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); - - ppl_new_Constraint (&cstr, expr, cstr_type); - - ppl_delete_Linear_Expression (expr); - ppl_delete_Coefficient (coef); - mpz_clear (v); - mpz_clear (v_op); - mpz_clear (v_c); - - return cstr; -} - -/* Print to STDERR the GMP value VAL. */ - -DEBUG_FUNCTION void -debug_gmp_value (mpz_t val) -{ - char *str = mpz_get_str (0, 10, val); - void (*gmp_free) (void *, size_t); - - fprintf (stderr, "%s", str); - mp_get_memory_functions (NULL, NULL, &gmp_free); - (*gmp_free) (str, strlen (str) + 1); -} - -/* Checks for integer feasibility: returns true when the powerset - polyhedron PS has no integer solutions. */ - -bool -ppl_powerset_is_empty (ppl_Pointset_Powerset_C_Polyhedron_t ps) -{ - ppl_PIP_Problem_t pip; - ppl_dimension_type d; - ppl_const_Constraint_System_t pcs; - ppl_Constraint_System_const_iterator_t first, last; - ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; - bool has_integer_solutions = false; - - if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (ps)) - return true; - - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (ps, &d); - ppl_new_Constraint_System_const_iterator (&first); - ppl_new_Constraint_System_const_iterator (&last); - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it); - ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end); - - for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it), - ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end); - !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end); - ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it)) - { - ppl_const_Polyhedron_t ph; - ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph); - - ppl_Polyhedron_get_constraints (ph, &pcs); - ppl_Constraint_System_begin (pcs, first); - ppl_Constraint_System_end (pcs, last); - - ppl_new_PIP_Problem_from_constraints (&pip, d, first, last, 0, NULL); - has_integer_solutions |= ppl_PIP_Problem_is_satisfiable (pip); - - ppl_delete_PIP_Problem (pip); - } - - ppl_delete_Constraint_System_const_iterator (first); - ppl_delete_Constraint_System_const_iterator (last); - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it); - ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end); - - return !has_integer_solutions; -} - -#endif diff --git a/gcc/graphite-ppl.h b/gcc/graphite-ppl.h deleted file mode 100644 index 5820e19927d..00000000000 --- a/gcc/graphite-ppl.h +++ /dev/null @@ -1,176 +0,0 @@ -/* Gimple Represented as Polyhedra. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. - Contributed by Sebastian Pop - and Tobias Grosser . - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -. */ -#ifndef GCC_GRAPHITE_PPL_H -#define GCC_GRAPHITE_PPL_H - -#include "double-int.h" -#include "tree.h" - -ppl_Polyhedron_t ppl_strip_loop (ppl_Polyhedron_t, ppl_dimension_type, int); -int ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t, - ppl_Linear_Expression_t); - -void ppl_print_polyhedron_matrix (FILE *, ppl_const_Polyhedron_t); -void ppl_print_powerset_matrix (FILE *, ppl_Pointset_Powerset_C_Polyhedron_t); -void debug_ppl_polyhedron_matrix (ppl_Polyhedron_t); -void debug_ppl_powerset_matrix (ppl_Pointset_Powerset_C_Polyhedron_t); -void ppl_print_linear_expr (FILE *, ppl_Linear_Expression_t); -void debug_ppl_linear_expr (ppl_Linear_Expression_t); -void ppl_read_polyhedron_matrix (ppl_Polyhedron_t *, FILE *); -void ppl_insert_dimensions (ppl_Polyhedron_t, int, int); -void ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, int, - int); -void ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t, mpz_t); -void ppl_set_coef_gmp (ppl_Linear_Expression_t, ppl_dimension_type, mpz_t); -void ppl_max_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, - ppl_Linear_Expression_t, mpz_t); -void ppl_min_for_le_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, - ppl_Linear_Expression_t, mpz_t); -ppl_Constraint_t ppl_build_relation (int, int, int, int, - enum ppl_enum_Constraint_Type); -void debug_gmp_value (mpz_t); -bool ppl_powerset_is_empty (ppl_Pointset_Powerset_C_Polyhedron_t); - - -/* Assigns to RES the value of the INTEGER_CST T. */ - -static inline void -tree_int_to_gmp (tree t, mpz_t res) -{ - double_int di = tree_to_double_int (t); - mpz_set_double_int (res, di, TYPE_UNSIGNED (TREE_TYPE (t))); -} - -/* Converts a GMP constant VAL to a tree and returns it. */ - -static inline tree -gmp_cst_to_tree (tree type, mpz_t val) -{ - tree t = type ? type : integer_type_node; - mpz_t tmp; - double_int di; - - mpz_init (tmp); - mpz_set (tmp, val); - di = mpz_get_double_int (t, tmp, true); - mpz_clear (tmp); - - return double_int_to_tree (t, di); -} - -/* Set the inhomogeneous term of E to the integer X. */ - -static inline void -ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x) -{ - mpz_t v; - mpz_init (v); - mpz_set_si (v, x); - ppl_set_inhomogeneous_gmp (e, v); - mpz_clear (v); -} - -/* Set the inhomogeneous term of E to the tree X. */ - -static inline void -ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x) -{ - mpz_t v; - mpz_init (v); - tree_int_to_gmp (x, v); - ppl_set_inhomogeneous_gmp (e, v); - mpz_clear (v); -} - -/* Set E[I] to integer X. */ - -static inline void -ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x) -{ - mpz_t v; - mpz_init (v); - mpz_set_si (v, x); - ppl_set_coef_gmp (e, i, v); - mpz_clear (v); -} - -/* Set E[I] to tree X. */ - -static inline void -ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x) -{ - mpz_t v; - mpz_init (v); - tree_int_to_gmp (x, v); - ppl_set_coef_gmp (e, i, v); - mpz_clear (v); -} - -/* Sets RES to the min of V1 and V2. */ - -static inline void -value_min (mpz_t res, mpz_t v1, mpz_t v2) -{ - if (mpz_cmp (v1, v2) < 0) - mpz_set (res, v1); - else - mpz_set (res, v2); -} - -/* Sets RES to the max of V1 and V2. */ - -static inline void -value_max (mpz_t res, mpz_t v1, mpz_t v2) -{ - if (mpz_cmp (v1, v2) < 0) - mpz_set (res, v2); - else - mpz_set (res, v1); -} - -/* Builds a new identity map for dimension DIM. */ - -static inline ppl_dimension_type * -ppl_new_id_map (ppl_dimension_type dim) -{ - ppl_dimension_type *map, i; - - map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim); - - for (i = 0; i < dim; i++) - map[i] = i; - - return map; -} - -/* Builds an interchange of dimensions A and B in MAP. */ - -static inline void -ppl_interchange (ppl_dimension_type *map, - ppl_dimension_type a, - ppl_dimension_type b) -{ - map[a] = b; - map[b] = a; -} - -#endif - diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 3f4d7d8eb19..cfa06ab60c5 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -1,5 +1,5 @@ /* Detection of Static Control Parts (SCoP) for Graphite. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop and Tobias Grosser . @@ -20,6 +20,15 @@ along with GCC; see the file COPYING3. If not see . */ #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "tree-flow.h" @@ -31,8 +40,6 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" #include "graphite-scop-detection.h" diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 31e52181dc5..eacfcf1b6e6 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -19,6 +19,18 @@ along with GCC; see the file COPYING3. If not see . */ #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "tree-flow.h" @@ -31,11 +43,19 @@ along with GCC; see the file COPYING3. If not see #include "sese.h" #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" #include "graphite-sese-to-poly.h" + +/* Assigns to RES the value of the INTEGER_CST T. */ + +static inline void +tree_int_to_gmp (tree t, mpz_t res) +{ + double_int di = tree_to_double_int (t); + mpz_set_double_int (res, di, TYPE_UNSIGNED (TREE_TYPE (t))); +} + /* Returns the index of the PHI argument defined in the outermost loop. */ @@ -390,6 +410,16 @@ build_scop_bbs (scop_p scop) sbitmap_free (visited); } +/* Return an ISL identifier for the polyhedral basic block PBB. */ + +static isl_id * +isl_id_for_pbb (scop_p s, poly_bb_p pbb) +{ + char name[50]; + snprintf (name, sizeof (name), "S_%d", pbb_index (pbb)); + return isl_id_alloc (s->ctx, name, pbb); +} + /* Converts the STATIC_SCHEDULE of PBB into a scattering polyhedron. We generate SCATTERING_DIMENSIONS scattering dimensions. @@ -424,69 +454,54 @@ build_scop_bbs (scop_p scop) | 0 0 1 0 0 0 0 0 -5 = 0 */ static void -build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule, +build_pbb_scattering_polyhedrons (isl_aff *static_sched, poly_bb_p pbb, int scattering_dimensions) { int i; - scop_p scop = PBB_SCOP (pbb); int nb_iterators = pbb_dim_iter_domain (pbb); int used_scattering_dimensions = nb_iterators * 2 + 1; - int nb_params = scop_nb_params (scop); - ppl_Coefficient_t c; - ppl_dimension_type dim = scattering_dimensions + nb_iterators + nb_params; - mpz_t v; + isl_int val; + isl_space *dc, *dm; gcc_assert (scattering_dimensions >= used_scattering_dimensions); - mpz_init (v); - ppl_new_Coefficient (&c); - PBB_TRANSFORMED (pbb) = poly_scattering_new (); - ppl_new_C_Polyhedron_from_space_dimension - (&PBB_TRANSFORMED_SCATTERING (pbb), dim, 0); + isl_int_init (val); - PBB_NB_SCATTERING_TRANSFORM (pbb) = scattering_dimensions; + dc = isl_set_get_space (pbb->domain); + dm = isl_space_add_dims (isl_space_from_domain (dc), + isl_dim_out, scattering_dimensions); + pbb->schedule = isl_map_universe (dm); for (i = 0; i < scattering_dimensions; i++) { - ppl_Constraint_t cstr; - ppl_Linear_Expression_t expr; - - ppl_new_Linear_Expression_with_dimension (&expr, dim); - mpz_set_si (v, 1); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_coefficient (expr, i, c); - /* Textual order inside this loop. */ if ((i % 2) == 0) { - ppl_Linear_Expression_coefficient (static_schedule, i / 2, c); - ppl_Coefficient_to_mpz_t (c, v); - mpz_neg (v, v); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_inhomogeneous (expr, c); + isl_constraint *c = isl_equality_alloc + (isl_local_space_from_space (isl_map_get_space (pbb->schedule))); + + if (0 != isl_aff_get_coefficient (static_sched, isl_dim_in, + i / 2, &val)) + gcc_unreachable (); + + isl_int_neg (val, val); + c = isl_constraint_set_constant (c, val); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1); + pbb->schedule = isl_map_add_constraint (pbb->schedule, c); } /* Iterations of this loop. */ else /* if ((i % 2) == 1) */ { int loop = (i - 1) / 2; - - mpz_set_si (v, -1); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_coefficient - (expr, scattering_dimensions + loop, c); + pbb->schedule = isl_map_equate (pbb->schedule, isl_dim_in, loop, + isl_dim_out, i); } - - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (PBB_TRANSFORMED_SCATTERING (pbb), cstr); - ppl_delete_Linear_Expression (expr); - ppl_delete_Constraint (cstr); } - mpz_clear (v); - ppl_delete_Coefficient (c); + isl_int_clear (val); - PBB_ORIGINAL (pbb) = poly_scattering_copy (PBB_TRANSFORMED (pbb)); + pbb->transformed = isl_map_copy (pbb->schedule); } /* Build for BB the static schedule. @@ -531,26 +546,21 @@ build_scop_scattering (scop_p scop) int i; poly_bb_p pbb; gimple_bb_p previous_gbb = NULL; - ppl_Linear_Expression_t static_schedule; - ppl_Coefficient_t c; - mpz_t v; + isl_space *dc = isl_set_get_space (scop->context); + isl_aff *static_sched; - mpz_init (v); - ppl_new_Coefficient (&c); - ppl_new_Linear_Expression (&static_schedule); + dc = isl_space_add_dims (dc, isl_dim_set, number_of_loops()); + static_sched = isl_aff_zero_on_domain (isl_local_space_from_space (dc)); /* We have to start schedules at 0 on the first component and because we cannot compare_prefix_loops against a previous loop, prefix will be equal to zero, and that index will be incremented before copying. */ - mpz_set_si (v, -1); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_coefficient (static_schedule, 0, c); + static_sched = isl_aff_add_coefficient_si (static_sched, isl_dim_in, 0, -1); FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) { gimple_bb_p gbb = PBB_BLACK_BOX (pbb); - ppl_Linear_Expression_t common; int prefix; int nb_scat_dims = pbb_dim_iter_domain (pbb) * 2 + 1; @@ -560,102 +570,158 @@ build_scop_scattering (scop_p scop) prefix = 0; previous_gbb = gbb; - ppl_new_Linear_Expression_with_dimension (&common, prefix + 1); - ppl_assign_Linear_Expression_from_Linear_Expression (common, - static_schedule); - mpz_set_si (v, 1); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_coefficient (common, prefix, c); - ppl_assign_Linear_Expression_from_Linear_Expression (static_schedule, - common); - - build_pbb_scattering_polyhedrons (common, pbb, nb_scat_dims); - - ppl_delete_Linear_Expression (common); + static_sched = isl_aff_add_coefficient_si (static_sched, isl_dim_in, + prefix, 1); + build_pbb_scattering_polyhedrons (static_sched, pbb, nb_scat_dims); } - mpz_clear (v); - ppl_delete_Coefficient (c); - ppl_delete_Linear_Expression (static_schedule); + isl_aff_free (static_sched); } -/* Add the value K to the dimension D of the linear expression EXPR. */ +static isl_pw_aff *extract_affine (scop_p, tree, __isl_take isl_space *space); -static void -add_value_to_dim (ppl_dimension_type d, ppl_Linear_Expression_t expr, - mpz_t k) +/* Extract an affine expression from the chain of recurrence E. */ + +static isl_pw_aff * +extract_affine_chrec (scop_p s, tree e, __isl_take isl_space *space) { - mpz_t val; - ppl_Coefficient_t coef; + isl_pw_aff *lhs = extract_affine (s, CHREC_LEFT (e), isl_space_copy (space)); + isl_pw_aff *rhs = extract_affine (s, CHREC_RIGHT (e), isl_space_copy (space)); + isl_local_space *ls = isl_local_space_from_space (space); + unsigned pos = sese_loop_depth ((sese) s->region, + get_loop (CHREC_VARIABLE (e))) - 1; + isl_aff *loop = isl_aff_set_coefficient_si + (isl_aff_zero_on_domain (ls), isl_dim_in, pos, 1); + isl_pw_aff *l = isl_pw_aff_from_aff (loop); - ppl_new_Coefficient (&coef); - ppl_Linear_Expression_coefficient (expr, d, coef); - mpz_init (val); - ppl_Coefficient_to_mpz_t (coef, val); + /* Before multiplying, make sure that the result is affine. */ + gcc_assert (isl_pw_aff_is_cst (rhs) + || isl_pw_aff_is_cst (l)); - mpz_add (val, val, k); - - ppl_assign_Coefficient_from_mpz_t (coef, val); - ppl_Linear_Expression_add_to_coefficient (expr, d, coef); - mpz_clear (val); - ppl_delete_Coefficient (coef); + return isl_pw_aff_add (lhs, isl_pw_aff_mul (rhs, l)); } -/* In the context of scop S, scan E, the right hand side of a scalar - evolution function in loop VAR, and translate it to a linear - expression EXPR. */ +/* Extract an affine expression from the mult_expr E. */ -static void -scan_tree_for_params_right_scev (sese s, tree e, int var, - ppl_Linear_Expression_t expr) +static isl_pw_aff * +extract_affine_mul (scop_p s, tree e, __isl_take isl_space *space) { - if (expr) + isl_pw_aff *lhs = extract_affine (s, TREE_OPERAND (e, 0), + isl_space_copy (space)); + isl_pw_aff *rhs = extract_affine (s, TREE_OPERAND (e, 1), space); + + if (!isl_pw_aff_is_cst (lhs) + && !isl_pw_aff_is_cst (rhs)) { - loop_p loop = get_loop (var); - ppl_dimension_type l = sese_loop_depth (s, loop) - 1; - mpz_t val; - - /* Scalar evolutions should happen in the sese region. */ - gcc_assert (sese_loop_depth (s, loop) > 0); - - /* We can not deal with parametric strides like: - - | p = parameter; - | - | for i: - | a [i * p] = ... */ - gcc_assert (TREE_CODE (e) == INTEGER_CST); - - mpz_init (val); - tree_int_to_gmp (e, val); - add_value_to_dim (l, expr, val); - mpz_clear (val); + isl_pw_aff_free (lhs); + isl_pw_aff_free (rhs); + return NULL; } + + return isl_pw_aff_mul (lhs, rhs); } -/* Scan the integer constant CST, and add it to the inhomogeneous part of the - linear expression EXPR. K is the multiplier of the constant. */ +/* Return an ISL identifier from the name of the ssa_name E. */ -static void -scan_tree_for_params_int (tree cst, ppl_Linear_Expression_t expr, mpz_t k) +static isl_id * +isl_id_for_ssa_name (scop_p s, tree e) { - mpz_t val; - ppl_Coefficient_t coef; - tree type = TREE_TYPE (cst); + const char *name = get_name (e); + isl_id *id; - mpz_init (val); + if (name) + id = isl_id_alloc (s->ctx, name, e); + else + { + char name1[50]; + snprintf (name1, sizeof (name1), "P_%d", SSA_NAME_VERSION (e)); + id = isl_id_alloc (s->ctx, name1, e); + } - /* Necessary to not get "-1 = 2^n - 1". */ - mpz_set_double_int (val, double_int_sext (tree_to_double_int (cst), - TYPE_PRECISION (type)), false); + return id; +} - mpz_mul (val, val, k); - ppl_new_Coefficient (&coef); - ppl_assign_Coefficient_from_mpz_t (coef, val); - ppl_Linear_Expression_add_to_inhomogeneous (expr, coef); - mpz_clear (val); - ppl_delete_Coefficient (coef); +/* Return an ISL identifier for the data reference DR. */ + +static isl_id * +isl_id_for_dr (scop_p s, data_reference_p dr ATTRIBUTE_UNUSED) +{ + /* Data references all get the same isl_id. They need to be comparable + and are distinguished through the first dimension, which contains the + alias set number. */ + return isl_id_alloc (s->ctx, "", 0); +} + +/* Extract an affine expression from the ssa_name E. */ + +static isl_pw_aff * +extract_affine_name (scop_p s, tree e, __isl_take isl_space *space) +{ + isl_aff *aff; + isl_set *dom; + isl_id *id; + int dimension; + + id = isl_id_for_ssa_name (s, e); + dimension = isl_space_find_dim_by_id (space, isl_dim_param, id); + isl_id_free(id); + dom = isl_set_universe (isl_space_copy (space)); + aff = isl_aff_zero_on_domain (isl_local_space_from_space (space)); + aff = isl_aff_add_coefficient_si (aff, isl_dim_param, dimension, 1); + return isl_pw_aff_alloc (dom, aff); +} + +/* Extract an affine expression from the gmp constant G. */ + +static isl_pw_aff * +extract_affine_gmp (mpz_t g, __isl_take isl_space *space) +{ + isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); + isl_aff *aff = isl_aff_zero_on_domain (ls); + isl_set *dom = isl_set_universe (space); + isl_int v; + + isl_int_init (v); + isl_int_set_gmp (v, g); + aff = isl_aff_add_constant (aff, v); + isl_int_clear (v); + + return isl_pw_aff_alloc (dom, aff); +} + +/* Extract an affine expression from the integer_cst E. */ + +static isl_pw_aff * +extract_affine_int (tree e, __isl_take isl_space *space) +{ + isl_pw_aff *res; + mpz_t g; + + mpz_init (g); + tree_int_to_gmp (e, g); + res = extract_affine_gmp (g, space); + mpz_clear (g); + + return res; +} + +/* Compute pwaff mod 2^width. */ + +static isl_pw_aff * +wrap (isl_pw_aff *pwaff, unsigned width) +{ + isl_int mod; + + isl_int_init (mod); + isl_int_set_si (mod, 1); + isl_int_mul_2exp (mod, mod, width); + + pwaff = isl_pw_aff_mod (pwaff, mod); + + isl_int_clear (mod); + + return pwaff; } /* When parameter NAME is in REGION, returns its index in SESE_PARAMS. @@ -698,14 +764,83 @@ parameter_index_in_region (tree name, sese region) return i; } +/* Extract an affine expression from the tree E in the scop S. */ + +static isl_pw_aff * +extract_affine (scop_p s, tree e, __isl_take isl_space *space) +{ + isl_pw_aff *lhs, *rhs, *res; + tree type; + + if (e == chrec_dont_know) { + isl_space_free (space); + return NULL; + } + + switch (TREE_CODE (e)) + { + case POLYNOMIAL_CHREC: + res = extract_affine_chrec (s, e, space); + break; + + case MULT_EXPR: + res = extract_affine_mul (s, e, space); + break; + + case PLUS_EXPR: + case POINTER_PLUS_EXPR: + lhs = extract_affine (s, TREE_OPERAND (e, 0), isl_space_copy (space)); + rhs = extract_affine (s, TREE_OPERAND (e, 1), space); + res = isl_pw_aff_add (lhs, rhs); + break; + + case MINUS_EXPR: + lhs = extract_affine (s, TREE_OPERAND (e, 0), isl_space_copy (space)); + rhs = extract_affine (s, TREE_OPERAND (e, 1), space); + res = isl_pw_aff_sub (lhs, rhs); + break; + + case NEGATE_EXPR: + case BIT_NOT_EXPR: + lhs = extract_affine (s, TREE_OPERAND (e, 0), isl_space_copy (space)); + rhs = extract_affine (s, integer_minus_one_node, space); + res = isl_pw_aff_mul (lhs, rhs); + break; + + case SSA_NAME: + gcc_assert (-1 != parameter_index_in_region_1 (e, SCOP_REGION (s))); + res = extract_affine_name (s, e, space); + break; + + case INTEGER_CST: + res = extract_affine_int (e, space); + /* No need to wrap a single integer. */ + return res; + + CASE_CONVERT: + case NON_LVALUE_EXPR: + res = extract_affine (s, TREE_OPERAND (e, 0), space); + break; + + default: + gcc_unreachable (); + break; + } + + type = TREE_TYPE (e); + if (TYPE_UNSIGNED (type)) + res = wrap (res, TYPE_PRECISION (type)); + + return res; +} + /* In the context of sese S, scan the expression E and translate it to a linear expression C. When parsing a symbolic multiplication, K represents the constant multiplier of an expression containing parameters. */ static void -scan_tree_for_params (sese s, tree e, ppl_Linear_Expression_t c, - mpz_t k) +scan_tree_for_params (sese s, tree e) { if (e == chrec_dont_know) return; @@ -713,153 +848,35 @@ scan_tree_for_params (sese s, tree e, ppl_Linear_Expression_t c, switch (TREE_CODE (e)) { case POLYNOMIAL_CHREC: - scan_tree_for_params_right_scev (s, CHREC_RIGHT (e), - CHREC_VARIABLE (e), c); - scan_tree_for_params (s, CHREC_LEFT (e), c, k); + scan_tree_for_params (s, CHREC_LEFT (e)); break; case MULT_EXPR: if (chrec_contains_symbols (TREE_OPERAND (e, 0))) - { - if (c) - { - mpz_t val; - gcc_assert (host_integerp (TREE_OPERAND (e, 1), 0)); - mpz_init (val); - tree_int_to_gmp (TREE_OPERAND (e, 1), val); - mpz_mul (val, val, k); - scan_tree_for_params (s, TREE_OPERAND (e, 0), c, val); - mpz_clear (val); - } - else - scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k); - } + scan_tree_for_params (s, TREE_OPERAND (e, 0)); else - { - if (c) - { - mpz_t val; - gcc_assert (host_integerp (TREE_OPERAND (e, 0), 0)); - mpz_init (val); - tree_int_to_gmp (TREE_OPERAND (e, 0), val); - mpz_mul (val, val, k); - scan_tree_for_params (s, TREE_OPERAND (e, 1), c, val); - mpz_clear (val); - } - else - scan_tree_for_params (s, TREE_OPERAND (e, 1), c, k); - } + scan_tree_for_params (s, TREE_OPERAND (e, 1)); break; case PLUS_EXPR: case POINTER_PLUS_EXPR: - scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k); - scan_tree_for_params (s, TREE_OPERAND (e, 1), c, k); - break; - case MINUS_EXPR: - { - ppl_Linear_Expression_t tmp_expr = NULL; - - if (c) - { - ppl_dimension_type dim; - ppl_Linear_Expression_space_dimension (c, &dim); - ppl_new_Linear_Expression_with_dimension (&tmp_expr, dim); - } - - scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k); - scan_tree_for_params (s, TREE_OPERAND (e, 1), tmp_expr, k); - - if (c) - { - ppl_subtract_Linear_Expression_from_Linear_Expression (c, - tmp_expr); - ppl_delete_Linear_Expression (tmp_expr); - } - - break; - } + scan_tree_for_params (s, TREE_OPERAND (e, 0)); + scan_tree_for_params (s, TREE_OPERAND (e, 1)); + break; case NEGATE_EXPR: - { - ppl_Linear_Expression_t tmp_expr = NULL; - - if (c) - { - ppl_dimension_type dim; - ppl_Linear_Expression_space_dimension (c, &dim); - ppl_new_Linear_Expression_with_dimension (&tmp_expr, dim); - } - - scan_tree_for_params (s, TREE_OPERAND (e, 0), tmp_expr, k); - - if (c) - { - ppl_subtract_Linear_Expression_from_Linear_Expression (c, - tmp_expr); - ppl_delete_Linear_Expression (tmp_expr); - } - - break; - } - case BIT_NOT_EXPR: - { - ppl_Linear_Expression_t tmp_expr = NULL; - - if (c) - { - ppl_dimension_type dim; - ppl_Linear_Expression_space_dimension (c, &dim); - ppl_new_Linear_Expression_with_dimension (&tmp_expr, dim); - } - - scan_tree_for_params (s, TREE_OPERAND (e, 0), tmp_expr, k); - - if (c) - { - ppl_Coefficient_t coef; - mpz_t minus_one; - - ppl_subtract_Linear_Expression_from_Linear_Expression (c, - tmp_expr); - ppl_delete_Linear_Expression (tmp_expr); - mpz_init (minus_one); - mpz_set_si (minus_one, -1); - ppl_new_Coefficient_from_mpz_t (&coef, minus_one); - ppl_Linear_Expression_add_to_inhomogeneous (c, coef); - mpz_clear (minus_one); - ppl_delete_Coefficient (coef); - } - - break; - } - - case SSA_NAME: - { - ppl_dimension_type p = parameter_index_in_region (e, s); - - if (c) - { - ppl_dimension_type dim; - ppl_Linear_Expression_space_dimension (c, &dim); - p += dim - sese_nb_params (s); - add_value_to_dim (p, c, k); - } - break; - } - - case INTEGER_CST: - if (c) - scan_tree_for_params_int (e, c, k); - break; - CASE_CONVERT: case NON_LVALUE_EXPR: - scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k); + scan_tree_for_params (s, TREE_OPERAND (e, 0)); break; + case SSA_NAME: + parameter_index_in_region (e, s); + break; + + case INTEGER_CST: case ADDR_EXPR: break; @@ -880,15 +897,11 @@ find_params_in_bb (sese region, gimple_bb_p gbb) data_reference_p dr; gimple stmt; loop_p loop = GBB_BB (gbb)->loop_father; - mpz_t one; - - mpz_init (one); - mpz_set_si (one, 1); /* Find parameters in the access functions of data references. */ FOR_EACH_VEC_ELT (data_reference_p, GBB_DATA_REFS (gbb), i, dr) for (j = 0; j < DR_NUM_DIMENSIONS (dr); j++) - scan_tree_for_params (region, DR_ACCESS_FN (dr, j), NULL, one); + scan_tree_for_params (region, DR_ACCESS_FN (dr, j)); /* Find parameters in conditional statements. */ FOR_EACH_VEC_ELT (gimple, GBB_CONDITIONS (gbb), i, stmt) @@ -898,11 +911,9 @@ find_params_in_bb (sese region, gimple_bb_p gbb) tree rhs = scalar_evolution_in_region (region, loop, gimple_cond_rhs (stmt)); - scan_tree_for_params (region, lhs, NULL, one); - scan_tree_for_params (region, rhs, NULL, one); + scan_tree_for_params (region, lhs); + scan_tree_for_params (region, rhs); } - - mpz_clear (one); } /* Record the parameters used in the SCOP. A variable is a parameter @@ -915,10 +926,7 @@ find_scop_parameters (scop_p scop) unsigned i; sese region = SCOP_REGION (scop); struct loop *loop; - mpz_t one; - - mpz_init (one); - mpz_set_si (one, 1); + int nbp; /* Find the parameters used in the loop bounds. */ FOR_EACH_VEC_ELT (loop_p, SESE_LOOP_NEST (region), i, loop) @@ -929,87 +937,27 @@ find_scop_parameters (scop_p scop) continue; nb_iters = scalar_evolution_in_region (region, loop, nb_iters); - scan_tree_for_params (region, nb_iters, NULL, one); + scan_tree_for_params (region, nb_iters); } - mpz_clear (one); - /* Find the parameters used in data accesses. */ FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) find_params_in_bb (region, PBB_BLACK_BOX (pbb)); - scop_set_nb_params (scop, sese_nb_params (region)); + nbp = sese_nb_params (region); + scop_set_nb_params (scop, nbp); SESE_ADD_PARAMS (region) = false; - ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension - (&SCOP_CONTEXT (scop), scop_nb_params (scop), 0); -} - -/* Insert in the SCOP context constraints from the estimation of the - number of iterations. UB_EXPR is a linear expression describing - the number of iterations in a loop. This expression is bounded by - the estimation NIT. */ - -static void -add_upper_bounds_from_estimated_nit (scop_p scop, double_int nit, - ppl_dimension_type dim, - ppl_Linear_Expression_t ub_expr) -{ - mpz_t val; - ppl_Linear_Expression_t nb_iters_le; - ppl_Polyhedron_t pol; - ppl_Coefficient_t coef; - ppl_Constraint_t ub; - - ppl_new_C_Polyhedron_from_space_dimension (&pol, dim, 0); - ppl_new_Linear_Expression_from_Linear_Expression (&nb_iters_le, - ub_expr); - - /* Construct the negated number of last iteration in VAL. */ - mpz_init (val); - mpz_set_double_int (val, nit, false); - mpz_sub_ui (val, val, 1); - mpz_neg (val, val); - - /* NB_ITERS_LE holds the number of last iteration in - parametrical form. Subtract estimated number of last - iteration and assert that result is not positive. */ - ppl_new_Coefficient_from_mpz_t (&coef, val); - ppl_Linear_Expression_add_to_inhomogeneous (nb_iters_le, coef); - ppl_delete_Coefficient (coef); - ppl_new_Constraint (&ub, nb_iters_le, - PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL); - ppl_Polyhedron_add_constraint (pol, ub); - - /* Remove all but last GDIM dimensions from POL to obtain - only the constraints on the parameters. */ { - graphite_dim_t gdim = scop_nb_params (scop); - ppl_dimension_type *dims = XNEWVEC (ppl_dimension_type, dim - gdim); - graphite_dim_t i; + tree e; + isl_space *space = isl_space_set_alloc (scop->ctx, nbp, 0); - for (i = 0; i < dim - gdim; i++) - dims[i] = i; + FOR_EACH_VEC_ELT (tree, SESE_PARAMS (region), i, e) + space = isl_space_set_dim_id (space, isl_dim_param, i, + isl_id_for_ssa_name (scop, e)); - ppl_Polyhedron_remove_space_dimensions (pol, dims, dim - gdim); - XDELETEVEC (dims); + scop->context = isl_set_universe (space); } - - /* Add the constraints on the parameters to the SCoP context. */ - { - ppl_Pointset_Powerset_C_Polyhedron_t constraints_ps; - - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&constraints_ps, pol); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign - (SCOP_CONTEXT (scop), constraints_ps); - ppl_delete_Pointset_Powerset_C_Polyhedron (constraints_ps); - } - - ppl_delete_Polyhedron (pol); - ppl_delete_Linear_Expression (nb_iters_le); - ppl_delete_Constraint (ub); - mpz_clear (val); } /* Builds the constraint polyhedra for LOOP in SCOP. OUTER_PH gives @@ -1017,210 +965,131 @@ add_upper_bounds_from_estimated_nit (scop_p scop, double_int nit, static void build_loop_iteration_domains (scop_p scop, struct loop *loop, - ppl_Polyhedron_t outer_ph, int nb, - ppl_Pointset_Powerset_C_Polyhedron_t *domains) + int nb, + isl_set *outer, isl_set **doms) { - int i; - ppl_Polyhedron_t ph; tree nb_iters = number_of_latch_executions (loop); - ppl_dimension_type dim = nb + 1 + scop_nb_params (scop); sese region = SCOP_REGION (scop); - { - ppl_const_Constraint_System_t pcs; - ppl_dimension_type *map - = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim); + isl_set *inner = isl_set_copy (outer); + isl_space *space; + isl_constraint *c; + int pos = isl_set_dim (outer, isl_dim_set); + isl_int v; + mpz_t g; - ppl_new_C_Polyhedron_from_space_dimension (&ph, dim, 0); - ppl_Polyhedron_get_constraints (outer_ph, &pcs); - ppl_Polyhedron_add_constraints (ph, pcs); + mpz_init (g); + isl_int_init (v); - for (i = 0; i < (int) nb; i++) - map[i] = i; - for (i = (int) nb; i < (int) dim - 1; i++) - map[i] = i + 1; - map[dim - 1] = nb; - - ppl_Polyhedron_map_space_dimensions (ph, map, dim); - free (map); - } + inner = isl_set_add_dims (inner, isl_dim_set, 1); + space = isl_set_get_space (inner); /* 0 <= loop_i */ - { - ppl_Constraint_t lb; - ppl_Linear_Expression_t lb_expr; - - ppl_new_Linear_Expression_with_dimension (&lb_expr, dim); - ppl_set_coef (lb_expr, nb, 1); - ppl_new_Constraint (&lb, lb_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_delete_Linear_Expression (lb_expr); - ppl_Polyhedron_add_constraint (ph, lb); - ppl_delete_Constraint (lb); - } + c = isl_inequality_alloc + (isl_local_space_from_space (isl_space_copy (space))); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, 1); + inner = isl_set_add_constraint (inner, c); + /* loop_i <= cst_nb_iters */ if (TREE_CODE (nb_iters) == INTEGER_CST) { - ppl_Constraint_t ub; - ppl_Linear_Expression_t ub_expr; - - ppl_new_Linear_Expression_with_dimension (&ub_expr, dim); - - /* loop_i <= cst_nb_iters */ - ppl_set_coef (ub_expr, nb, -1); - ppl_set_inhomogeneous_tree (ub_expr, nb_iters); - ppl_new_Constraint (&ub, ub_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_Polyhedron_add_constraint (ph, ub); - ppl_delete_Linear_Expression (ub_expr); - ppl_delete_Constraint (ub); + c = isl_inequality_alloc + (isl_local_space_from_space(isl_space_copy (space))); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1); + tree_int_to_gmp (nb_iters, g); + isl_int_set_gmp (v, g); + c = isl_constraint_set_constant (c, v); + inner = isl_set_add_constraint (inner, c); } + + /* loop_i <= expr_nb_iters */ else if (!chrec_contains_undetermined (nb_iters)) { - mpz_t one; - ppl_Constraint_t ub; - ppl_Linear_Expression_t ub_expr; double_int nit; + isl_pw_aff *aff; + isl_set *valid; + isl_local_space *ls; + isl_aff *al; + isl_set *le; - mpz_init (one); - mpz_set_si (one, 1); - ppl_new_Linear_Expression_with_dimension (&ub_expr, dim); nb_iters = scalar_evolution_in_region (region, loop, nb_iters); - scan_tree_for_params (SCOP_REGION (scop), nb_iters, ub_expr, one); - mpz_clear (one); + + aff = extract_affine (scop, nb_iters, isl_set_get_space (inner)); + valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (aff)); + valid = isl_set_project_out (valid, isl_dim_set, 0, + isl_set_dim (valid, isl_dim_set)); + scop->context = isl_set_intersect (scop->context, valid); + + ls = isl_local_space_from_space (isl_space_copy (space)); + al = isl_aff_set_coefficient_si (isl_aff_zero_on_domain (ls), + isl_dim_in, pos, 1); + le = isl_pw_aff_le_set (isl_pw_aff_from_aff (al), + isl_pw_aff_copy (aff)); + inner = isl_set_intersect (inner, le); if (max_stmt_executions (loop, &nit)) - add_upper_bounds_from_estimated_nit (scop, nit, dim, ub_expr); + { + /* Insert in the context the constraints from the + estimation of the number of iterations NIT and the + symbolic number of iterations (involving parameter + names) NB_ITERS. First, build the affine expression + "NIT - NB_ITERS" and then say that it is positive, + i.e., NIT approximates NB_ITERS: "NIT >= NB_ITERS". */ + isl_pw_aff *approx; + mpz_t g; + isl_set *x; + isl_constraint *c; - /* loop_i <= expr_nb_iters */ - ppl_set_coef (ub_expr, nb, -1); - ppl_new_Constraint (&ub, ub_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_Polyhedron_add_constraint (ph, ub); - ppl_delete_Linear_Expression (ub_expr); - ppl_delete_Constraint (ub); + mpz_init (g); + mpz_set_double_int (g, nit, false); + mpz_sub_ui (g, g, 1); + approx = extract_affine_gmp (g, isl_set_get_space (inner)); + x = isl_pw_aff_ge_set (approx, aff); + x = isl_set_project_out (x, isl_dim_set, 0, + isl_set_dim (x, isl_dim_set)); + scop->context = isl_set_intersect (scop->context, x); + + c = isl_inequality_alloc + (isl_local_space_from_space (isl_space_copy (space))); + c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1); + isl_int_set_gmp (v, g); + mpz_clear (g); + c = isl_constraint_set_constant (c, v); + inner = isl_set_add_constraint (inner, c); + } } else gcc_unreachable (); if (loop->inner && loop_in_sese_p (loop->inner, region)) - build_loop_iteration_domains (scop, loop->inner, ph, nb + 1, domains); + build_loop_iteration_domains (scop, loop->inner, nb + 1, + isl_set_copy (inner), doms); if (nb != 0 && loop->next && loop_in_sese_p (loop->next, region)) - build_loop_iteration_domains (scop, loop->next, outer_ph, nb, domains); + build_loop_iteration_domains (scop, loop->next, nb, + isl_set_copy (outer), doms); - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&domains[loop->num], ph); + doms[loop->num] = inner; - ppl_delete_Polyhedron (ph); + isl_set_free (outer); + isl_space_free (space); + isl_int_clear (v); + mpz_clear (g); } /* Returns a linear expression for tree T evaluated in PBB. */ -static ppl_Linear_Expression_t -create_linear_expr_from_tree (poly_bb_p pbb, tree t) +static isl_pw_aff * +create_pw_aff_from_tree (poly_bb_p pbb, tree t) { - mpz_t one; - ppl_Linear_Expression_t res; - ppl_dimension_type dim; - sese region = SCOP_REGION (PBB_SCOP (pbb)); - loop_p loop = pbb_loop (pbb); + scop_p scop = PBB_SCOP (pbb); - dim = pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb); - ppl_new_Linear_Expression_with_dimension (&res, dim); - - t = scalar_evolution_in_region (region, loop, t); + t = scalar_evolution_in_region (SCOP_REGION (scop), pbb_loop (pbb), t); gcc_assert (!automatically_generated_chrec_p (t)); - mpz_init (one); - mpz_set_si (one, 1); - scan_tree_for_params (region, t, res, one); - mpz_clear (one); - - return res; -} - -/* Returns the ppl constraint type from the gimple tree code CODE. */ - -static enum ppl_enum_Constraint_Type -ppl_constraint_type_from_tree_code (enum tree_code code) -{ - switch (code) - { - /* We do not support LT and GT to be able to work with C_Polyhedron. - As we work on integer polyhedron "a < b" can be expressed by - "a + 1 <= b". */ - case LT_EXPR: - case GT_EXPR: - gcc_unreachable (); - - case LE_EXPR: - return PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL; - - case GE_EXPR: - return PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL; - - case EQ_EXPR: - return PPL_CONSTRAINT_TYPE_EQUAL; - - default: - gcc_unreachable (); - } -} - -/* Add conditional statement STMT to PS. It is evaluated in PBB and - CODE is used as the comparison operator. This allows us to invert the - condition or to handle inequalities. */ - -static void -add_condition_to_domain (ppl_Pointset_Powerset_C_Polyhedron_t ps, gimple stmt, - poly_bb_p pbb, enum tree_code code) -{ - mpz_t v; - ppl_Coefficient_t c; - ppl_Linear_Expression_t left, right; - ppl_Constraint_t cstr; - enum ppl_enum_Constraint_Type type; - - left = create_linear_expr_from_tree (pbb, gimple_cond_lhs (stmt)); - right = create_linear_expr_from_tree (pbb, gimple_cond_rhs (stmt)); - - /* If we have < or > expressions convert them to <= or >= by adding 1 to - the left or the right side of the expression. */ - if (code == LT_EXPR) - { - mpz_init (v); - mpz_set_si (v, 1); - ppl_new_Coefficient (&c); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_inhomogeneous (left, c); - ppl_delete_Coefficient (c); - mpz_clear (v); - - code = LE_EXPR; - } - else if (code == GT_EXPR) - { - mpz_init (v); - mpz_set_si (v, 1); - ppl_new_Coefficient (&c); - ppl_assign_Coefficient_from_mpz_t (c, v); - ppl_Linear_Expression_add_to_inhomogeneous (right, c); - ppl_delete_Coefficient (c); - mpz_clear (v); - - code = GE_EXPR; - } - - type = ppl_constraint_type_from_tree_code (code); - - ppl_subtract_Linear_Expression_from_Linear_Expression (left, right); - - ppl_new_Constraint (&cstr, left, type); - ppl_Pointset_Powerset_C_Polyhedron_add_constraint (ps, cstr); - - ppl_delete_Constraint (cstr); - ppl_delete_Linear_Expression (left); - ppl_delete_Linear_Expression (right); + return extract_affine (scop, t, isl_set_get_space (pbb->domain)); } /* Add conditional statement STMT to pbb. CODE is used as the comparison @@ -1230,19 +1099,45 @@ add_condition_to_domain (ppl_Pointset_Powerset_C_Polyhedron_t ps, gimple stmt, static void add_condition_to_pbb (poly_bb_p pbb, gimple stmt, enum tree_code code) { - if (code == NE_EXPR) + isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, gimple_cond_lhs (stmt)); + isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, gimple_cond_rhs (stmt)); + isl_set *cond; + + switch (code) { - ppl_Pointset_Powerset_C_Polyhedron_t left = PBB_DOMAIN (pbb); - ppl_Pointset_Powerset_C_Polyhedron_t right; - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&right, left); - add_condition_to_domain (left, stmt, pbb, LT_EXPR); - add_condition_to_domain (right, stmt, pbb, GT_EXPR); - ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (left, right); - ppl_delete_Pointset_Powerset_C_Polyhedron (right); + case LT_EXPR: + cond = isl_pw_aff_lt_set (lhs, rhs); + break; + + case GT_EXPR: + cond = isl_pw_aff_gt_set (lhs, rhs); + break; + + case LE_EXPR: + cond = isl_pw_aff_le_set (lhs, rhs); + break; + + case GE_EXPR: + cond = isl_pw_aff_ge_set (lhs, rhs); + break; + + case EQ_EXPR: + cond = isl_pw_aff_eq_set (lhs, rhs); + break; + + case NE_EXPR: + cond = isl_pw_aff_ne_set (lhs, rhs); + break; + + default: + isl_pw_aff_free(lhs); + isl_pw_aff_free(rhs); + return; } - else - add_condition_to_domain (PBB_DOMAIN (pbb), stmt, pbb, code); + + cond = isl_set_coalesce (cond); + cond = isl_set_set_tuple_id (cond, isl_set_get_tuple_id (pbb->domain)); + pbb->domain = isl_set_intersect (pbb->domain, cond); } /* Add conditions to the domain of PBB. */ @@ -1273,7 +1168,7 @@ add_conditions_to_domain (poly_bb_p pbb) } case GIMPLE_SWITCH: - /* Switch statements are not supported right now - fall throught. */ + /* Switch statements are not supported right now - fall through. */ default: gcc_unreachable (); @@ -1420,10 +1315,8 @@ build_sese_conditions (sese region) of P. */ static void -add_param_constraints (scop_p scop, ppl_Polyhedron_t context, graphite_dim_t p) +add_param_constraints (scop_p scop, graphite_dim_t p) { - ppl_Constraint_t cstr; - ppl_Linear_Expression_t le; tree parameter = VEC_index (tree, SESE_PARAMS (SCOP_REGION (scop)), p); tree type = TREE_TYPE (parameter); tree lb = NULL_TREE; @@ -1441,24 +1334,44 @@ add_param_constraints (scop_p scop, ppl_Polyhedron_t context, graphite_dim_t p) if (lb) { - ppl_new_Linear_Expression_with_dimension (&le, scop_nb_params (scop)); - ppl_set_coef (le, p, -1); - ppl_set_inhomogeneous_tree (le, lb); - ppl_new_Constraint (&cstr, le, PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL); - ppl_Polyhedron_add_constraint (context, cstr); - ppl_delete_Linear_Expression (le); - ppl_delete_Constraint (cstr); + isl_space *space = isl_set_get_space (scop->context); + isl_constraint *c; + mpz_t g; + isl_int v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); + mpz_init (g); + isl_int_init (v); + tree_int_to_gmp (lb, g); + isl_int_set_gmp (v, g); + isl_int_neg (v, v); + mpz_clear (g); + c = isl_constraint_set_constant (c, v); + isl_int_clear (v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1); + + scop->context = isl_set_add_constraint (scop->context, c); } if (ub) { - ppl_new_Linear_Expression_with_dimension (&le, scop_nb_params (scop)); - ppl_set_coef (le, p, -1); - ppl_set_inhomogeneous_tree (le, ub); - ppl_new_Constraint (&cstr, le, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_Polyhedron_add_constraint (context, cstr); - ppl_delete_Linear_Expression (le); - ppl_delete_Constraint (cstr); + isl_space *space = isl_set_get_space (scop->context); + isl_constraint *c; + mpz_t g; + isl_int v; + + c = isl_inequality_alloc (isl_local_space_from_space (space)); + + mpz_init (g); + isl_int_init (v); + tree_int_to_gmp (ub, g); + isl_int_set_gmp (v, g); + mpz_clear (g); + c = isl_constraint_set_constant (c, v); + isl_int_clear (v); + c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1); + + scop->context = isl_set_add_constraint (scop->context, c); } } @@ -1469,22 +1382,10 @@ add_param_constraints (scop_p scop, ppl_Polyhedron_t context, graphite_dim_t p) static void build_scop_context (scop_p scop) { - ppl_Polyhedron_t context; - ppl_Pointset_Powerset_C_Polyhedron_t ps; graphite_dim_t p, n = scop_nb_params (scop); - ppl_new_C_Polyhedron_from_space_dimension (&context, n, 0); - for (p = 0; p < n; p++) - add_param_constraints (scop, context, p); - - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&ps, context); - ppl_Pointset_Powerset_C_Polyhedron_intersection_assign - (SCOP_CONTEXT (scop), ps); - - ppl_delete_Pointset_Powerset_C_Polyhedron (ps); - ppl_delete_Polyhedron (context); + add_param_constraints (scop, p); } /* Build the iteration domains: the loops belonging to the current @@ -1497,36 +1398,33 @@ build_scop_iteration_domain (scop_p scop) struct loop *loop; sese region = SCOP_REGION (scop); int i; - ppl_Polyhedron_t ph; poly_bb_p pbb; int nb_loops = number_of_loops (); - ppl_Pointset_Powerset_C_Polyhedron_t *domains - = XNEWVEC (ppl_Pointset_Powerset_C_Polyhedron_t, nb_loops); - - for (i = 0; i < nb_loops; i++) - domains[i] = NULL; - - ppl_new_C_Polyhedron_from_space_dimension (&ph, scop_nb_params (scop), 0); + isl_set **doms = XCNEWVEC (isl_set *, nb_loops); FOR_EACH_VEC_ELT (loop_p, SESE_LOOP_NEST (region), i, loop) if (!loop_in_sese_p (loop_outer (loop), region)) - build_loop_iteration_domains (scop, loop, ph, 0, domains); + build_loop_iteration_domains (scop, loop, 0, + isl_set_copy (scop->context), doms); FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) - if (domains[gbb_loop (PBB_BLACK_BOX (pbb))->num]) - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&PBB_DOMAIN (pbb), (ppl_const_Pointset_Powerset_C_Polyhedron_t) - domains[gbb_loop (PBB_BLACK_BOX (pbb))->num]); - else - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron - (&PBB_DOMAIN (pbb), ph); + { + loop = pbb_loop (pbb); + + if (doms[loop->num]) + pbb->domain = isl_set_copy (doms[loop->num]); + else + pbb->domain = isl_set_copy (scop->context); + + pbb->domain = isl_set_set_tuple_id (pbb->domain, + isl_id_for_pbb (scop, pbb)); + } for (i = 0; i < nb_loops; i++) - if (domains[i]) - ppl_delete_Pointset_Powerset_C_Polyhedron (domains[i]); + if (doms[i]) + isl_set_free (doms[i]); - ppl_delete_Polyhedron (ph); - free (domains); + free (doms); } /* Add a constrain to the ACCESSES polyhedron for the alias set of @@ -1534,28 +1432,44 @@ build_scop_iteration_domain (scop_p scop) ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration domain. */ -static void -pdr_add_alias_set (ppl_Polyhedron_t accesses, data_reference_p dr, - ppl_dimension_type accessp_nb_dims, - ppl_dimension_type dom_nb_dims) +static isl_map * +pdr_add_alias_set (isl_map *acc, data_reference_p dr) { - ppl_Linear_Expression_t alias; - ppl_Constraint_t cstr; + isl_constraint *c; int alias_set_num = 0; base_alias_pair *bap = (base_alias_pair *)(dr->aux); if (bap && bap->alias_set) alias_set_num = *(bap->alias_set); - ppl_new_Linear_Expression_with_dimension (&alias, accessp_nb_dims); + c = isl_equality_alloc + (isl_local_space_from_space (isl_map_get_space (acc))); + c = isl_constraint_set_constant_si (c, -alias_set_num); + c = isl_constraint_set_coefficient_si (c, isl_dim_out, 0, 1); - ppl_set_coef (alias, dom_nb_dims, 1); - ppl_set_inhomogeneous (alias, -alias_set_num); - ppl_new_Constraint (&cstr, alias, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (accesses, cstr); + return isl_map_add_constraint (acc, c); +} - ppl_delete_Linear_Expression (alias); - ppl_delete_Constraint (cstr); +/* Assign the affine expression INDEX to the output dimension POS of + MAP and return the result. */ + +static isl_map * +set_index (isl_map *map, int pos, isl_pw_aff *index) +{ + isl_map *index_map; + int len = isl_map_dim (map, isl_dim_out); + isl_id *id; + + index_map = isl_map_from_pw_aff (index); + index_map = isl_map_insert_dims (index_map, isl_dim_out, 0, pos); + index_map = isl_map_add_dims (index_map, isl_dim_out, len - pos - 1); + + id = isl_map_get_tuple_id (map, isl_dim_out); + index_map = isl_map_set_tuple_id (index_map, isl_dim_out, id); + id = isl_map_get_tuple_id (map, isl_dim_in); + index_map = isl_map_set_tuple_id (index_map, isl_dim_in, id); + + return isl_map_intersect (map, index_map); } /* Add to ACCESSES polyhedron equalities defining the access functions @@ -1563,43 +1477,23 @@ pdr_add_alias_set (ppl_Polyhedron_t accesses, data_reference_p dr, polyhedron, DOM_NB_DIMS is the dimension of the iteration domain. PBB is the poly_bb_p that contains the data reference DR. */ -static void -pdr_add_memory_accesses (ppl_Polyhedron_t accesses, data_reference_p dr, - ppl_dimension_type accessp_nb_dims, - ppl_dimension_type dom_nb_dims, - poly_bb_p pbb) +static isl_map * +pdr_add_memory_accesses (isl_map *acc, data_reference_p dr, poly_bb_p pbb) { int i, nb_subscripts = DR_NUM_DIMENSIONS (dr); - mpz_t v; scop_p scop = PBB_SCOP (pbb); - sese region = SCOP_REGION (scop); - - mpz_init (v); for (i = 0; i < nb_subscripts; i++) { - ppl_Linear_Expression_t fn, access; - ppl_Constraint_t cstr; - ppl_dimension_type subscript = dom_nb_dims + 1 + i; + isl_pw_aff *aff; tree afn = DR_ACCESS_FN (dr, nb_subscripts - 1 - i); - ppl_new_Linear_Expression_with_dimension (&fn, dom_nb_dims); - ppl_new_Linear_Expression_with_dimension (&access, accessp_nb_dims); - - mpz_set_si (v, 1); - scan_tree_for_params (region, afn, fn, v); - ppl_assign_Linear_Expression_from_Linear_Expression (access, fn); - - ppl_set_coef (access, subscript, -1); - ppl_new_Constraint (&cstr, access, PPL_CONSTRAINT_TYPE_EQUAL); - ppl_Polyhedron_add_constraint (accesses, cstr); - - ppl_delete_Linear_Expression (fn); - ppl_delete_Linear_Expression (access); - ppl_delete_Constraint (cstr); + aff = extract_affine (scop, afn, + isl_space_domain (isl_map_get_space (acc))); + acc = set_index (acc, i + 1, aff); } - mpz_clear (v); + return acc; } /* Add constrains representing the size of the accessed data to the @@ -1607,63 +1501,68 @@ pdr_add_memory_accesses (ppl_Polyhedron_t accesses, data_reference_p dr, ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration domain. */ -static void -pdr_add_data_dimensions (ppl_Polyhedron_t accesses, data_reference_p dr, - ppl_dimension_type accessp_nb_dims, - ppl_dimension_type dom_nb_dims) +static isl_set * +pdr_add_data_dimensions (isl_set *extent, scop_p scop, data_reference_p dr) { tree ref = DR_REF (dr); int i, nb_subscripts = DR_NUM_DIMENSIONS (dr); for (i = nb_subscripts - 1; i >= 0; i--, ref = TREE_OPERAND (ref, 0)) { - ppl_Linear_Expression_t expr; - ppl_Constraint_t cstr; - ppl_dimension_type subscript = dom_nb_dims + 1 + i; tree low, high; if (TREE_CODE (ref) != ARRAY_REF) break; low = array_ref_low_bound (ref); - - /* subscript - low >= 0 */ - if (host_integerp (low, 0)) - { - tree minus_low; - - ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims); - ppl_set_coef (expr, subscript, 1); - - minus_low = fold_build1 (NEGATE_EXPR, TREE_TYPE (low), low); - ppl_set_inhomogeneous_tree (expr, minus_low); - - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_Polyhedron_add_constraint (accesses, cstr); - ppl_delete_Linear_Expression (expr); - ppl_delete_Constraint (cstr); - } - high = array_ref_up_bound (ref); - /* high - subscript >= 0 */ - if (high && host_integerp (high, 0) + /* XXX The PPL code dealt separately with + subscript - low >= 0 and high - subscript >= 0 in case one of + the two bounds isn't known. Do the same here? */ + + if (host_integerp (low, 0) + && high + && host_integerp (high, 0) /* 1-element arrays at end of structures may extend over their declared size. */ && !(array_at_struct_end_p (ref) && operand_equal_p (low, high, 0))) { - ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims); - ppl_set_coef (expr, subscript, -1); + isl_id *id; + isl_aff *aff; + isl_set *univ, *lbs, *ubs; + isl_pw_aff *index; + isl_space *space; + isl_set *valid; + isl_pw_aff *lb = extract_affine_int (low, isl_set_get_space (extent)); + isl_pw_aff *ub = extract_affine_int (high, isl_set_get_space (extent)); - ppl_set_inhomogeneous_tree (expr, high); + /* high >= 0 */ + valid = isl_pw_aff_nonneg_set (isl_pw_aff_copy (ub)); + valid = isl_set_project_out (valid, isl_dim_set, 0, + isl_set_dim (valid, isl_dim_set)); + scop->context = isl_set_intersect (scop->context, valid); - ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL); - ppl_Polyhedron_add_constraint (accesses, cstr); - ppl_delete_Linear_Expression (expr); - ppl_delete_Constraint (cstr); + space = isl_set_get_space (extent); + aff = isl_aff_zero_on_domain (isl_local_space_from_space (space)); + aff = isl_aff_add_coefficient_si (aff, isl_dim_in, i + 1, 1); + univ = isl_set_universe (isl_space_domain (isl_aff_get_space (aff))); + index = isl_pw_aff_alloc (univ, aff); + + id = isl_set_get_tuple_id (extent); + lb = isl_pw_aff_set_tuple_id (lb, isl_dim_in, isl_id_copy (id)); + ub = isl_pw_aff_set_tuple_id (ub, isl_dim_in, id); + + /* low <= sub_i <= high */ + lbs = isl_pw_aff_ge_set (isl_pw_aff_copy (index), lb); + ubs = isl_pw_aff_le_set (index, ub); + extent = isl_set_intersect (extent, lbs); + extent = isl_set_intersect (extent, ubs); } } + + return extent; } /* Build data accesses for DR in PBB. */ @@ -1671,32 +1570,46 @@ pdr_add_data_dimensions (ppl_Polyhedron_t accesses, data_reference_p dr, static void build_poly_dr (data_reference_p dr, poly_bb_p pbb) { - ppl_Polyhedron_t accesses; - ppl_Pointset_Powerset_C_Polyhedron_t accesses_ps; - ppl_dimension_type dom_nb_dims; - ppl_dimension_type accessp_nb_dims; int dr_base_object_set; + isl_map *acc; + isl_set *extent; + scop_p scop = PBB_SCOP (pbb); - ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), - &dom_nb_dims); - accessp_nb_dims = dom_nb_dims + 1 + DR_NUM_DIMENSIONS (dr); + { + isl_space *dc = isl_set_get_space (pbb->domain); + int nb_out = 1 + DR_NUM_DIMENSIONS (dr); + isl_space *space = isl_space_add_dims (isl_space_from_domain (dc), + isl_dim_out, nb_out); - ppl_new_C_Polyhedron_from_space_dimension (&accesses, accessp_nb_dims, 0); + acc = isl_map_universe (space); + acc = isl_map_set_tuple_id (acc, isl_dim_out, isl_id_for_dr (scop, dr)); + } - pdr_add_alias_set (accesses, dr, accessp_nb_dims, dom_nb_dims); - pdr_add_memory_accesses (accesses, dr, accessp_nb_dims, dom_nb_dims, pbb); - pdr_add_data_dimensions (accesses, dr, accessp_nb_dims, dom_nb_dims); + acc = pdr_add_alias_set (acc, dr); + acc = pdr_add_memory_accesses (acc, dr, pbb); - ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&accesses_ps, - accesses); - ppl_delete_Polyhedron (accesses); + { + isl_id *id = isl_id_for_dr (scop, dr); + int nb = 1 + DR_NUM_DIMENSIONS (dr); + isl_space *space = isl_space_set_alloc (scop->ctx, 0, nb); + int alias_set_num = 0; + base_alias_pair *bap = (base_alias_pair *)(dr->aux); + + if (bap && bap->alias_set) + alias_set_num = *(bap->alias_set); + + space = isl_space_set_tuple_id (space, isl_dim_set, id); + extent = isl_set_nat_universe (space); + extent = isl_set_fix_si (extent, isl_dim_set, 0, alias_set_num); + extent = pdr_add_data_dimensions (extent, scop, dr); + } gcc_assert (dr->aux); dr_base_object_set = ((base_alias_pair *)(dr->aux))->base_obj_set; - new_poly_dr (pbb, dr_base_object_set, accesses_ps, + new_poly_dr (pbb, dr_base_object_set, DR_IS_READ (dr) ? PDR_READ : PDR_WRITE, - dr, DR_NUM_DIMENSIONS (dr)); + dr, DR_NUM_DIMENSIONS (dr), acc, extent); } /* Write to FILE the alias graph of data references in DIMACS format. */ @@ -2139,9 +2052,7 @@ new_pbb_from_pbb (scop_p scop, poly_bb_p pbb, basic_block bb) if (VEC_index (poly_bb_p, SCOP_BBS (scop), index) == pbb) break; - if (PBB_DOMAIN (pbb)) - ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron - (&PBB_DOMAIN (pbb1), PBB_DOMAIN (pbb)); + pbb1->domain = isl_set_copy (pbb->domain); GBB_PBB (gbb1) = pbb1; GBB_CONDITIONS (gbb1) = VEC_copy (gimple, heap, GBB_CONDITIONS (gbb)); diff --git a/gcc/graphite.c b/gcc/graphite.c index a23587674f2..04e1da29118 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -1,5 +1,6 @@ /* Gimple Represented as Polyhedra. - Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 + Free Software Foundation, Inc. Contributed by Sebastian Pop . This file is part of GCC. @@ -33,6 +34,17 @@ along with GCC; see the file COPYING3. If not see the functions that are used for transforming the code. */ #include "config.h" + +#ifdef HAVE_cloog +#include +#include +#include +#include +#include +#include +#include +#endif + #include "system.h" #include "coretypes.h" #include "diagnostic-core.h" @@ -47,8 +59,6 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_cloog -#include "ppl_c.h" -#include "graphite-ppl.h" #include "graphite-poly.h" #include "graphite-scop-detection.h" #include "graphite-clast-to-gimple.h" @@ -186,10 +196,8 @@ print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops) /* Initialize graphite: when there are no loops returns false. */ static bool -graphite_initialize (void) +graphite_initialize (isl_ctx *ctx) { - int ppl_initialized; - if (number_of_loops () <= 1 /* FIXME: This limit on the number of basic blocks of a function should be removed when the SCOP detection is faster. */ @@ -198,6 +206,7 @@ graphite_initialize (void) if (dump_file && (dump_flags & TDF_DETAILS)) print_global_statistics (dump_file); + isl_ctx_free (ctx); return false; } @@ -205,10 +214,7 @@ graphite_initialize (void) recompute_all_dominators (); initialize_original_copy_tables (); - ppl_initialized = ppl_initialize (); - gcc_assert (ppl_initialized == 0); - - cloog_state = cloog_state_malloc (); + cloog_state = cloog_isl_state_malloc (ctx); if (dump_file && dump_flags) dump_function_to_file (current_function_decl, dump_file, dump_flags); @@ -232,13 +238,14 @@ graphite_finalize (bool need_cfg_cleanup_p) } cloog_state_free (cloog_state); - ppl_finalize (); free_original_copy_tables (); if (dump_file && dump_flags) print_loops (dump_file, 3); } +isl_ctx *the_isl_ctx; + /* Perform a set of linear transforms on the loops of the current function. */ @@ -250,15 +257,19 @@ graphite_transform_loops (void) bool need_cfg_cleanup_p = false; VEC (scop_p, heap) *scops = NULL; htab_t bb_pbb_mapping; + isl_ctx *ctx; /* If a function is parallel it was most probably already run through graphite once. No need to run again. */ if (parallelized_function_p (cfun->decl)) return; - if (!graphite_initialize ()) + ctx = isl_ctx_alloc (); + isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT); + if (!graphite_initialize (ctx)) return; + the_isl_ctx = ctx; build_scops (&scops); if (dump_file && (dump_flags & TDF_DETAILS)) @@ -272,6 +283,7 @@ graphite_transform_loops (void) FOR_EACH_VEC_ELT (scop_p, scops, i, scop) if (dbg_cnt (graphite_scop)) { + scop->ctx = ctx; build_poly_scop (scop); if (POLY_SCOP_P (scop) @@ -283,6 +295,8 @@ graphite_transform_loops (void) htab_delete (bb_pbb_mapping); free_scops (scops); graphite_finalize (need_cfg_cleanup_p); + the_isl_ctx = NULL; + isl_ctx_free (ctx); } #else /* If Cloog is not available: #ifndef HAVE_cloog. */ diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 1cfd599d460..ace010430e7 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,13 @@ +2012-07-02 Richard Guenther + Michael Matz + Tobias Grosser + Sebastian Pop + + * testsuite/libgomp.graphite/force-parallel-4.c: Adjust. + * testsuite/libgomp.graphite/force-parallel-5.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-7.c: Likewise. + * testsuite/libgomp.graphite/force-parallel-8.c: Likewise. + 2012-06-28 Andreas Schwab * libgomp.texi: Include gpl_v3.texi instead of gpl.texi. diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c index c0c6b1c6e55..825bda5c439 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c @@ -47,6 +47,7 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ +/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c index b72b0215f3f..5c944dcee61 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c @@ -31,7 +31,7 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c index 0191af085ea..2fbe10a4e5c 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c @@ -2,29 +2,30 @@ int A[N+5][N+5][N+5]; -int foo(void) +void abort (void); + +int foo (void) { int i, j, k; + for (i = 0; i < N + 5; i++) + for (j = 0; j < N + 5; j++) + for (k = 0; k < N + 5; k++) + A[i][j][k] = i + j + k; + /* Loop i: carried no dependency. */ for (i = 0; i < N; i++) for (j = 0; j < N; j++) for (k = 0; k < N; k++) A[k+1][j+2][i+1] = A[k][j][i+1]; - for (i = 0; i < N; i++) - /* Loop j: carried no dependency. */ - for (j = 0; j < N; j++) - /* Loop k: carreid no dependency. */ - for (k = 0; k < N; k++) - A[i+1][j][k] = A[i][j][k+1]; - return A[1][5][2]; } -int main(void) +int main (void) { - foo(); + if (5 != foo ()) + abort (); return 0; } diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c index dc553f53f1d..f9ce9686fef 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c @@ -2,10 +2,19 @@ int x[N][N], y[N]; +void abort (void); + int foo(void) { int i, j; + for (i = 0; i < N; i++) + y[i] = i; + + for (i = 0; i < N; i++) + for (j = 0; j < N; j++) + x[i][j] = i + j; + for (i = 0; i < N; i++) { y[i] = i; @@ -27,13 +36,16 @@ int foo(void) int main(void) { - foo(); + if (168 != foo()) + abort (); return 0; } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */