cloog.m4: Set up to work against ISL only.

2012-07-02  Richard Guenther  <rguenther@suse.de>
	Michael Matz  <matz@suse.de>
	Tobias Grosser <tobias@grosser.es>
	Sebastian Pop <sebpop@gmail.com>

	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 <matz@suse.de>
Co-Authored-By: Sebastian Pop <sebpop@gmail.com>
Co-Authored-By: Tobias Grosser <tobias@grosser.es>

From-SVN: r189156
This commit is contained in:
Richard Guenther 2012-07-02 11:43:46 +00:00 committed by Richard Biener
parent 6886e4444f
commit 33ad93b9f4
33 changed files with 2752 additions and 5226 deletions

View File

@ -1,3 +1,17 @@
2012-07-02 Richard Guenther <rguenther@suse.de>
Michael Matz <matz@suse.de>
Tobias Grosser <tobias@grosser.es>
Sebastian Pop <sebpop@gmail.com>
* 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 <rguenther@suse.de>
Merge from graphite branch

View File

@ -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; };

File diff suppressed because it is too large Load Diff

View File

@ -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@

View File

@ -1,3 +1,11 @@
2012-07-02 Richard Guenther <rguenther@suse.de>
Michael Matz <matz@suse.de>
Tobias Grosser <tobias@grosser.es>
Sebastian Pop <sebpop@gmail.com>
* cloog.m4: Set up to work against ISL only.
* isl.m4: New file.
2012-05-29 Joseph Myers <joseph@codesourcery.com>
* mt-sde: Fix typos.

View File

@ -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],

404
configure vendored
View File

@ -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 <isl/version.h>
#include <string.h>
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"

View File

@ -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],

View File

@ -1,3 +1,34 @@
2012-07-02 Richard Guenther <rguenther@suse.de>
Michael Matz <matz@suse.de>
Tobias Grosser <tobias@grosser.es>
Sebastian Pop <sebpop@gmail.com>
* 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 <rguenther@suse.de>
Merge from graphite branch

View File

@ -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) \

12
gcc/configure vendored
View File

@ -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

View File

@ -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])

View File

@ -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

View File

@ -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 <sebastian.pop@amd.com> and
Pranav Garg <pranav.garg2107@gmail.com>.
@ -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
<http://www.gnu.org/licenses/>. */
#include "config.h"
#ifdef HAVE_cloog
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
#include <isl/constraint.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#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

View File

@ -19,6 +19,19 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#ifdef HAVE_cloog
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
#include <isl/list.h>
#include <isl/constraint.h>
#include <isl/ilp.h>
#include <isl/aff.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#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);

View File

@ -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. */

View File

@ -1,409 +0,0 @@
/* Gimple Represented as Polyhedra.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@inria.fr>
and Tobias Grosser <grosser@fim.uni-passau.de>.
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
<http://www.gnu.org/licenses/>. */
#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

View File

@ -1,41 +0,0 @@
/* Gimple Represented as Polyhedra.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@inria.fr>
and Tobias Grosser <grosser@fim.uni-passau.de>.
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
<http://www.gnu.org/licenses/>. */
#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 */

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
/* Graphite polyhedral representation.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Konrad Trifunovic <konrad.trifunovic@gmail.com>
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
<http://www.gnu.org/licenses/>. */
#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

View File

@ -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 <sebastian.pop@amd.com> and
Harsha Jagasia <harsha.jagasia@amd.com>.
@ -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
<http://www.gnu.org/licenses/>. */
#include "config.h"
#ifdef HAVE_cloog
#include <isl/aff.h>
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
#include <isl/ilp.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#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

File diff suppressed because it is too large Load Diff

View File

@ -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 <sebastian.pop@amd.com> and
Tobias Grosser <grosser@fim.uni-passau.de>.
@ -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

View File

@ -1,566 +0,0 @@
/* Gimple Represented as Polyhedra.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@amd.com>
and Tobias Grosser <grosser@fim.uni-passau.de>
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
<http://www.gnu.org/licenses/>. */
#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

View File

@ -1,176 +0,0 @@
/* Gimple Represented as Polyhedra.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@inria.fr>
and Tobias Grosser <grosser@fim.uni-passau.de>.
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
<http://www.gnu.org/licenses/>. */
#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

View File

@ -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 <sebastian.pop@amd.com> and
Tobias Grosser <grosser@fim.uni-passau.de>.
@ -20,6 +20,15 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#ifdef HAVE_cloog
#include <isl/set.h>
#include <isl/map.h>
#include <isl/union_map.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#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"

File diff suppressed because it is too large Load Diff

View File

@ -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 <sebastian.pop@inria.fr>.
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 <isl/set.h>
#include <isl/map.h>
#include <isl/options.h>
#include <isl/union_map.h>
#include <cloog/cloog.h>
#include <cloog/isl/domain.h>
#include <cloog/isl/cloog.h>
#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. */

View File

@ -1,3 +1,13 @@
2012-07-02 Richard Guenther <rguenther@suse.de>
Michael Matz <matz@suse.de>
Tobias Grosser <tobias@grosser.es>
Sebastian Pop <sebpop@gmail.com>
* 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 <schwab@linux-m68k.org>
* libgomp.texi: Include gpl_v3.texi instead of gpl.texi.

View File

@ -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" } } */

View File

@ -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" } } */

View File

@ -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;
}

View File

@ -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" } } */