Message ID | alpine.LNX.2.00.1206221511130.18010@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
On Fri, 22 Jun 2012, Richard Guenther wrote: > > This bumps the requirement to enable Graphite to using cloog 0.17.0 > which is the last release from upstream. The patch removes the > support for the legacy cloog versions, too. > > I am bootstrapping and testing this now with cloog 0.17.0 built > against the upstream ISL 0.10 version. > > If this ends up being approved I will put the cloog 0.17.0 tarball > in the infrastructure directory. > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu. > > Ok for trunk (for the build parts)? The patch passed bootstrap and testing on x86_64-unknown-linux-gnu. Richard. > 2012-06-22 Richard Guenther <rguenther@suse.de> > > Merge from graphite branch > 2011-07-21 Tobias Grosser <tobias@grosser.es> > > * configure: Regenerated. > * config/cloog.m4: Remove support for CLooG-ppl and CLooG-parma, > both cloog.org and legacy versions. The only supported version will > be CLooG with the isl backend. > > 2011-07-21 Tobias Grosser <tobias@grosser.es> > > * configure: Regenerated. > * configure.ac: Require cloog isl 0.17.0 > > 2011-07-21 Tobias Grosser <tobias@grosser.es> > > * configure: Regenerated. > * config/cloog.m4: Do not define CLOOG_ORG > > gcc/ > * Makefile.in (graphite-clast-to-gimple.o, graphite-cloog-util.o): > Remove graphite-cloog-util.h. > * graphite-clast-to-gimple.c (gcc_type_for_iv_of_clast_loop, > build_iv_mapping, translate_clast_user, translate_clast, > free_scattering, initialize_cloog_names, build_cloog_prog, > create_params_index): Do not use old compatibility functions. > (clast_name_to_index, set_cloog_options): Remove code for legacy cloog. > * graphite-cloog-util.c (openscop_print_cloog_matrix): Do not use old > compatibility functions. > (new_Cloog_Scattering_from_ppl_Polyhedron): Remove code for legacy > cloog. > * graphite-cloog-util.h: Remove include of graphite-cloog-util.h. > * graphite.c (graphite.c): Do not call outdated cloog_initialize() and > cloog_finalize(). > * graphite-cloog-compat.h: Remove. > > 2011-08-09 Tobias Grosser <tobias@grosser.es> > > gcc/ > * graphite-clast-to-gimple.c (new_clast_name_index): Store a copy > of the string, no just a reference. > (clast_name_index): Add a new field, that specifies if we need to free > the name. > (free_clast_name_index): If necessary, free the name string. > (clast_name_index_elt_info): Calculate the hash based on the string > content, not the memory location it is stored in. > (clast_name_to_level): Specify that we do not need to free the name. > (clast_name_to_index): Dito. > (clast_name_to_lb_ub): Dito. > (eq_clast_name_indexes): Compare the strings, not their base pointers. > (free_scattering): Removed. > (initialize_cloog_names): Renamed to add_names_to_union_domain(). > (add_names_to_union_domain): Changed to work on a union_domain, > instead of a CloogNames structure. > (build_cloog_prog): Removed. > (build_cloog_union_domain): New. > (generate_cloog_input): New. > (scop_to_clast): Use CloogInput instead of CloogProgram. > (print_generated_program): Adapt to new scop_to_clast() and do not > print the CloogProgram any more. > (create_params_index): Removed, functionality integrated in > add_names_to_union_domain(). > (gloog): Adapt to new scop_to_clast(). > * graphite-clast-to-gimple.h (scop_to_clast): Remove. > > 2012-01-11 Tobias Grosser <tobias@grosser.es> > > * graphite-clast-to-gimple.c (clast_name_to_index, > clast_name_to_lb_ub, clast_name_to_gcc): Change types. > (clast_to_gcc_expression): Add clast_expr_name as a new > case. Do not assume a clast_expr_term points always to a > clast_expr_name. > (type_for_clast_term): Do not assume a clast_expr_term points always to > a clast_expr_name. > (type_for_clast_name): New. > (type_for_clast_expr): Add clast_expr_name as a new case. > > 2011-08-03 Sebastian Pop <sebpop@gmail.com> > > * graphite-cloog-util.c (new_Cloog_Domain_from_ppl_Polyhedron, > new_Cloog_Scattering_from_ppl_Polyhedron, > new_Cloog_Domain_from_ppl_Pointset_Powerset): Remove ATTRIBUTE_UNUSED. > > > Index: configure.ac > =================================================================== > --- configure.ac (revision 188887) > +++ configure.ac (working copy) > @@ -1623,7 +1623,7 @@ if test "x$with_cloog" != "xno"; then > dnl > dnl If we use CLooG-Legacy, the provided version information is > dnl ignored. > - CLOOG_CHECK_VERSION(0,16,1) > + CLOOG_CHECK_VERSION(0,17,0) > > dnl Only execute fail-action, if CLooG has been requested. > CLOOG_IF_FAILED([ > Index: config/cloog.m4 > =================================================================== > --- config/cloog.m4 (revision 188887) > +++ config/cloog.m4 (working copy) > @@ -37,17 +37,6 @@ AC_DEFUN([CLOOG_INIT_FLAGS], > [--with-cloog-lib=PATH], > [Specify the directory for the installed CLooG library])]) > > - AC_ARG_ENABLE(cloog-backend, > - [AS_HELP_STRING( > - [--enable-cloog-backend[[=BACKEND]]], > - [set the CLooG BACKEND used to either isl, ppl or ppl-legacy (default)])], > - [ if test "x${enableval}" = "xisl"; then > - cloog_backend=isl > - elif test "x${enableval}" = "xppl"; then > - cloog_backend=ppl > - else > - cloog_backend=ppl-legacy > - fi], cloog_backend=ppl-legacy) > AC_ARG_ENABLE(cloog-version-check, > [AS_HELP_STRING( > [--disable-cloog-version-check], > @@ -107,23 +96,6 @@ m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG > [#include "cloog/cloog.h" ], > [cloog_version ()])]) > > -# _CLOOG_ORG_PROG_PPL () > -# ------------------ > -# Helper for detecting CLooG.org's PPL backend. > -m4_define([_CLOOG_ORG_PROG_PPL],[AC_LANG_PROGRAM( > - [#include "cloog/cloog.h" > - #include "cloog/ppl/cloog.h"], > - [cloog_version ()])]) > - > -# _CLOOG_PPL_LEGACY_PROG () > -# ------------------------- > -# Helper for detecting CLooG-Legacy (CLooG-PPL). > -m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM( > - [#include "cloog/cloog.h"], > - [#ifndef CLOOG_PPL_BACKEND > - choke me > - #endif ])]) > - > # CLOOG_FIND_FLAGS () > # ------------------ > # Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org. > @@ -137,56 +109,24 @@ AC_DEFUN([CLOOG_FIND_FLAGS], > _cloog_saved_LDFLAGS=$LDFLAGS > _cloog_saved_LIBS=$LIBS > > - _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG" > + _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}" > > - case $cloog_backend in > - "ppl-legacy") > - CFLAGS="${CFLAGS} ${pplinc}" > - LDFLAGS="${LDFLAGS} ${ppllibs}" > - AC_CACHE_CHECK([for installed CLooG PPL Legacy], [gcc_cv_cloog_type], > - [LIBS="-lcloog ${_cloog_saved_LIBS}" > - AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG], [gcc_cv_cloog_type="PPL Legacy"], > - [gcc_cv_cloog_type=no])]) > - ;; > - "isl") > - 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])]) > - ;; > - "ppl") > - CFLAGS="${CFLAGS} ${pplinc}" > - LDFLAGS="${LDFLAGS} ${ppllibs}" > - AC_CACHE_CHECK([for installed CLooG PPL], [gcc_cv_cloog_type], > - [LIBS="-lcloog-ppl ${_cloog_saved_LIBS}" > - AC_LINK_IFELSE([_CLOOG_ORG_PROG_PPL], [gcc_cv_cloog_type="PPL"], > - [gcc_cv_cloog_type=no])]) > - ;; > - *) > - gcc_cv_cloog_type="" > - esac > + 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 > - "PPL Legacy") > - clooginc="${clooginc}" > - clooglibs="${clooglibs} -lcloog" > - cloog_org=no > - ;; > "ISL") > clooginc="${clooginc} ${_cloogorginc}" > clooglibs="${clooglibs} -lcloog-isl -lisl" > cloog_org=yes > ;; > - "PPL") > - clooginc="${clooginc} ${_cloogorginc}" > - clooglibs="${clooglibs} -lcloog-ppl" > - cloog_org=yes > - ;; > *) > clooglibs= > clooginc= > @@ -212,25 +152,10 @@ m4_define([_CLOOG_CHECK_CT_PROG],[AC_LAN > choke me > #endif])]) > > -# _CLOOG_CHECK_RT_PROG () > -# ----------------------- > -# Helper for verifying that CLooG's compile time version > -# matches the run time version. > -m4_define([_CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM( > - [#include "cloog/cloog.h"], > - [if ((cloog_version_major () != CLOOG_VERSION_MAJOR) > - && (cloog_version_minor () != CLOOG_VERSION_MINOR) > - && (cloog_version_revision () != CLOOG_VERSION_REVISION)) > - { > - return 1; > - }])]) > - > # CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION) > # ---------------------------------------------------------------- > # Test the found CLooG to be exact of version MAJOR.MINOR and at least > # REVISION. > -# If we're using the old CLooG-PPL (Legacy), the old version check will > -# be executed (Ignores the provided version information). > AC_DEFUN([CLOOG_CHECK_VERSION], > [ > AC_REQUIRE([CLOOG_FIND_FLAGS]) > @@ -242,21 +167,11 @@ AC_DEFUN([CLOOG_CHECK_VERSION], > CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" > LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}" > > - if test "${cloog_org}" = yes ; then > - AC_CACHE_CHECK([for version $1.$2.$3 of CLooG], > - [gcc_cv_cloog_ct_0_14_0], > - [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)], > - [gcc_cv_cloog_ct_0_14_0=yes], > - [gcc_cv_cloog_ct_0_14_0=no])]) > - elif test "${cloog_org}" = no ; then > - AC_CACHE_CHECK([for version 0.15.5 (or later revision) of CLooG], > - [gcc_cv_cloog_ct_0_15_5], > - [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,5)], > - [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,9)], > - [gcc_cv_cloog_ct_0_15_5=yes], > - [gcc_cv_cloog_ct_0_15_5="buggy but acceptable"])], > - [gcc_cv_cloog_ct_0_15_5=no])]) > - fi > + AC_CACHE_CHECK([for version $1.$2.$3 of CLooG], > + [gcc_cv_cloog], > + [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)], > + [gcc_cv_cloog=yes], > + [gcc_cv_cloog=no])]) > > CFLAGS=$_cloog_saved_CFLAGS > LDFLAGS=$_cloog_saved_LDFLAGS > @@ -272,9 +187,7 @@ AC_DEFUN([CLOOG_IF_FAILED], > [ > CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) > > - if test "${gcc_cv_cloog_ct_0_14_0}" = no \ > - || test "${gcc_cv_cloog_rt_0_14_0}" = no \ > - || test "${gcc_cv_cloog_ct_0_15_5}" = no; then > + if test "${gcc_cv_cloog}" = no ; then > clooglibs= > clooginc= > fi > Index: configure > =================================================================== > --- configure (revision 188887) > +++ configure (working copy) > @@ -777,7 +777,6 @@ enable_ppl_version_check > with_cloog > with_cloog_include > with_cloog_lib > -enable_cloog_backend > enable_cloog_version_check > enable_lto > enable_stage1_languages > @@ -1476,9 +1475,6 @@ Optional Features: > build stages 2 and 3 with C++, not C > --disable-ppl-version-check > disable check for PPL version > - --enable-cloog-backend[=BACKEND] > - set the CLooG BACKEND used to either isl, ppl or > - ppl-legacy (default) > --disable-cloog-version-check > disable check for CLooG version > --enable-lto enable link time optimization support > @@ -5757,19 +5753,6 @@ if test "${with_cloog_lib+set}" = set; t > fi > > > - # Check whether --enable-cloog-backend was given. > -if test "${enable_cloog_backend+set}" = set; then : > - enableval=$enable_cloog_backend; if test "x${enableval}" = "xisl"; then > - cloog_backend=isl > - elif test "x${enableval}" = "xppl"; then > - cloog_backend=ppl > - else > - cloog_backend=ppl-legacy > - fi > -else > - cloog_backend=ppl-legacy > -fi > - > # Check whether --enable-cloog-version-check was given. > if test "${enable_cloog_version_check+set}" = set; then : > enableval=$enable_cloog_version_check; ENABLE_CLOOG_CHECK=$enableval > @@ -5836,54 +5819,19 @@ if test "x$with_cloog" != "xno"; then > _cloog_saved_LDFLAGS=$LDFLAGS > _cloog_saved_LIBS=$LIBS > > - _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG" > + _cloogorginc="-DCLOOG_INT_GMP" > > CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}" > CPPFLAGS="${CPPFLAGS} ${_cloogorginc}" > LDFLAGS="${LDFLAGS} ${clooglibs}" > > - case $cloog_backend in > - "ppl-legacy") > - CFLAGS="${CFLAGS} ${pplinc}" > - LDFLAGS="${LDFLAGS} ${ppllibs}" > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG PPL Legacy" >&5 > -$as_echo_n "checking for installed CLooG PPL Legacy... " >&6; } > -if test "${gcc_cv_cloog_type+set}" = set; then : > - $as_echo_n "(cached) " >&6 > -else > - LIBS="-lcloog ${_cloog_saved_LIBS}" > - cat confdefs.h - <<_ACEOF >conftest.$ac_ext > -/* end confdefs.h. */ > -#include "cloog/cloog.h" > -int > -main () > -{ > -#ifndef CLOOG_PPL_BACKEND > - choke me > - #endif > - ; > - return 0; > -} > -_ACEOF > -if ac_fn_c_try_link "$LINENO"; then : > - gcc_cv_cloog_type="PPL Legacy" > -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; } > - ;; > - "isl") > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG ISL" >&5 > + { $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 > + cat confdefs.h - <<_ACEOF >conftest.$ac_ext > /* end confdefs.h. */ > #include "cloog/cloog.h" > int > @@ -5904,59 +5852,13 @@ rm -f core conftest.err conftest.$ac_obj > fi > { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5 > $as_echo "$gcc_cv_cloog_type" >&6; } > - ;; > - "ppl") > - CFLAGS="${CFLAGS} ${pplinc}" > - LDFLAGS="${LDFLAGS} ${ppllibs}" > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG PPL" >&5 > -$as_echo_n "checking for installed CLooG PPL... " >&6; } > -if test "${gcc_cv_cloog_type+set}" = set; then : > - $as_echo_n "(cached) " >&6 > -else > - LIBS="-lcloog-ppl ${_cloog_saved_LIBS}" > - cat confdefs.h - <<_ACEOF >conftest.$ac_ext > -/* end confdefs.h. */ > -#include "cloog/cloog.h" > - #include "cloog/ppl/cloog.h" > -int > -main () > -{ > -cloog_version () > - ; > - return 0; > -} > -_ACEOF > -if ac_fn_c_try_link "$LINENO"; then : > - gcc_cv_cloog_type="PPL" > -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; } > - ;; > - *) > - gcc_cv_cloog_type="" > - esac > > case $gcc_cv_cloog_type in > - "PPL Legacy") > - clooginc="${clooginc}" > - clooglibs="${clooglibs} -lcloog" > - cloog_org=no > - ;; > "ISL") > clooginc="${clooginc} ${_cloogorginc}" > clooglibs="${clooglibs} -lcloog-isl -lisl" > cloog_org=yes > ;; > - "PPL") > - clooginc="${clooginc} ${_cloogorginc}" > - clooglibs="${clooglibs} -lcloog-ppl" > - cloog_org=yes > - ;; > *) > clooglibs= > clooginc= > @@ -5980,40 +5882,9 @@ $as_echo "$gcc_cv_cloog_type" >&6; } > CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" > LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}" > > - if test "${cloog_org}" = yes ; then > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.16.1 of CLooG" >&5 > -$as_echo_n "checking for version 0.16.1 of CLooG... " >&6; } > -if test "${gcc_cv_cloog_ct_0_14_0+set}" = set; then : > - $as_echo_n "(cached) " >&6 > -else > - cat confdefs.h - <<_ACEOF >conftest.$ac_ext > -/* end confdefs.h. */ > -#include "cloog/cloog.h" > -int > -main () > -{ > -#if CLOOG_VERSION_MAJOR != 0 \ > - || CLOOG_VERSION_MINOR != 16 \ > - || CLOOG_VERSION_REVISION < 1 > - choke me > - #endif > - ; > - return 0; > -} > -_ACEOF > -if ac_fn_c_try_compile "$LINENO"; then : > - gcc_cv_cloog_ct_0_14_0=yes > -else > - gcc_cv_cloog_ct_0_14_0=no > -fi > -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > -fi > -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_ct_0_14_0" >&5 > -$as_echo "$gcc_cv_cloog_ct_0_14_0" >&6; } > - elif test "${cloog_org}" = no ; then > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.15.5 (or later revision) of CLooG" >&5 > -$as_echo_n "checking for version 0.15.5 (or later revision) of CLooG... " >&6; } > -if test "${gcc_cv_cloog_ct_0_15_5+set}" = set; then : > + { $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; } > +if test "${gcc_cv_cloog+set}" = set; then : > $as_echo_n "(cached) " >&6 > else > cat confdefs.h - <<_ACEOF >conftest.$ac_ext > @@ -6023,8 +5894,8 @@ int > main () > { > #if CLOOG_VERSION_MAJOR != 0 \ > - || CLOOG_VERSION_MINOR != 15 \ > - || CLOOG_VERSION_REVISION < 5 > + || CLOOG_VERSION_MINOR != 17 \ > + || CLOOG_VERSION_REVISION < 0 > choke me > #endif > ; > @@ -6032,35 +5903,14 @@ main () > } > _ACEOF > if ac_fn_c_try_compile "$LINENO"; then : > - cat confdefs.h - <<_ACEOF >conftest.$ac_ext > -/* end confdefs.h. */ > -#include "cloog/cloog.h" > -int > -main () > -{ > -#if CLOOG_VERSION_MAJOR != 0 \ > - || CLOOG_VERSION_MINOR != 15 \ > - || CLOOG_VERSION_REVISION < 9 > - choke me > - #endif > - ; > - return 0; > -} > -_ACEOF > -if ac_fn_c_try_compile "$LINENO"; then : > - gcc_cv_cloog_ct_0_15_5=yes > -else > - gcc_cv_cloog_ct_0_15_5="buggy but acceptable" > -fi > -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > + gcc_cv_cloog=yes > else > - gcc_cv_cloog_ct_0_15_5=no > + gcc_cv_cloog=no > fi > rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext > fi > -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_ct_0_15_5" >&5 > -$as_echo "$gcc_cv_cloog_ct_0_15_5" >&6; } > - fi > +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog" >&5 > +$as_echo "$gcc_cv_cloog" >&6; } > > CFLAGS=$_cloog_saved_CFLAGS > LDFLAGS=$_cloog_saved_LDFLAGS > @@ -6084,9 +5934,7 @@ $as_echo "$gcc_cv_cloog_ct_0_15_5" >&6; > > > > - if test "${gcc_cv_cloog_ct_0_14_0}" = no \ > - || test "${gcc_cv_cloog_rt_0_14_0}" = no \ > - || test "${gcc_cv_cloog_ct_0_15_5}" = no; then > + if test "${gcc_cv_cloog}" = no ; then > clooglibs= > clooginc= > fi > Index: gcc/doc/install.texi > =================================================================== > --- gcc/doc/install.texi (revision 188887) > +++ gcc/doc/install.texi (working copy) > @@ -370,23 +370,12 @@ It can be downloaded from @uref{http://w > The @option{--with-ppl} configure option should be used if PPL is not > installed in your default library search path. > > -@item CLooG-PPL version 0.15 or CLooG 0.16 > +@item CLooG 0.17.0 > > -Necessary to build GCC with the Graphite loop optimizations. There > -are two versions available. CLooG-PPL 0.15 as well as CLooG 0.16. > -The former is the default right now. It can be downloaded from > -@uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as > -@file{cloog-ppl-0.15.tar.gz}. > - > -CLooG 0.16 support is still in testing stage, but will be the > -default in future GCC releases. It is also available at > -@uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as > -@file{cloog-0.16.1.tar.gz}. To use it add the additional configure > -option @option{--enable-cloog-backend=isl}. Even if CLooG 0.16 > -does not use PPL, PPL is still required for Graphite. > - > -In both cases @option{--with-cloog} configure option should be used > -if CLooG is not installed in your default library search path. > +Necessary to build GCC with the Graphite loop optimizations. It can be > +downloaded from @uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as > +@file{cloog-0.17.0.tar.gz}. The @option{--with-cloog} configure option should > +be used if CLooG is not installed in your default library search path. > > @end table > > Index: gcc/graphite-cloog-util.c > =================================================================== > --- gcc/graphite-cloog-util.c (revision 188887) > +++ gcc/graphite-cloog-util.c (working copy) > @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. > #include "ppl_c.h" > #include "cloog/cloog.h" > #include "graphite-cloog-util.h" > -#include "graphite-cloog-compat.h" > > /* Counts the number of constraints in PCS. */ > > @@ -237,7 +236,7 @@ new_C_Polyhedron_from_Cloog_Matrix (ppl_ > > CloogDomain * > new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, int nb_params, > - CloogState *state ATTRIBUTE_UNUSED) > + CloogState *state) > { > CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); > CloogDomain *res = cloog_domain_from_cloog_matrix (state, mat, nb_params); > @@ -249,11 +248,10 @@ new_Cloog_Domain_from_ppl_Polyhedron (pp > > CloogScattering * > new_Cloog_Scattering_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, > - int nb_params ATTRIBUTE_UNUSED, > - int nb_scatt ATTRIBUTE_UNUSED, > - CloogState *state ATTRIBUTE_UNUSED) > + int nb_params, > + int nb_scatt, > + CloogState *state) > { > -#ifdef CLOOG_ORG > CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); > CloogScattering *res = cloog_scattering_from_cloog_matrix (state, mat, > nb_scatt, > @@ -261,9 +259,6 @@ new_Cloog_Scattering_from_ppl_Polyhedron > > cloog_matrix_free (mat); > return res; > -#else > - return new_Cloog_Domain_from_ppl_Polyhedron (ph, nb_params, state); > -#endif > } > > /* Creates a CloogDomain from a pointset powerset PS. */ > @@ -271,7 +266,7 @@ new_Cloog_Scattering_from_ppl_Polyhedron > CloogDomain * > new_Cloog_Domain_from_ppl_Pointset_Powerset > (ppl_Pointset_Powerset_C_Polyhedron_t ps, int nb_params, > - CloogState *state ATTRIBUTE_UNUSED) > + CloogState *state) > { > CloogDomain *res = NULL; > ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; > @@ -314,14 +309,14 @@ openscop_print_cloog_matrix (FILE *file, > int output, int input, int locals, > int params) > { > - int i, j; > + unsigned i, j; > > - fprintf (file, "%d %d %d %d %d %d \n", cloog_matrix_nrows (mat), > - cloog_matrix_ncolumns (mat), output, input, locals, params); > + fprintf (file, "%d %d %d %d %d %d \n", mat->NbRows, > + mat->NbColumns, output, input, locals, params); > > - for (i = 0; i < cloog_matrix_nrows (mat); i++) > + for (i = 0; i < mat->NbRows; i++) > { > - for (j = 0; j < cloog_matrix_ncolumns (mat); j++) > + for (j = 0; j < mat->NbColumns; j++) > if (j == 0) > fprintf (file, "%ld ", mpz_get_si (mat->p[i][j])); > else > Index: gcc/graphite-cloog-util.h > =================================================================== > --- gcc/graphite-cloog-util.h (revision 188887) > +++ gcc/graphite-cloog-util.h (working copy) > @@ -22,7 +22,6 @@ along with GCC; see the file COPYING3. > #define GRAPHITE_CLOOG_UTIL_H > > #include "cloog/cloog.h" > -#include "graphite-cloog-compat.h" > > CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t); > CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t, > Index: gcc/graphite.c > =================================================================== > --- gcc/graphite.c (revision 188887) > +++ gcc/graphite.c (working copy) > @@ -209,7 +209,6 @@ graphite_initialize (void) > gcc_assert (ppl_initialized == 0); > > cloog_state = cloog_state_malloc (); > - cloog_initialize (); > > if (dump_file && dump_flags) > dump_function_to_file (current_function_decl, dump_file, dump_flags); > @@ -233,7 +232,6 @@ graphite_finalize (bool need_cfg_cleanup > } > > cloog_state_free (cloog_state); > - cloog_finalize (); > ppl_finalize (); > free_original_copy_tables (); > > Index: gcc/graphite-clast-to-gimple.c > =================================================================== > --- gcc/graphite-clast-to-gimple.c (revision 188887) > +++ gcc/graphite-clast-to-gimple.c (working copy) > @@ -38,7 +38,8 @@ along with GCC; see the file COPYING3. > #include "graphite-poly.h" > #include "graphite-clast-to-gimple.h" > #include "graphite-dependences.h" > -#include "graphite-cloog-compat.h" > + > +typedef const struct clast_expr *clast_name_p; > > #ifndef CLOOG_LANGUAGE_C > #define CLOOG_LANGUAGE_C LANGUAGE_C > @@ -68,6 +69,9 @@ typedef struct clast_name_index { > int level; > mpz_t bound_one, bound_two; > const char *name; > + /* If free_name is set, the content of name was allocated by us and needs > + to be freed. */ > + char *free_name; > } *clast_name_index_p; > > /* Returns a pointer to a new element of type clast_name_index_p built > @@ -78,8 +82,11 @@ new_clast_name_index (const char *name, > mpz_t bound_one, mpz_t bound_two) > { > clast_name_index_p res = XNEW (struct clast_name_index); > + char *new_name = XNEWVEC (char, strlen (name) + 1); > + strcpy (new_name, name); > > - res->name = name; > + res->name = new_name; > + res->free_name = new_name; > res->level = level; > res->index = index; > mpz_init (res->bound_one); > @@ -95,6 +102,8 @@ static void > free_clast_name_index (void *ptr) > { > struct clast_name_index *c = (struct clast_name_index *) ptr; > + if (c->free_name) > + free (c->free_name); > mpz_clear (c->bound_one); > mpz_clear (c->bound_two); > free (ptr); > @@ -111,12 +120,9 @@ clast_name_to_level (clast_name_p name, > struct clast_name_index tmp; > PTR *slot; > > -#ifdef CLOOG_ORG > gcc_assert (name->type == clast_expr_name); > tmp.name = ((const struct clast_name *) name)->name; > -#else > - tmp.name = name; > -#endif > + tmp.free_name = NULL; > > slot = htab_find_slot (index_table, &tmp, NO_INSERT); > > @@ -131,17 +137,13 @@ clast_name_to_level (clast_name_p name, > SCATTERING_DIMENSIONS vector. */ > > static inline int > -clast_name_to_index (clast_name_p name, htab_t index_table) > +clast_name_to_index (struct clast_name *name, htab_t index_table) > { > struct clast_name_index tmp; > PTR *slot; > > -#ifdef CLOOG_ORG > - gcc_assert (name->type == clast_expr_name); > tmp.name = ((const struct clast_name *) name)->name; > -#else > - tmp.name = name; > -#endif > + tmp.free_name = NULL; > > slot = htab_find_slot (index_table, &tmp, NO_INSERT); > > @@ -156,18 +158,14 @@ clast_name_to_index (clast_name_p name, > found in the INDEX_TABLE, false otherwise. */ > > static inline bool > -clast_name_to_lb_ub (clast_name_p name, htab_t index_table, mpz_t bound_one, > - mpz_t bound_two) > +clast_name_to_lb_ub (struct clast_name *name, htab_t index_table, > + mpz_t bound_one, mpz_t bound_two) > { > struct clast_name_index tmp; > PTR *slot; > > -#ifdef CLOOG_ORG > - gcc_assert (name->type == clast_expr_name); > - tmp.name = ((const struct clast_name *) name)->name; > -#else > - tmp.name = name; > -#endif > + tmp.name = name->name; > + tmp.free_name = NULL; > > slot = htab_find_slot (index_table, &tmp, NO_INSERT); > > @@ -191,6 +189,7 @@ save_clast_name_index (htab_t index_tabl > PTR *slot; > > tmp.name = name; > + tmp.free_name = NULL; > slot = htab_find_slot (index_table, &tmp, INSERT); > > if (slot) > @@ -206,7 +205,16 @@ save_clast_name_index (htab_t index_tabl > static inline hashval_t > clast_name_index_elt_info (const void *elt) > { > - return htab_hash_pointer (((const struct clast_name_index *) elt)->name); > + const struct clast_name_index *e = ((const struct clast_name_index *) elt); > + hashval_t hash = 0; > + > + int length = strlen (e->name); > + int i; > + > + for (i = 0; i < length; ++i) > + hash = hash | (e->name[i] << (i % 4)); > + > + return hash; > } > > /* Compares database elements E1 and E2. */ > @@ -217,7 +225,7 @@ eq_clast_name_indexes (const void *e1, c > const struct clast_name_index *elt1 = (const struct clast_name_index *) e1; > const struct clast_name_index *elt2 = (const struct clast_name_index *) e2; > > - return (elt1->name == elt2->name); > + return strcmp (elt1->name, elt2->name) == 0; > } > > > @@ -238,7 +246,7 @@ typedef struct ivs_params { > Cloog representation. */ > > static tree > -clast_name_to_gcc (clast_name_p name, ivs_params_p ip) > +clast_name_to_gcc (struct clast_name *name, ivs_params_p ip) > { > int index; > > @@ -334,6 +342,10 @@ clast_to_gcc_expression (tree type, stru > { > switch (e->type) > { > + case clast_expr_name: > + { > + return clast_name_to_gcc ((struct clast_name *) e, ip); > + } > case clast_expr_term: > { > struct clast_term *t = (struct clast_term *) e; > @@ -342,7 +354,7 @@ clast_to_gcc_expression (tree type, stru > { > if (mpz_cmp_si (t->val, 1) == 0) > { > - tree name = clast_name_to_gcc (t->var, ip); > + tree name = clast_to_gcc_expression (type, t->var, ip); > > if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type)) > name = convert_to_ptrofftype (name); > @@ -353,7 +365,7 @@ clast_to_gcc_expression (tree type, stru > > else if (mpz_cmp_si (t->val, -1) == 0) > { > - tree name = clast_name_to_gcc (t->var, ip); > + tree name = clast_to_gcc_expression (type, t->var, ip); > > if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type)) > name = convert_to_ptrofftype (name); > @@ -364,7 +376,7 @@ clast_to_gcc_expression (tree type, stru > } > else > { > - tree name = clast_name_to_gcc (t->var, ip); > + tree name = clast_to_gcc_expression (type, t->var, ip); > tree cst = gmp_cst_to_tree (type, t->val); > > if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type)) > @@ -493,6 +505,9 @@ type_for_value (mpz_t val) > return type_for_interval (val, val); > } > > +static tree > +type_for_clast_expr (struct clast_expr *, ivs_params_p, mpz_t, mpz_t); > + > /* Return the type for the clast_term T. Initializes BOUND_ONE and > BOUND_TWO to the bounds of the term. */ > > @@ -500,38 +515,24 @@ static tree > type_for_clast_term (struct clast_term *t, ivs_params_p ip, mpz_t bound_one, > mpz_t bound_two) > { > - clast_name_p name = t->var; > - bool found = false; > - > + tree type; > gcc_assert (t->expr.type == clast_expr_term); > > - if (!name) > + if (!t->var) > { > mpz_set (bound_one, t->val); > mpz_set (bound_two, t->val); > return type_for_value (t->val); > } > > - if (ip->params && ip->params_index) > - found = clast_name_to_lb_ub (name, ip->params_index, bound_one, bound_two); > - > - if (!found) > - { > - gcc_assert (*(ip->newivs) && ip->newivs_index); > - found = clast_name_to_lb_ub (name, ip->newivs_index, > - bound_one, bound_two); > - gcc_assert (found); > - } > + type = type_for_clast_expr (t->var, ip, bound_one, bound_two); > > mpz_mul (bound_one, bound_one, t->val); > mpz_mul (bound_two, bound_two, t->val); > > - return TREE_TYPE (clast_name_to_gcc (name, ip)); > + return max_precision_type (type, type_for_interval (bound_one, bound_two)); > } > > -static tree > -type_for_clast_expr (struct clast_expr *, ivs_params_p, mpz_t, mpz_t); > - > /* Return the type for the clast_reduction R. Initializes BOUND_ONE > and BOUND_TWO to the bounds of the reduction expression. */ > > @@ -639,6 +640,29 @@ type_for_clast_bin (struct clast_binary > return max_precision_type (type, type_for_interval (bound_one, bound_two)); > } > > +/* Return the type for the clast_name NAME. Initializes BOUND_ONE and > + BOUND_TWO to the bounds of the term. */ > + > +static tree > +type_for_clast_name (struct clast_name *name, ivs_params_p ip, mpz_t bound_one, > + mpz_t bound_two) > +{ > + bool found = false; > + > + if (ip->params && ip->params_index) > + found = clast_name_to_lb_ub (name, ip->params_index, bound_one, bound_two); > + > + if (!found) > + { > + gcc_assert (*(ip->newivs) && ip->newivs_index); > + found = clast_name_to_lb_ub (name, ip->newivs_index, bound_one, > + bound_two); > + gcc_assert (found); > + } > + > + return TREE_TYPE (clast_name_to_gcc (name, ip)); > +} > + > /* Returns the type for the CLAST expression E when used in statement > STMT. */ > > @@ -660,6 +684,10 @@ type_for_clast_expr (struct clast_expr * > return type_for_clast_bin ((struct clast_binary *) e, ip, > bound_one, bound_two); > > + case clast_expr_name: > + return type_for_clast_name ((struct clast_name *) e, ip, > + bound_one, bound_two); > + > default: > gcc_unreachable (); > } > @@ -869,7 +897,7 @@ graphite_create_new_loop (edge entry_edg > > struct clast_user_stmt *body > = clast_get_body_of_loop ((struct clast_stmt *) stmt); > - poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (body->statement); > + 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"); > @@ -901,7 +929,7 @@ build_iv_mapping (VEC (tree, heap) *iv_m > struct clast_stmt *t; > int depth = 0; > CloogStatement *cs = user_stmt->statement; > - poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs); > + poly_bb_p pbb = (poly_bb_p) cs->usr; > gimple_bb_p gbb = PBB_BLACK_BOX (pbb); > mpz_t bound_one, bound_two; > > @@ -1018,7 +1046,7 @@ translate_clast_user (struct clast_user_ > { > int i, nb_loops; > basic_block new_bb; > - poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (stmt->statement); > + poly_bb_p pbb = (poly_bb_p) stmt->statement->usr; > gimple_bb_p gbb = PBB_BLACK_BOX (pbb); > VEC (tree, heap) *iv_map; > > @@ -1240,81 +1268,69 @@ translate_clast (loop_p context_loop, st > level, ip); > } > > -/* Free the SCATTERING domain list. */ > +/* Add parameter and iterator names to the CloogUnionDomain. */ > > -static void > -free_scattering (CloogScatteringList *scattering) > -{ > - while (scattering) > - { > - CloogScattering *dom = cloog_scattering (scattering); > - CloogScatteringList *next = cloog_next_scattering (scattering); > - > - cloog_scattering_free (dom); > - free (scattering); > - scattering = next; > - } > -} > - > -/* Initialize Cloog's parameter names from the names used in GIMPLE. > - Initialize Cloog's iterator names, using 'graphite_iterator_%d' > - from 0 to scop_nb_loops (scop). */ > - > -static void > -initialize_cloog_names (scop_p scop, CloogProgram *prog) > +static CloogUnionDomain * > +add_names_to_union_domain (scop_p scop, CloogUnionDomain *union_domain, > + int nb_scattering_dims, htab_t params_index) > { > sese region = SCOP_REGION (scop); > int i; > int nb_iterators = scop_max_loop_depth (scop); > - int nb_scattering = cloog_program_nb_scattdims (prog); > int nb_parameters = VEC_length (tree, SESE_PARAMS (region)); > - char **iterators = XNEWVEC (char *, nb_iterators * 2); > - char **scattering = XNEWVEC (char *, nb_scattering); > - char **parameters= XNEWVEC (char *, nb_parameters); > + mpz_t bound_one, bound_two; > > - cloog_program_set_names (prog, cloog_names_malloc ()); > + mpz_init (bound_one); > + mpz_init (bound_two); > > for (i = 0; i < nb_parameters; i++) > { > tree param = VEC_index (tree, SESE_PARAMS (region), i); > const char *name = get_name (param); > int len; > + char *parameter; > > if (!name) > name = "T"; > > len = strlen (name); > len += 17; > - parameters[i] = XNEWVEC (char, len + 1); > - snprintf (parameters[i], len, "%s_%d", name, SSA_NAME_VERSION (param)); > + parameter = XNEWVEC (char, len + 1); > + snprintf (parameter, len, "%s_%d", name, SSA_NAME_VERSION (param)); > + save_clast_name_index (params_index, parameter, i, i, bound_one, > + bound_two); > + union_domain = cloog_union_domain_set_name (union_domain, CLOOG_PARAM, i, > + parameter); > + compute_bounds_for_param (scop, i, bound_one, bound_two); > + free (parameter); > } > > - cloog_names_set_nb_parameters (cloog_program_names (prog), nb_parameters); > - cloog_names_set_parameters (cloog_program_names (prog), parameters); > + mpz_clear (bound_one); > + mpz_clear (bound_two); > > for (i = 0; i < nb_iterators; i++) > { > int len = 4 + 16; > - iterators[i] = XNEWVEC (char, len); > - snprintf (iterators[i], len, "git_%d", i); > + char *iterator; > + iterator = XNEWVEC (char, len); > + snprintf (iterator, len, "git_%d", i); > + union_domain = cloog_union_domain_set_name (union_domain, CLOOG_ITER, i, > + iterator); > + free (iterator); > } > > - cloog_names_set_nb_iterators (cloog_program_names (prog), > - nb_iterators); > - cloog_names_set_iterators (cloog_program_names (prog), > - iterators); > - > - for (i = 0; i < nb_scattering; i++) > + for (i = 0; i < nb_scattering_dims; i++) > { > int len = 5 + 16; > - scattering[i] = XNEWVEC (char, len); > - snprintf (scattering[i], len, "scat_%d", i); > + char *scattering; > + scattering = XNEWVEC (char, len); > + snprintf (scattering, len, "scat_%d", i); > + union_domain = cloog_union_domain_set_name (union_domain, CLOOG_SCAT, i, > + scattering); > + free (scattering); > } > > - cloog_names_set_nb_scattering (cloog_program_names (prog), > - nb_scattering); > - cloog_names_set_scattering (cloog_program_names (prog), > - scattering); > + return union_domain; > } > > /* Initialize a CLooG input file. */ > @@ -1342,129 +1358,40 @@ init_cloog_input_file (int scop_number) > return graphite_out_file; > } > > -/* Build cloog program for SCoP. */ > +/* Build cloog union domain for SCoP. */ > > -static void > -build_cloog_prog (scop_p scop, CloogProgram *prog, > - CloogOptions *options) > +static CloogUnionDomain * > +build_cloog_union_domain (scop_p scop) > { > int i; > - int max_nb_loops = scop_max_loop_depth (scop); > poly_bb_p pbb; > - CloogLoop *loop_list = NULL; > - CloogBlockList *block_list = NULL; > - CloogScatteringList *scattering = NULL; > - int nbs = 2 * max_nb_loops + 1; > - int *scaldims; > - > - cloog_program_set_context > - (prog, new_Cloog_Domain_from_ppl_Pointset_Powerset (SCOP_CONTEXT (scop), > - scop_nb_params (scop), cloog_state)); > - nbs = unify_scattering_dimensions (scop); > - scaldims = (int *) xmalloc (nbs * (sizeof (int))); > - cloog_program_set_nb_scattdims (prog, nbs); > - initialize_cloog_names (scop, prog); > + > + CloogUnionDomain *union_domain = > + cloog_union_domain_alloc (scop_nb_params (scop)); > > FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) > { > - CloogStatement *stmt; > - CloogBlock *block; > - CloogDomain *dom; > + CloogDomain *domain; > + CloogScattering *scattering; > > /* 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))) > continue; > > - /* Build the new statement and its block. */ > - stmt = cloog_statement_alloc (cloog_state, pbb_index (pbb)); > - dom = new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb), > - scop_nb_params (scop), > - cloog_state); > - block = cloog_block_alloc (stmt, 0, NULL, pbb_dim_iter_domain (pbb)); > - cloog_statement_set_usr (stmt, pbb); > - > - /* Build loop list. */ > - { > - CloogLoop *new_loop_list = cloog_loop_malloc (cloog_state); > - cloog_loop_set_next (new_loop_list, loop_list); > - cloog_loop_set_domain (new_loop_list, dom); > - cloog_loop_set_block (new_loop_list, block); > - loop_list = new_loop_list; > - } > - > - /* Build block list. */ > - { > - CloogBlockList *new_block_list = cloog_block_list_malloc (); > + domain = new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb), > + scop_nb_params (scop), > + cloog_state); > > - cloog_block_list_set_next (new_block_list, block_list); > - cloog_block_list_set_block (new_block_list, block); > - block_list = new_block_list; > - } > + scattering = new_Cloog_Scattering_from_ppl_Polyhedron > + (PBB_TRANSFORMED_SCATTERING (pbb), scop_nb_params (scop), > + pbb_nb_scattering_transform (pbb), cloog_state); > > - /* Build scattering list. */ > - { > - /* XXX: Replace with cloog_domain_list_alloc(), when available. */ > - CloogScatteringList *new_scattering > - = (CloogScatteringList *) xmalloc (sizeof (CloogScatteringList)); > - ppl_Polyhedron_t scat; > - CloogScattering *dom; > - > - scat = PBB_TRANSFORMED_SCATTERING (pbb); > - dom = new_Cloog_Scattering_from_ppl_Polyhedron > - (scat, scop_nb_params (scop), pbb_nb_scattering_transform (pbb), > - cloog_state); > - > - cloog_set_next_scattering (new_scattering, scattering); > - cloog_set_scattering (new_scattering, dom); > - scattering = new_scattering; > - } > + union_domain = cloog_union_domain_add_domain (union_domain, "", domain, > + scattering, pbb); > } > > - cloog_program_set_loop (prog, loop_list); > - cloog_program_set_blocklist (prog, block_list); > - > - for (i = 0; i < nbs; i++) > - scaldims[i] = 0 ; > - > - cloog_program_set_scaldims (prog, scaldims); > - > - /* Extract scalar dimensions to simplify the code generation problem. */ > - cloog_program_extract_scalars (prog, scattering, options); > - > - /* Dump a .cloog input file, if requested. This feature is only > - enabled in the Graphite branch. */ > - if (0) > - { > - static size_t file_scop_number = 0; > - FILE *cloog_file = init_cloog_input_file (file_scop_number); > - > - cloog_program_dump_cloog (cloog_file, prog, scattering); > - ++file_scop_number; > - } > - > - /* Apply scattering. */ > - cloog_program_scatter (prog, scattering, options); > - free_scattering (scattering); > - > - /* Iterators corresponding to scalar dimensions have to be extracted. */ > - cloog_names_scalarize (cloog_program_names (prog), nbs, > - cloog_program_scaldims (prog)); > - > - /* Free blocklist. */ > - { > - CloogBlockList *next = cloog_program_blocklist (prog); > - > - while (next) > - { > - CloogBlockList *toDelete = next; > - next = cloog_block_list_next (next); > - cloog_block_list_set_next (toDelete, NULL); > - cloog_block_list_set_block (toDelete, NULL); > - cloog_block_list_free (toDelete); > - } > - cloog_program_set_blocklist (prog, NULL); > - } > + return union_domain; > } > > /* Return the options that will be used in GLOOG. */ > @@ -1485,14 +1412,8 @@ set_cloog_options (void) > GLooG. */ > options->esp = 1; > > -#ifdef CLOOG_ORG > /* Silence CLooG to avoid failing tests due to debug output to stderr. */ > options->quiet = 1; > -#else > - /* Enable C pretty-printing mode: normalizes the substitution > - equations for statements. */ > - options->cpp = 1; > -#endif > > /* Allow cloog to build strides with a stride width different to one. > This example has stride = 4: > @@ -1535,24 +1456,52 @@ debug_clast_stmt (struct clast_stmt *stm > print_clast_stmt (stderr, stmt); > } > > +static CloogInput * > +generate_cloog_input (scop_p scop, htab_t params_index) > +{ > + CloogUnionDomain *union_domain; > + CloogInput *cloog_input; > + CloogDomain *context; > + > + int nb_scattering_dims = unify_scattering_dimensions (scop); > + union_domain = build_cloog_union_domain (scop); > + 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); > + > + cloog_input = cloog_input_alloc (context, union_domain); > + > + return cloog_input; > +} > + > /* Translate SCOP to a CLooG program and clast. These two > representations should be freed together: a clast cannot be used > without a program. */ > > -cloog_prog_clast > -scop_to_clast (scop_p scop) > +static struct clast_stmt * > +scop_to_clast (scop_p scop, htab_t params_index) > { > + CloogInput *cloog_input; > + struct clast_stmt *clast; > CloogOptions *options = set_cloog_options (); > - cloog_prog_clast pc; > > - /* Connect new cloog prog generation to graphite. */ > - pc.prog = cloog_program_malloc (); > - build_cloog_prog (scop, pc.prog, options); > - pc.prog = cloog_program_generate (pc.prog, options); > - pc.stmt = cloog_clast_create (pc.prog, options); > + cloog_input = generate_cloog_input (scop, params_index); > + > + /* Dump a .cloog input file, if requested. This feature is only > + enabled in the Graphite branch. */ > + if (0) > + { > + static size_t file_scop_number = 0; > + FILE *cloog_file = init_cloog_input_file (file_scop_number); > + cloog_input_dump_cloog (cloog_file, cloog_input, options); > + } > + > + clast = cloog_clast_create_from_input (cloog_input, options); > > cloog_options_free (options); > - return pc; > + return clast; > } > > /* Prints to FILE the code generated by CLooG for SCOP. */ > @@ -1561,20 +1510,20 @@ void > print_generated_program (FILE *file, scop_p scop) > { > CloogOptions *options = set_cloog_options (); > + htab_t params_index; > + struct clast_stmt *clast; > > - cloog_prog_clast pc = scop_to_clast (scop); > + params_index = htab_create (10, clast_name_index_elt_info, > + eq_clast_name_indexes, free_clast_name_index); > > - fprintf (file, " (prog: \n"); > - cloog_program_print (file, pc.prog); > - fprintf (file, " )\n"); > + clast = scop_to_clast (scop, params_index); > > fprintf (file, " (clast: \n"); > - clast_pprint (file, pc.stmt, 0, options); > + clast_pprint (file, clast, 0, options); > fprintf (file, " )\n"); > > cloog_options_free (options); > - cloog_clast_free (pc.stmt); > - cloog_program_free (pc.prog); > + cloog_clast_free (clast); > } > > /* Prints to STDERR the code generated by CLooG for SCOP. */ > @@ -1585,31 +1534,6 @@ debug_generated_program (scop_p scop) > print_generated_program (stderr, scop); > } > > -/* Add CLooG names to parameter index. The index is used to translate > - back from CLooG names to GCC trees. */ > - > -static void > -create_params_index (scop_p scop, htab_t index_table, CloogProgram *prog) { > - CloogNames* names = cloog_program_names (prog); > - int nb_parameters = cloog_names_nb_parameters (names); > - char **parameters = cloog_names_parameters (names); > - int i; > - mpz_t bound_one, bound_two; > - > - mpz_init (bound_one); > - mpz_init (bound_two); > - > - for (i = 0; i < nb_parameters; i++) > - { > - compute_bounds_for_param (scop, i, bound_one, bound_two); > - save_clast_name_index (index_table, parameters[i], i, i, > - bound_one, bound_two); > - } > - > - mpz_clear (bound_one); > - mpz_clear (bound_two); > -} > - > /* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for > the given SCOP. Return true if code generation succeeded. > BB_PBB_MAPPING is a basic_block and it's related poly_bb_p mapping. > @@ -1623,18 +1547,21 @@ gloog (scop_p scop, htab_t bb_pbb_mappin > sese region = SCOP_REGION (scop); > ifsese if_region = NULL; > htab_t newivs_index, params_index; > - cloog_prog_clast pc; > + struct clast_stmt *clast; > struct ivs_params ip; > > timevar_push (TV_GRAPHITE_CODE_GEN); > gloog_error = false; > > - pc = scop_to_clast (scop); > + params_index = htab_create (10, clast_name_index_elt_info, > + eq_clast_name_indexes, free_clast_name_index); > + > + clast = scop_to_clast (scop, params_index); > > if (dump_file && (dump_flags & TDF_DETAILS)) > { > fprintf (dump_file, "\nCLAST generated by CLooG: \n"); > - print_clast_stmt (dump_file, pc.stmt); > + print_clast_stmt (dump_file, clast); > fprintf (dump_file, "\n"); > } > > @@ -1652,10 +1579,6 @@ gloog (scop_p scop, htab_t bb_pbb_mappin > context_loop = SESE_ENTRY (region)->src->loop_father; > newivs_index = htab_create (10, clast_name_index_elt_info, > eq_clast_name_indexes, free_clast_name_index); > - params_index = htab_create (10, clast_name_index_elt_info, > - eq_clast_name_indexes, free_clast_name_index); > - > - create_params_index (scop, params_index, pc.prog); > > ip.newivs = &newivs; > ip.newivs_index = newivs_index; > @@ -1663,7 +1586,7 @@ gloog (scop_p scop, htab_t bb_pbb_mappin > ip.params_index = params_index; > ip.region = region; > > - translate_clast (context_loop, pc.stmt, if_region->true_region->entry, > + translate_clast (context_loop, clast, if_region->true_region->entry, > bb_pbb_mapping, 0, &ip); > graphite_verify (); > scev_reset (); > @@ -1680,8 +1603,7 @@ gloog (scop_p scop, htab_t bb_pbb_mappin > htab_delete (newivs_index); > htab_delete (params_index); > VEC_free (tree, heap, newivs); > - cloog_clast_free (pc.stmt); > - cloog_program_free (pc.prog); > + cloog_clast_free (clast); > timevar_pop (TV_GRAPHITE_CODE_GEN); > > if (dump_file && (dump_flags & TDF_DETAILS)) > Index: gcc/graphite-clast-to-gimple.h > =================================================================== > --- gcc/graphite-clast-to-gimple.h (revision 188887) > +++ gcc/graphite-clast-to-gimple.h (working copy) > @@ -41,7 +41,6 @@ typedef struct bb_pbb_def > } bb_pbb_def; > > extern bool gloog (scop_p, htab_t); > -extern cloog_prog_clast scop_to_clast (scop_p); > extern void debug_clast_stmt (struct clast_stmt *); > extern void print_clast_stmt (FILE *, struct clast_stmt *); > > Index: gcc/Makefile.in > =================================================================== > --- gcc/Makefile.in (revision 188887) > +++ gcc/Makefile.in (working copy) > @@ -2622,7 +2622,7 @@ graphite-clast-to-gimple.o : graphite-cl > $(GRAPHITE_PPL_H) graphite-poly.h graphite-clast-to-gimple.h \ > graphite-dependences.h graphite-cloog-compat.h > graphite-cloog-util.o : graphite-cloog-util.c $(CONFIG_H) $(SYSTEM_H) \ > - coretypes.h graphite-cloog-util.h graphite-cloog-compat.h > + coretypes.h graphite-cloog-util.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 \ >
On 06/25/2012 09:59 AM, Richard Guenther wrote: > On Fri, 22 Jun 2012, Richard Guenther wrote: > >> >> This bumps the requirement to enable Graphite to using cloog 0.17.0 >> which is the last release from upstream. The patch removes the >> support for the legacy cloog versions, too. >> >> I am bootstrapping and testing this now with cloog 0.17.0 built >> against the upstream ISL 0.10 version. >> >> If this ends up being approved I will put the cloog 0.17.0 tarball >> in the infrastructure directory. >> >> Bootstrap and regtest pending on x86_64-unknown-linux-gnu. >> >> Ok for trunk (for the build parts)? > > The patch passed bootstrap and testing on x86_64-unknown-linux-gnu. I am in favor of pushing this in, but there is still a build system ack required. Richard, thanks for working on this! Tobi
On Fri, Jun 22, 2012 at 9:16 AM, Richard Guenther <rguenther@suse.de> wrote: > > This bumps the requirement to enable Graphite to using cloog 0.17.0 > which is the last release from upstream. Â The patch removes the > support for the legacy cloog versions, too. > > I am bootstrapping and testing this now with cloog 0.17.0 built > against the upstream ISL 0.10 version. > > If this ends up being approved I will put the cloog 0.17.0 tarball > in the infrastructure directory. > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu. > > Ok for trunk (for the build parts)? The build parts look fine. Diego.
On Wed, 27 Jun 2012, Diego Novillo wrote: > On Fri, Jun 22, 2012 at 9:16 AM, Richard Guenther <rguenther@suse.de> wrote: > > > > This bumps the requirement to enable Graphite to using cloog 0.17.0 > > which is the last release from upstream. Â The patch removes the > > support for the legacy cloog versions, too. > > > > I am bootstrapping and testing this now with cloog 0.17.0 built > > against the upstream ISL 0.10 version. > > > > If this ends up being approved I will put the cloog 0.17.0 tarball > > in the infrastructure directory. > > > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu. > > > > Ok for trunk (for the build parts)? > > The build parts look fine. I have installed this first patch now, with the followup to move from PPL to ISL in GCC itself scheduled after a re-bootstrap & test later. I am also installing the following update to changes.html. Thanks, Richard. 2012-07-02 Richard Guenther <rguenther@suse.de> * gcc-4.8/changes.html: Mention new build requirements for Graphite. Index: changes.html =================================================================== RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.8/changes.html,v retrieving revision 1.1 diff -r1.1 changes.html 15d14 < <!-- 17d15 < --> 18a17,22 > <p>To enable the Graphite framework for loop optimizations you now > need CLooG version 0.17.0 and ISL version 0.10. Both can be obtained > from the > <a href="ftp://gcc.gnu.org/pub/gcc/infrastructure/">GCC infrastructure</a> > directory. The installation manual contains > more information about requirements to build GCC.</p>
Index: configure.ac =================================================================== --- configure.ac (revision 188887) +++ configure.ac (working copy) @@ -1623,7 +1623,7 @@ if test "x$with_cloog" != "xno"; then dnl dnl If we use CLooG-Legacy, the provided version information is dnl ignored. - CLOOG_CHECK_VERSION(0,16,1) + CLOOG_CHECK_VERSION(0,17,0) dnl Only execute fail-action, if CLooG has been requested. CLOOG_IF_FAILED([ Index: config/cloog.m4 =================================================================== --- config/cloog.m4 (revision 188887) +++ config/cloog.m4 (working copy) @@ -37,17 +37,6 @@ AC_DEFUN([CLOOG_INIT_FLAGS], [--with-cloog-lib=PATH], [Specify the directory for the installed CLooG library])]) - AC_ARG_ENABLE(cloog-backend, - [AS_HELP_STRING( - [--enable-cloog-backend[[=BACKEND]]], - [set the CLooG BACKEND used to either isl, ppl or ppl-legacy (default)])], - [ if test "x${enableval}" = "xisl"; then - cloog_backend=isl - elif test "x${enableval}" = "xppl"; then - cloog_backend=ppl - else - cloog_backend=ppl-legacy - fi], cloog_backend=ppl-legacy) AC_ARG_ENABLE(cloog-version-check, [AS_HELP_STRING( [--disable-cloog-version-check], @@ -107,23 +96,6 @@ m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG [#include "cloog/cloog.h" ], [cloog_version ()])]) -# _CLOOG_ORG_PROG_PPL () -# ------------------ -# Helper for detecting CLooG.org's PPL backend. -m4_define([_CLOOG_ORG_PROG_PPL],[AC_LANG_PROGRAM( - [#include "cloog/cloog.h" - #include "cloog/ppl/cloog.h"], - [cloog_version ()])]) - -# _CLOOG_PPL_LEGACY_PROG () -# ------------------------- -# Helper for detecting CLooG-Legacy (CLooG-PPL). -m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM( - [#include "cloog/cloog.h"], - [#ifndef CLOOG_PPL_BACKEND - choke me - #endif ])]) - # CLOOG_FIND_FLAGS () # ------------------ # Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org. @@ -137,56 +109,24 @@ AC_DEFUN([CLOOG_FIND_FLAGS], _cloog_saved_LDFLAGS=$LDFLAGS _cloog_saved_LIBS=$LIBS - _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG" + _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}" - case $cloog_backend in - "ppl-legacy") - CFLAGS="${CFLAGS} ${pplinc}" - LDFLAGS="${LDFLAGS} ${ppllibs}" - AC_CACHE_CHECK([for installed CLooG PPL Legacy], [gcc_cv_cloog_type], - [LIBS="-lcloog ${_cloog_saved_LIBS}" - AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG], [gcc_cv_cloog_type="PPL Legacy"], - [gcc_cv_cloog_type=no])]) - ;; - "isl") - 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])]) - ;; - "ppl") - CFLAGS="${CFLAGS} ${pplinc}" - LDFLAGS="${LDFLAGS} ${ppllibs}" - AC_CACHE_CHECK([for installed CLooG PPL], [gcc_cv_cloog_type], - [LIBS="-lcloog-ppl ${_cloog_saved_LIBS}" - AC_LINK_IFELSE([_CLOOG_ORG_PROG_PPL], [gcc_cv_cloog_type="PPL"], - [gcc_cv_cloog_type=no])]) - ;; - *) - gcc_cv_cloog_type="" - esac + 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 - "PPL Legacy") - clooginc="${clooginc}" - clooglibs="${clooglibs} -lcloog" - cloog_org=no - ;; "ISL") clooginc="${clooginc} ${_cloogorginc}" clooglibs="${clooglibs} -lcloog-isl -lisl" cloog_org=yes ;; - "PPL") - clooginc="${clooginc} ${_cloogorginc}" - clooglibs="${clooglibs} -lcloog-ppl" - cloog_org=yes - ;; *) clooglibs= clooginc= @@ -212,25 +152,10 @@ m4_define([_CLOOG_CHECK_CT_PROG],[AC_LAN choke me #endif])]) -# _CLOOG_CHECK_RT_PROG () -# ----------------------- -# Helper for verifying that CLooG's compile time version -# matches the run time version. -m4_define([_CLOOG_CHECK_RT_PROG],[AC_LANG_PROGRAM( - [#include "cloog/cloog.h"], - [if ((cloog_version_major () != CLOOG_VERSION_MAJOR) - && (cloog_version_minor () != CLOOG_VERSION_MINOR) - && (cloog_version_revision () != CLOOG_VERSION_REVISION)) - { - return 1; - }])]) - # CLOOG_CHECK_VERSION CLOOG_CHECK_VERSION (MAJOR, MINOR, REVISION) # ---------------------------------------------------------------- # Test the found CLooG to be exact of version MAJOR.MINOR and at least # REVISION. -# If we're using the old CLooG-PPL (Legacy), the old version check will -# be executed (Ignores the provided version information). AC_DEFUN([CLOOG_CHECK_VERSION], [ AC_REQUIRE([CLOOG_FIND_FLAGS]) @@ -242,21 +167,11 @@ AC_DEFUN([CLOOG_CHECK_VERSION], CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}" - if test "${cloog_org}" = yes ; then - AC_CACHE_CHECK([for version $1.$2.$3 of CLooG], - [gcc_cv_cloog_ct_0_14_0], - [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)], - [gcc_cv_cloog_ct_0_14_0=yes], - [gcc_cv_cloog_ct_0_14_0=no])]) - elif test "${cloog_org}" = no ; then - AC_CACHE_CHECK([for version 0.15.5 (or later revision) of CLooG], - [gcc_cv_cloog_ct_0_15_5], - [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,5)], - [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG(0,15,9)], - [gcc_cv_cloog_ct_0_15_5=yes], - [gcc_cv_cloog_ct_0_15_5="buggy but acceptable"])], - [gcc_cv_cloog_ct_0_15_5=no])]) - fi + AC_CACHE_CHECK([for version $1.$2.$3 of CLooG], + [gcc_cv_cloog], + [AC_COMPILE_IFELSE([_CLOOG_CHECK_CT_PROG($1,$2,$3)], + [gcc_cv_cloog=yes], + [gcc_cv_cloog=no])]) CFLAGS=$_cloog_saved_CFLAGS LDFLAGS=$_cloog_saved_LDFLAGS @@ -272,9 +187,7 @@ AC_DEFUN([CLOOG_IF_FAILED], [ CLOOG_REQUESTED([graphite_requested=yes], [graphite_requested=no]) - if test "${gcc_cv_cloog_ct_0_14_0}" = no \ - || test "${gcc_cv_cloog_rt_0_14_0}" = no \ - || test "${gcc_cv_cloog_ct_0_15_5}" = no; then + if test "${gcc_cv_cloog}" = no ; then clooglibs= clooginc= fi Index: configure =================================================================== --- configure (revision 188887) +++ configure (working copy) @@ -777,7 +777,6 @@ enable_ppl_version_check with_cloog with_cloog_include with_cloog_lib -enable_cloog_backend enable_cloog_version_check enable_lto enable_stage1_languages @@ -1476,9 +1475,6 @@ Optional Features: build stages 2 and 3 with C++, not C --disable-ppl-version-check disable check for PPL version - --enable-cloog-backend[=BACKEND] - set the CLooG BACKEND used to either isl, ppl or - ppl-legacy (default) --disable-cloog-version-check disable check for CLooG version --enable-lto enable link time optimization support @@ -5757,19 +5753,6 @@ if test "${with_cloog_lib+set}" = set; t fi - # Check whether --enable-cloog-backend was given. -if test "${enable_cloog_backend+set}" = set; then : - enableval=$enable_cloog_backend; if test "x${enableval}" = "xisl"; then - cloog_backend=isl - elif test "x${enableval}" = "xppl"; then - cloog_backend=ppl - else - cloog_backend=ppl-legacy - fi -else - cloog_backend=ppl-legacy -fi - # Check whether --enable-cloog-version-check was given. if test "${enable_cloog_version_check+set}" = set; then : enableval=$enable_cloog_version_check; ENABLE_CLOOG_CHECK=$enableval @@ -5836,54 +5819,19 @@ if test "x$with_cloog" != "xno"; then _cloog_saved_LDFLAGS=$LDFLAGS _cloog_saved_LIBS=$LIBS - _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG" + _cloogorginc="-DCLOOG_INT_GMP" CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}" CPPFLAGS="${CPPFLAGS} ${_cloogorginc}" LDFLAGS="${LDFLAGS} ${clooglibs}" - case $cloog_backend in - "ppl-legacy") - CFLAGS="${CFLAGS} ${pplinc}" - LDFLAGS="${LDFLAGS} ${ppllibs}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG PPL Legacy" >&5 -$as_echo_n "checking for installed CLooG PPL Legacy... " >&6; } -if test "${gcc_cv_cloog_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - LIBS="-lcloog ${_cloog_saved_LIBS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "cloog/cloog.h" -int -main () -{ -#ifndef CLOOG_PPL_BACKEND - choke me - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gcc_cv_cloog_type="PPL Legacy" -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; } - ;; - "isl") - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG ISL" >&5 + { $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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "cloog/cloog.h" int @@ -5904,59 +5852,13 @@ rm -f core conftest.err conftest.$ac_obj fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5 $as_echo "$gcc_cv_cloog_type" >&6; } - ;; - "ppl") - CFLAGS="${CFLAGS} ${pplinc}" - LDFLAGS="${LDFLAGS} ${ppllibs}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG PPL" >&5 -$as_echo_n "checking for installed CLooG PPL... " >&6; } -if test "${gcc_cv_cloog_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - LIBS="-lcloog-ppl ${_cloog_saved_LIBS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "cloog/cloog.h" - #include "cloog/ppl/cloog.h" -int -main () -{ -cloog_version () - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gcc_cv_cloog_type="PPL" -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; } - ;; - *) - gcc_cv_cloog_type="" - esac case $gcc_cv_cloog_type in - "PPL Legacy") - clooginc="${clooginc}" - clooglibs="${clooglibs} -lcloog" - cloog_org=no - ;; "ISL") clooginc="${clooginc} ${_cloogorginc}" clooglibs="${clooglibs} -lcloog-isl -lisl" cloog_org=yes ;; - "PPL") - clooginc="${clooginc} ${_cloogorginc}" - clooglibs="${clooglibs} -lcloog-ppl" - cloog_org=yes - ;; *) clooglibs= clooginc= @@ -5980,40 +5882,9 @@ $as_echo "$gcc_cv_cloog_type" >&6; } CFLAGS="${_cloog_saved_CFLAGS} ${clooginc} ${pplinc} ${gmpinc}" LDFLAGS="${_cloog_saved_LDFLAGS} ${clooglibs} ${ppllibs}" - if test "${cloog_org}" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.16.1 of CLooG" >&5 -$as_echo_n "checking for version 0.16.1 of CLooG... " >&6; } -if test "${gcc_cv_cloog_ct_0_14_0+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "cloog/cloog.h" -int -main () -{ -#if CLOOG_VERSION_MAJOR != 0 \ - || CLOOG_VERSION_MINOR != 16 \ - || CLOOG_VERSION_REVISION < 1 - choke me - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gcc_cv_cloog_ct_0_14_0=yes -else - gcc_cv_cloog_ct_0_14_0=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_ct_0_14_0" >&5 -$as_echo "$gcc_cv_cloog_ct_0_14_0" >&6; } - elif test "${cloog_org}" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 0.15.5 (or later revision) of CLooG" >&5 -$as_echo_n "checking for version 0.15.5 (or later revision) of CLooG... " >&6; } -if test "${gcc_cv_cloog_ct_0_15_5+set}" = set; then : + { $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; } +if test "${gcc_cv_cloog+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6023,8 +5894,8 @@ int main () { #if CLOOG_VERSION_MAJOR != 0 \ - || CLOOG_VERSION_MINOR != 15 \ - || CLOOG_VERSION_REVISION < 5 + || CLOOG_VERSION_MINOR != 17 \ + || CLOOG_VERSION_REVISION < 0 choke me #endif ; @@ -6032,35 +5903,14 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "cloog/cloog.h" -int -main () -{ -#if CLOOG_VERSION_MAJOR != 0 \ - || CLOOG_VERSION_MINOR != 15 \ - || CLOOG_VERSION_REVISION < 9 - choke me - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gcc_cv_cloog_ct_0_15_5=yes -else - gcc_cv_cloog_ct_0_15_5="buggy but acceptable" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + gcc_cv_cloog=yes else - gcc_cv_cloog_ct_0_15_5=no + gcc_cv_cloog=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_ct_0_15_5" >&5 -$as_echo "$gcc_cv_cloog_ct_0_15_5" >&6; } - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog" >&5 +$as_echo "$gcc_cv_cloog" >&6; } CFLAGS=$_cloog_saved_CFLAGS LDFLAGS=$_cloog_saved_LDFLAGS @@ -6084,9 +5934,7 @@ $as_echo "$gcc_cv_cloog_ct_0_15_5" >&6; - if test "${gcc_cv_cloog_ct_0_14_0}" = no \ - || test "${gcc_cv_cloog_rt_0_14_0}" = no \ - || test "${gcc_cv_cloog_ct_0_15_5}" = no; then + if test "${gcc_cv_cloog}" = no ; then clooglibs= clooginc= fi Index: gcc/doc/install.texi =================================================================== --- gcc/doc/install.texi (revision 188887) +++ gcc/doc/install.texi (working copy) @@ -370,23 +370,12 @@ It can be downloaded from @uref{http://w The @option{--with-ppl} configure option should be used if PPL is not installed in your default library search path. -@item CLooG-PPL version 0.15 or CLooG 0.16 +@item CLooG 0.17.0 -Necessary to build GCC with the Graphite loop optimizations. There -are two versions available. CLooG-PPL 0.15 as well as CLooG 0.16. -The former is the default right now. It can be downloaded from -@uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as -@file{cloog-ppl-0.15.tar.gz}. - -CLooG 0.16 support is still in testing stage, but will be the -default in future GCC releases. It is also available at -@uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as -@file{cloog-0.16.1.tar.gz}. To use it add the additional configure -option @option{--enable-cloog-backend=isl}. Even if CLooG 0.16 -does not use PPL, PPL is still required for Graphite. - -In both cases @option{--with-cloog} configure option should be used -if CLooG is not installed in your default library search path. +Necessary to build GCC with the Graphite loop optimizations. It can be +downloaded from @uref{ftp://gcc.gnu.org/pub/gcc/infrastructure/} as +@file{cloog-0.17.0.tar.gz}. The @option{--with-cloog} configure option should +be used if CLooG is not installed in your default library search path. @end table Index: gcc/graphite-cloog-util.c =================================================================== --- gcc/graphite-cloog-util.c (revision 188887) +++ gcc/graphite-cloog-util.c (working copy) @@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. #include "ppl_c.h" #include "cloog/cloog.h" #include "graphite-cloog-util.h" -#include "graphite-cloog-compat.h" /* Counts the number of constraints in PCS. */ @@ -237,7 +236,7 @@ new_C_Polyhedron_from_Cloog_Matrix (ppl_ CloogDomain * new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, int nb_params, - CloogState *state ATTRIBUTE_UNUSED) + CloogState *state) { CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); CloogDomain *res = cloog_domain_from_cloog_matrix (state, mat, nb_params); @@ -249,11 +248,10 @@ new_Cloog_Domain_from_ppl_Polyhedron (pp CloogScattering * new_Cloog_Scattering_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph, - int nb_params ATTRIBUTE_UNUSED, - int nb_scatt ATTRIBUTE_UNUSED, - CloogState *state ATTRIBUTE_UNUSED) + int nb_params, + int nb_scatt, + CloogState *state) { -#ifdef CLOOG_ORG CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph); CloogScattering *res = cloog_scattering_from_cloog_matrix (state, mat, nb_scatt, @@ -261,9 +259,6 @@ new_Cloog_Scattering_from_ppl_Polyhedron cloog_matrix_free (mat); return res; -#else - return new_Cloog_Domain_from_ppl_Polyhedron (ph, nb_params, state); -#endif } /* Creates a CloogDomain from a pointset powerset PS. */ @@ -271,7 +266,7 @@ new_Cloog_Scattering_from_ppl_Polyhedron CloogDomain * new_Cloog_Domain_from_ppl_Pointset_Powerset (ppl_Pointset_Powerset_C_Polyhedron_t ps, int nb_params, - CloogState *state ATTRIBUTE_UNUSED) + CloogState *state) { CloogDomain *res = NULL; ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end; @@ -314,14 +309,14 @@ openscop_print_cloog_matrix (FILE *file, int output, int input, int locals, int params) { - int i, j; + unsigned i, j; - fprintf (file, "%d %d %d %d %d %d \n", cloog_matrix_nrows (mat), - cloog_matrix_ncolumns (mat), output, input, locals, params); + fprintf (file, "%d %d %d %d %d %d \n", mat->NbRows, + mat->NbColumns, output, input, locals, params); - for (i = 0; i < cloog_matrix_nrows (mat); i++) + for (i = 0; i < mat->NbRows; i++) { - for (j = 0; j < cloog_matrix_ncolumns (mat); j++) + for (j = 0; j < mat->NbColumns; j++) if (j == 0) fprintf (file, "%ld ", mpz_get_si (mat->p[i][j])); else Index: gcc/graphite-cloog-util.h =================================================================== --- gcc/graphite-cloog-util.h (revision 188887) +++ gcc/graphite-cloog-util.h (working copy) @@ -22,7 +22,6 @@ along with GCC; see the file COPYING3. #define GRAPHITE_CLOOG_UTIL_H #include "cloog/cloog.h" -#include "graphite-cloog-compat.h" CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t); CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t, Index: gcc/graphite.c =================================================================== --- gcc/graphite.c (revision 188887) +++ gcc/graphite.c (working copy) @@ -209,7 +209,6 @@ graphite_initialize (void) gcc_assert (ppl_initialized == 0); cloog_state = cloog_state_malloc (); - cloog_initialize (); if (dump_file && dump_flags) dump_function_to_file (current_function_decl, dump_file, dump_flags); @@ -233,7 +232,6 @@ graphite_finalize (bool need_cfg_cleanup } cloog_state_free (cloog_state); - cloog_finalize (); ppl_finalize (); free_original_copy_tables (); Index: gcc/graphite-clast-to-gimple.c =================================================================== --- gcc/graphite-clast-to-gimple.c (revision 188887) +++ gcc/graphite-clast-to-gimple.c (working copy) @@ -38,7 +38,8 @@ along with GCC; see the file COPYING3. #include "graphite-poly.h" #include "graphite-clast-to-gimple.h" #include "graphite-dependences.h" -#include "graphite-cloog-compat.h" + +typedef const struct clast_expr *clast_name_p; #ifndef CLOOG_LANGUAGE_C #define CLOOG_LANGUAGE_C LANGUAGE_C @@ -68,6 +69,9 @@ typedef struct clast_name_index { int level; mpz_t bound_one, bound_two; const char *name; + /* If free_name is set, the content of name was allocated by us and needs + to be freed. */ + char *free_name; } *clast_name_index_p; /* Returns a pointer to a new element of type clast_name_index_p built @@ -78,8 +82,11 @@ new_clast_name_index (const char *name, mpz_t bound_one, mpz_t bound_two) { clast_name_index_p res = XNEW (struct clast_name_index); + char *new_name = XNEWVEC (char, strlen (name) + 1); + strcpy (new_name, name); - res->name = name; + res->name = new_name; + res->free_name = new_name; res->level = level; res->index = index; mpz_init (res->bound_one); @@ -95,6 +102,8 @@ static void free_clast_name_index (void *ptr) { struct clast_name_index *c = (struct clast_name_index *) ptr; + if (c->free_name) + free (c->free_name); mpz_clear (c->bound_one); mpz_clear (c->bound_two); free (ptr); @@ -111,12 +120,9 @@ clast_name_to_level (clast_name_p name, struct clast_name_index tmp; PTR *slot; -#ifdef CLOOG_ORG gcc_assert (name->type == clast_expr_name); tmp.name = ((const struct clast_name *) name)->name; -#else - tmp.name = name; -#endif + tmp.free_name = NULL; slot = htab_find_slot (index_table, &tmp, NO_INSERT); @@ -131,17 +137,13 @@ clast_name_to_level (clast_name_p name, SCATTERING_DIMENSIONS vector. */ static inline int -clast_name_to_index (clast_name_p name, htab_t index_table) +clast_name_to_index (struct clast_name *name, htab_t index_table) { struct clast_name_index tmp; PTR *slot; -#ifdef CLOOG_ORG - gcc_assert (name->type == clast_expr_name); tmp.name = ((const struct clast_name *) name)->name; -#else - tmp.name = name; -#endif + tmp.free_name = NULL; slot = htab_find_slot (index_table, &tmp, NO_INSERT); @@ -156,18 +158,14 @@ clast_name_to_index (clast_name_p name, found in the INDEX_TABLE, false otherwise. */ static inline bool -clast_name_to_lb_ub (clast_name_p name, htab_t index_table, mpz_t bound_one, - mpz_t bound_two) +clast_name_to_lb_ub (struct clast_name *name, htab_t index_table, + mpz_t bound_one, mpz_t bound_two) { struct clast_name_index tmp; PTR *slot; -#ifdef CLOOG_ORG - gcc_assert (name->type == clast_expr_name); - tmp.name = ((const struct clast_name *) name)->name; -#else - tmp.name = name; -#endif + tmp.name = name->name; + tmp.free_name = NULL; slot = htab_find_slot (index_table, &tmp, NO_INSERT); @@ -191,6 +189,7 @@ save_clast_name_index (htab_t index_tabl PTR *slot; tmp.name = name; + tmp.free_name = NULL; slot = htab_find_slot (index_table, &tmp, INSERT); if (slot) @@ -206,7 +205,16 @@ save_clast_name_index (htab_t index_tabl static inline hashval_t clast_name_index_elt_info (const void *elt) { - return htab_hash_pointer (((const struct clast_name_index *) elt)->name); + const struct clast_name_index *e = ((const struct clast_name_index *) elt); + hashval_t hash = 0; + + int length = strlen (e->name); + int i; + + for (i = 0; i < length; ++i) + hash = hash | (e->name[i] << (i % 4)); + + return hash; } /* Compares database elements E1 and E2. */ @@ -217,7 +225,7 @@ eq_clast_name_indexes (const void *e1, c const struct clast_name_index *elt1 = (const struct clast_name_index *) e1; const struct clast_name_index *elt2 = (const struct clast_name_index *) e2; - return (elt1->name == elt2->name); + return strcmp (elt1->name, elt2->name) == 0; } @@ -238,7 +246,7 @@ typedef struct ivs_params { Cloog representation. */ static tree -clast_name_to_gcc (clast_name_p name, ivs_params_p ip) +clast_name_to_gcc (struct clast_name *name, ivs_params_p ip) { int index; @@ -334,6 +342,10 @@ clast_to_gcc_expression (tree type, stru { switch (e->type) { + case clast_expr_name: + { + return clast_name_to_gcc ((struct clast_name *) e, ip); + } case clast_expr_term: { struct clast_term *t = (struct clast_term *) e; @@ -342,7 +354,7 @@ clast_to_gcc_expression (tree type, stru { if (mpz_cmp_si (t->val, 1) == 0) { - tree name = clast_name_to_gcc (t->var, ip); + tree name = clast_to_gcc_expression (type, t->var, ip); if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type)) name = convert_to_ptrofftype (name); @@ -353,7 +365,7 @@ clast_to_gcc_expression (tree type, stru else if (mpz_cmp_si (t->val, -1) == 0) { - tree name = clast_name_to_gcc (t->var, ip); + tree name = clast_to_gcc_expression (type, t->var, ip); if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type)) name = convert_to_ptrofftype (name); @@ -364,7 +376,7 @@ clast_to_gcc_expression (tree type, stru } else { - tree name = clast_name_to_gcc (t->var, ip); + tree name = clast_to_gcc_expression (type, t->var, ip); tree cst = gmp_cst_to_tree (type, t->val); if (POINTER_TYPE_P (TREE_TYPE (name)) != POINTER_TYPE_P (type)) @@ -493,6 +505,9 @@ type_for_value (mpz_t val) return type_for_interval (val, val); } +static tree +type_for_clast_expr (struct clast_expr *, ivs_params_p, mpz_t, mpz_t); + /* Return the type for the clast_term T. Initializes BOUND_ONE and BOUND_TWO to the bounds of the term. */ @@ -500,38 +515,24 @@ static tree type_for_clast_term (struct clast_term *t, ivs_params_p ip, mpz_t bound_one, mpz_t bound_two) { - clast_name_p name = t->var; - bool found = false; - + tree type; gcc_assert (t->expr.type == clast_expr_term); - if (!name) + if (!t->var) { mpz_set (bound_one, t->val); mpz_set (bound_two, t->val); return type_for_value (t->val); } - if (ip->params && ip->params_index) - found = clast_name_to_lb_ub (name, ip->params_index, bound_one, bound_two); - - if (!found) - { - gcc_assert (*(ip->newivs) && ip->newivs_index); - found = clast_name_to_lb_ub (name, ip->newivs_index, - bound_one, bound_two); - gcc_assert (found); - } + type = type_for_clast_expr (t->var, ip, bound_one, bound_two); mpz_mul (bound_one, bound_one, t->val); mpz_mul (bound_two, bound_two, t->val); - return TREE_TYPE (clast_name_to_gcc (name, ip)); + return max_precision_type (type, type_for_interval (bound_one, bound_two)); } -static tree -type_for_clast_expr (struct clast_expr *, ivs_params_p, mpz_t, mpz_t); - /* Return the type for the clast_reduction R. Initializes BOUND_ONE and BOUND_TWO to the bounds of the reduction expression. */ @@ -639,6 +640,29 @@ type_for_clast_bin (struct clast_binary return max_precision_type (type, type_for_interval (bound_one, bound_two)); } +/* Return the type for the clast_name NAME. Initializes BOUND_ONE and + BOUND_TWO to the bounds of the term. */ + +static tree +type_for_clast_name (struct clast_name *name, ivs_params_p ip, mpz_t bound_one, + mpz_t bound_two) +{ + bool found = false; + + if (ip->params && ip->params_index) + found = clast_name_to_lb_ub (name, ip->params_index, bound_one, bound_two); + + if (!found) + { + gcc_assert (*(ip->newivs) && ip->newivs_index); + found = clast_name_to_lb_ub (name, ip->newivs_index, bound_one, + bound_two); + gcc_assert (found); + } + + return TREE_TYPE (clast_name_to_gcc (name, ip)); +} + /* Returns the type for the CLAST expression E when used in statement STMT. */ @@ -660,6 +684,10 @@ type_for_clast_expr (struct clast_expr * return type_for_clast_bin ((struct clast_binary *) e, ip, bound_one, bound_two); + case clast_expr_name: + return type_for_clast_name ((struct clast_name *) e, ip, + bound_one, bound_two); + default: gcc_unreachable (); } @@ -869,7 +897,7 @@ graphite_create_new_loop (edge entry_edg struct clast_user_stmt *body = clast_get_body_of_loop ((struct clast_stmt *) stmt); - poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (body->statement); + 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"); @@ -901,7 +929,7 @@ build_iv_mapping (VEC (tree, heap) *iv_m struct clast_stmt *t; int depth = 0; CloogStatement *cs = user_stmt->statement; - poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs); + poly_bb_p pbb = (poly_bb_p) cs->usr; gimple_bb_p gbb = PBB_BLACK_BOX (pbb); mpz_t bound_one, bound_two; @@ -1018,7 +1046,7 @@ translate_clast_user (struct clast_user_ { int i, nb_loops; basic_block new_bb; - poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (stmt->statement); + poly_bb_p pbb = (poly_bb_p) stmt->statement->usr; gimple_bb_p gbb = PBB_BLACK_BOX (pbb); VEC (tree, heap) *iv_map; @@ -1240,81 +1268,69 @@ translate_clast (loop_p context_loop, st level, ip); } -/* Free the SCATTERING domain list. */ +/* Add parameter and iterator names to the CloogUnionDomain. */ -static void -free_scattering (CloogScatteringList *scattering) -{ - while (scattering) - { - CloogScattering *dom = cloog_scattering (scattering); - CloogScatteringList *next = cloog_next_scattering (scattering); - - cloog_scattering_free (dom); - free (scattering); - scattering = next; - } -} - -/* Initialize Cloog's parameter names from the names used in GIMPLE. - Initialize Cloog's iterator names, using 'graphite_iterator_%d' - from 0 to scop_nb_loops (scop). */ - -static void -initialize_cloog_names (scop_p scop, CloogProgram *prog) +static CloogUnionDomain * +add_names_to_union_domain (scop_p scop, CloogUnionDomain *union_domain, + int nb_scattering_dims, htab_t params_index) { sese region = SCOP_REGION (scop); int i; int nb_iterators = scop_max_loop_depth (scop); - int nb_scattering = cloog_program_nb_scattdims (prog); int nb_parameters = VEC_length (tree, SESE_PARAMS (region)); - char **iterators = XNEWVEC (char *, nb_iterators * 2); - char **scattering = XNEWVEC (char *, nb_scattering); - char **parameters= XNEWVEC (char *, nb_parameters); + mpz_t bound_one, bound_two; - cloog_program_set_names (prog, cloog_names_malloc ()); + mpz_init (bound_one); + mpz_init (bound_two); for (i = 0; i < nb_parameters; i++) { tree param = VEC_index (tree, SESE_PARAMS (region), i); const char *name = get_name (param); int len; + char *parameter; if (!name) name = "T"; len = strlen (name); len += 17; - parameters[i] = XNEWVEC (char, len + 1); - snprintf (parameters[i], len, "%s_%d", name, SSA_NAME_VERSION (param)); + parameter = XNEWVEC (char, len + 1); + snprintf (parameter, len, "%s_%d", name, SSA_NAME_VERSION (param)); + save_clast_name_index (params_index, parameter, i, i, bound_one, + bound_two); + union_domain = cloog_union_domain_set_name (union_domain, CLOOG_PARAM, i, + parameter); + compute_bounds_for_param (scop, i, bound_one, bound_two); + free (parameter); } - cloog_names_set_nb_parameters (cloog_program_names (prog), nb_parameters); - cloog_names_set_parameters (cloog_program_names (prog), parameters); + mpz_clear (bound_one); + mpz_clear (bound_two); for (i = 0; i < nb_iterators; i++) { int len = 4 + 16; - iterators[i] = XNEWVEC (char, len); - snprintf (iterators[i], len, "git_%d", i); + char *iterator; + iterator = XNEWVEC (char, len); + snprintf (iterator, len, "git_%d", i); + union_domain = cloog_union_domain_set_name (union_domain, CLOOG_ITER, i, + iterator); + free (iterator); } - cloog_names_set_nb_iterators (cloog_program_names (prog), - nb_iterators); - cloog_names_set_iterators (cloog_program_names (prog), - iterators); - - for (i = 0; i < nb_scattering; i++) + for (i = 0; i < nb_scattering_dims; i++) { int len = 5 + 16; - scattering[i] = XNEWVEC (char, len); - snprintf (scattering[i], len, "scat_%d", i); + char *scattering; + scattering = XNEWVEC (char, len); + snprintf (scattering, len, "scat_%d", i); + union_domain = cloog_union_domain_set_name (union_domain, CLOOG_SCAT, i, + scattering); + free (scattering); } - cloog_names_set_nb_scattering (cloog_program_names (prog), - nb_scattering); - cloog_names_set_scattering (cloog_program_names (prog), - scattering); + return union_domain; } /* Initialize a CLooG input file. */ @@ -1342,129 +1358,40 @@ init_cloog_input_file (int scop_number) return graphite_out_file; } -/* Build cloog program for SCoP. */ +/* Build cloog union domain for SCoP. */ -static void -build_cloog_prog (scop_p scop, CloogProgram *prog, - CloogOptions *options) +static CloogUnionDomain * +build_cloog_union_domain (scop_p scop) { int i; - int max_nb_loops = scop_max_loop_depth (scop); poly_bb_p pbb; - CloogLoop *loop_list = NULL; - CloogBlockList *block_list = NULL; - CloogScatteringList *scattering = NULL; - int nbs = 2 * max_nb_loops + 1; - int *scaldims; - - cloog_program_set_context - (prog, new_Cloog_Domain_from_ppl_Pointset_Powerset (SCOP_CONTEXT (scop), - scop_nb_params (scop), cloog_state)); - nbs = unify_scattering_dimensions (scop); - scaldims = (int *) xmalloc (nbs * (sizeof (int))); - cloog_program_set_nb_scattdims (prog, nbs); - initialize_cloog_names (scop, prog); + + CloogUnionDomain *union_domain = + cloog_union_domain_alloc (scop_nb_params (scop)); FOR_EACH_VEC_ELT (poly_bb_p, SCOP_BBS (scop), i, pbb) { - CloogStatement *stmt; - CloogBlock *block; - CloogDomain *dom; + CloogDomain *domain; + CloogScattering *scattering; /* 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))) continue; - /* Build the new statement and its block. */ - stmt = cloog_statement_alloc (cloog_state, pbb_index (pbb)); - dom = new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb), - scop_nb_params (scop), - cloog_state); - block = cloog_block_alloc (stmt, 0, NULL, pbb_dim_iter_domain (pbb)); - cloog_statement_set_usr (stmt, pbb); - - /* Build loop list. */ - { - CloogLoop *new_loop_list = cloog_loop_malloc (cloog_state); - cloog_loop_set_next (new_loop_list, loop_list); - cloog_loop_set_domain (new_loop_list, dom); - cloog_loop_set_block (new_loop_list, block); - loop_list = new_loop_list; - } - - /* Build block list. */ - { - CloogBlockList *new_block_list = cloog_block_list_malloc (); + domain = new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb), + scop_nb_params (scop), + cloog_state); - cloog_block_list_set_next (new_block_list, block_list); - cloog_block_list_set_block (new_block_list, block); - block_list = new_block_list; - } + scattering = new_Cloog_Scattering_from_ppl_Polyhedron + (PBB_TRANSFORMED_SCATTERING (pbb), scop_nb_params (scop), + pbb_nb_scattering_transform (pbb), cloog_state); - /* Build scattering list. */ - { - /* XXX: Replace with cloog_domain_list_alloc(), when available. */ - CloogScatteringList *new_scattering - = (CloogScatteringList *) xmalloc (sizeof (CloogScatteringList)); - ppl_Polyhedron_t scat; - CloogScattering *dom; - - scat = PBB_TRANSFORMED_SCATTERING (pbb); - dom = new_Cloog_Scattering_from_ppl_Polyhedron - (scat, scop_nb_params (scop), pbb_nb_scattering_transform (pbb), - cloog_state); - - cloog_set_next_scattering (new_scattering, scattering); - cloog_set_scattering (new_scattering, dom); - scattering = new_scattering; - } + union_domain = cloog_union_domain_add_domain (union_domain, "", domain, + scattering, pbb); } - cloog_program_set_loop (prog, loop_list); - cloog_program_set_blocklist (prog, block_list); - - for (i = 0; i < nbs; i++) - scaldims[i] = 0 ; - - cloog_program_set_scaldims (prog, scaldims); - - /* Extract scalar dimensions to simplify the code generation problem. */ - cloog_program_extract_scalars (prog, scattering, options); - - /* Dump a .cloog input file, if requested. This feature is only - enabled in the Graphite branch. */ - if (0) - { - static size_t file_scop_number = 0; - FILE *cloog_file = init_cloog_input_file (file_scop_number); - - cloog_program_dump_cloog (cloog_file, prog, scattering); - ++file_scop_number; - } - - /* Apply scattering. */ - cloog_program_scatter (prog, scattering, options); - free_scattering (scattering); - - /* Iterators corresponding to scalar dimensions have to be extracted. */ - cloog_names_scalarize (cloog_program_names (prog), nbs, - cloog_program_scaldims (prog)); - - /* Free blocklist. */ - { - CloogBlockList *next = cloog_program_blocklist (prog); - - while (next) - { - CloogBlockList *toDelete = next; - next = cloog_block_list_next (next); - cloog_block_list_set_next (toDelete, NULL); - cloog_block_list_set_block (toDelete, NULL); - cloog_block_list_free (toDelete); - } - cloog_program_set_blocklist (prog, NULL); - } + return union_domain; } /* Return the options that will be used in GLOOG. */ @@ -1485,14 +1412,8 @@ set_cloog_options (void) GLooG. */ options->esp = 1; -#ifdef CLOOG_ORG /* Silence CLooG to avoid failing tests due to debug output to stderr. */ options->quiet = 1; -#else - /* Enable C pretty-printing mode: normalizes the substitution - equations for statements. */ - options->cpp = 1; -#endif /* Allow cloog to build strides with a stride width different to one. This example has stride = 4: @@ -1535,24 +1456,52 @@ debug_clast_stmt (struct clast_stmt *stm print_clast_stmt (stderr, stmt); } +static CloogInput * +generate_cloog_input (scop_p scop, htab_t params_index) +{ + CloogUnionDomain *union_domain; + CloogInput *cloog_input; + CloogDomain *context; + + int nb_scattering_dims = unify_scattering_dimensions (scop); + union_domain = build_cloog_union_domain (scop); + 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); + + cloog_input = cloog_input_alloc (context, union_domain); + + return cloog_input; +} + /* Translate SCOP to a CLooG program and clast. These two representations should be freed together: a clast cannot be used without a program. */ -cloog_prog_clast -scop_to_clast (scop_p scop) +static struct clast_stmt * +scop_to_clast (scop_p scop, htab_t params_index) { + CloogInput *cloog_input; + struct clast_stmt *clast; CloogOptions *options = set_cloog_options (); - cloog_prog_clast pc; - /* Connect new cloog prog generation to graphite. */ - pc.prog = cloog_program_malloc (); - build_cloog_prog (scop, pc.prog, options); - pc.prog = cloog_program_generate (pc.prog, options); - pc.stmt = cloog_clast_create (pc.prog, options); + cloog_input = generate_cloog_input (scop, params_index); + + /* Dump a .cloog input file, if requested. This feature is only + enabled in the Graphite branch. */ + if (0) + { + static size_t file_scop_number = 0; + FILE *cloog_file = init_cloog_input_file (file_scop_number); + cloog_input_dump_cloog (cloog_file, cloog_input, options); + } + + clast = cloog_clast_create_from_input (cloog_input, options); cloog_options_free (options); - return pc; + return clast; } /* Prints to FILE the code generated by CLooG for SCOP. */ @@ -1561,20 +1510,20 @@ void print_generated_program (FILE *file, scop_p scop) { CloogOptions *options = set_cloog_options (); + htab_t params_index; + struct clast_stmt *clast; - cloog_prog_clast pc = scop_to_clast (scop); + params_index = htab_create (10, clast_name_index_elt_info, + eq_clast_name_indexes, free_clast_name_index); - fprintf (file, " (prog: \n"); - cloog_program_print (file, pc.prog); - fprintf (file, " )\n"); + clast = scop_to_clast (scop, params_index); fprintf (file, " (clast: \n"); - clast_pprint (file, pc.stmt, 0, options); + clast_pprint (file, clast, 0, options); fprintf (file, " )\n"); cloog_options_free (options); - cloog_clast_free (pc.stmt); - cloog_program_free (pc.prog); + cloog_clast_free (clast); } /* Prints to STDERR the code generated by CLooG for SCOP. */ @@ -1585,31 +1534,6 @@ debug_generated_program (scop_p scop) print_generated_program (stderr, scop); } -/* Add CLooG names to parameter index. The index is used to translate - back from CLooG names to GCC trees. */ - -static void -create_params_index (scop_p scop, htab_t index_table, CloogProgram *prog) { - CloogNames* names = cloog_program_names (prog); - int nb_parameters = cloog_names_nb_parameters (names); - char **parameters = cloog_names_parameters (names); - int i; - mpz_t bound_one, bound_two; - - mpz_init (bound_one); - mpz_init (bound_two); - - for (i = 0; i < nb_parameters; i++) - { - compute_bounds_for_param (scop, i, bound_one, bound_two); - save_clast_name_index (index_table, parameters[i], i, i, - bound_one, bound_two); - } - - mpz_clear (bound_one); - mpz_clear (bound_two); -} - /* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for the given SCOP. Return true if code generation succeeded. BB_PBB_MAPPING is a basic_block and it's related poly_bb_p mapping. @@ -1623,18 +1547,21 @@ gloog (scop_p scop, htab_t bb_pbb_mappin sese region = SCOP_REGION (scop); ifsese if_region = NULL; htab_t newivs_index, params_index; - cloog_prog_clast pc; + struct clast_stmt *clast; struct ivs_params ip; timevar_push (TV_GRAPHITE_CODE_GEN); gloog_error = false; - pc = scop_to_clast (scop); + params_index = htab_create (10, clast_name_index_elt_info, + eq_clast_name_indexes, free_clast_name_index); + + clast = scop_to_clast (scop, params_index); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "\nCLAST generated by CLooG: \n"); - print_clast_stmt (dump_file, pc.stmt); + print_clast_stmt (dump_file, clast); fprintf (dump_file, "\n"); } @@ -1652,10 +1579,6 @@ gloog (scop_p scop, htab_t bb_pbb_mappin context_loop = SESE_ENTRY (region)->src->loop_father; newivs_index = htab_create (10, clast_name_index_elt_info, eq_clast_name_indexes, free_clast_name_index); - params_index = htab_create (10, clast_name_index_elt_info, - eq_clast_name_indexes, free_clast_name_index); - - create_params_index (scop, params_index, pc.prog); ip.newivs = &newivs; ip.newivs_index = newivs_index; @@ -1663,7 +1586,7 @@ gloog (scop_p scop, htab_t bb_pbb_mappin ip.params_index = params_index; ip.region = region; - translate_clast (context_loop, pc.stmt, if_region->true_region->entry, + translate_clast (context_loop, clast, if_region->true_region->entry, bb_pbb_mapping, 0, &ip); graphite_verify (); scev_reset (); @@ -1680,8 +1603,7 @@ gloog (scop_p scop, htab_t bb_pbb_mappin htab_delete (newivs_index); htab_delete (params_index); VEC_free (tree, heap, newivs); - cloog_clast_free (pc.stmt); - cloog_program_free (pc.prog); + cloog_clast_free (clast); timevar_pop (TV_GRAPHITE_CODE_GEN); if (dump_file && (dump_flags & TDF_DETAILS)) Index: gcc/graphite-clast-to-gimple.h =================================================================== --- gcc/graphite-clast-to-gimple.h (revision 188887) +++ gcc/graphite-clast-to-gimple.h (working copy) @@ -41,7 +41,6 @@ typedef struct bb_pbb_def } bb_pbb_def; extern bool gloog (scop_p, htab_t); -extern cloog_prog_clast scop_to_clast (scop_p); extern void debug_clast_stmt (struct clast_stmt *); extern void print_clast_stmt (FILE *, struct clast_stmt *); Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (revision 188887) +++ gcc/Makefile.in (working copy) @@ -2622,7 +2622,7 @@ graphite-clast-to-gimple.o : graphite-cl $(GRAPHITE_PPL_H) graphite-poly.h graphite-clast-to-gimple.h \ graphite-dependences.h graphite-cloog-compat.h graphite-cloog-util.o : graphite-cloog-util.c $(CONFIG_H) $(SYSTEM_H) \ - coretypes.h graphite-cloog-util.h graphite-cloog-compat.h + coretypes.h graphite-cloog-util.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 \