Commit f8bf9252 by Sebastian Pop Committed by Sebastian Pop

backport: configure: Regenerate.

2008-09-02  Sebastian Pop  <sebastian.pop@amd.com>
	    Tobias Grosser  <grosser@fim.uni-passau.de>
	    Jan Sjodin  <jan.sjodin@amd.com>
	    Harsha Jagasia  <harsha.jagasia@amd.com>
	    Dwarakanath Rajagopal  <dwarak.rajagopal@amd.com>
	    Konrad Trifunovic  <konrad.trifunovic@inria.fr>
	    Adrien Eliche  <aeliche@isty.uvsq.fr>

	Merge from graphite branch.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* configure.ac (host_libs): Add ppl and cloog.
	Add checks for PPL and CLooG.
	* Makefile.def (ppl, cloog): Added modules and dependences.
	* Makefile.tpl (PPLLIBS, PPLINC, CLOOGLIBS, CLOOGINC): New.
	(HOST_PPLLIBS, HOST_PPLINC, HOST_CLOOGLIBS, HOST_CLOOGINC): New.

gcc/
	* graphite.c: New.
	* graphite.h: New.
	* tree-loop-linear.c (perfect_loop_nest_depth): Export.
	* doc/invoke.texi (-floop-block, -floop-interchange,
	-floop-strip-mine): Document new flags.
	* tree-into-ssa.c (gimple_vec): Moved...
	* tree-loop-distribution.c (rdg_component): Moved...
	* cfgloopmanip.c: Include tree-flow.h.
	(update_dominators_in_loop): New.
	(create_empty_if_region_on_edge): New.
	(create_empty_loop_on_edge): New.
	(loopify): Use update_dominators_in_loop.
	* tree-pass.h (pass_graphite_transforms): Declared.
	* configure: Regenerate.
	* tree-phinodes.c (make_phi_node): Export.
	(add_phi_node_to_bb): New, split from create_phi_node.
	* tree-chrec.c (for_each_scev_op): New.
	* tree-chrec.h (for_each_scev_op): Declared.
	* tree-ssa-loop-ivopts.c (get_phi_with_result): New.
	(remove_statement): Call get_phi_with_result.
	* config.in (HAVE_cloog): Undef.
	* gdbinit.in (pgg): New.
	* timevar.def (TV_GRAPHITE_TRANSFORMS): New.
	* tree-ssa-loop.c (graphite_transforms): New.
	(gate_graphite_transforms): New.
	(pass_graphite_transforms): New.
	* configure.ac (PPLLIBS, PPLINC, CLOOGLIBS, CLOOGINC,
	HAVE_cloog): Defined.
	* tree-vectorizer.c (rename_variables_in_bb): Export.
	* tree-data-ref.c (dr_may_alias_p): Export.
	(stmt_simple_memref_p): New.
	(find_data_references_in_stmt): Export.
	(find_data_references_in_loop): Export.
	(create_rdg_edge_for_ddr): Initialize RDGE_RELATION.
	(create_rdg_edges_for_scalar): Initialize RDGE_RELATION.
	(create_rdg_vertices): Export.
	(build_empty_rdg): New.
	(build_rdg): Call build_empty_rdg.  Free dependence_relations.
	* tree-data-ref.h (rdg_component): ... here.
	(scop_p): New.
	(struct data_reference): Add a field scop.
	(DR_SCOP): New.
	(find_data_references_in_loop): Declared.
	(find_data_references_in_stmt): Declared.
	(create_rdg_vertices): Declared.
	(dr_may_alias_p): Declared.
	(stmt_simple_memref_p): Declared.
	(struct rdg_edge): Add a field ddr_p relation.
	(build_empty_rdg): Declared.
	* lambda.h (lambda_matrix): Declare a VEC of.
	(find_induction_var_from_exit_cond): Declared.
	(lambda_vector_compare): New.
	* common.opt (fgraphite, floop-strip-mine,
	floop-interchange, floop-block): New flags.
	* lambda-code.c (find_induction_var_from_exit_cond): Export.
	* cfgloop.c (is_loop_exit): New.
	* cfgloop.h (is_loop_exit): Declared.
	(create_empty_if_region_on_edge): Declared.
	(create_empty_loop_on_edge): Declared.
	* tree-flow.h (add_phi_node_to_bb): Declared.
	(make_phi_node): Declared.
	(rename_variables_in_bb): Declared.
	(perfect_loop_nest_depth): Declared.
	(graphite_transform_loops): Declared.
	* Makefile.in (cfgloopmanip.o): Depend on TREE_FLOW_H.
	(graphite.o-warn): Add -Wno-error.
	(PPLLIBS, PPLINC, CLOOGLIBS, CLOOGINC): Declared.
	(LIBS): Add GMPLIBS, CLOOGLIBS, PPLLIBS.
	(INCLUDES): Add PPLINC, CLOOGINC.
	(OBJS-common): Add graphite.o.
	(graphite.o): Add rule.
	* gimple.h (gimple_vec): ... here.
	* tree-cfg.c (print_loops): Start printing at ENTRY_BLOCK_PTR.
	* passes.c (init_optimization_passes): Schedule 
	pass_graphite_transforms.

testsuite/

	* gcc.dg/graphite/scop-{0,1,2,3,4,5,6,7,8,9,
	10,11,12,13,14,15,16,17,18}.c: New.
	* gcc.dg/graphite/graphite.exp: New.
	* gcc.dg/graphite/scop-matmult.c: New.
	* gcc.dg/graphite/block-0.c: New.
	* lib/target-supports.exp (check_effective_target_fgraphite): New.
	* gfortran.dg/graphite/block-1.f90: New.
	* gfortran.dg/graphite/scop-{1,2}.f: New.
	* gfortran.dg/graphite/block-{1,3,4}.f90: New.
	* gfortran.dg/graphite/graphite.exp: New.


Co-Authored-By: Adrien Eliche <aeliche@isty.uvsq.fr>
Co-Authored-By: Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
Co-Authored-By: Harsha Jagasia <harsha.jagasia@amd.com>
Co-Authored-By: Jan Sjodin <jan.sjodin@amd.com>
Co-Authored-By: Konrad Trifunovic <konrad.trifunovic@inria.fr>
Co-Authored-By: Tobias Grosser <grosser@fim.uni-passau.de>

From-SVN: r139893
parent 57b08d04
2008-09-02 Sebastian Pop <sebastian.pop@amd.com>
Tobias Grosser <grosser@fim.uni-passau.de>
Jan Sjodin <jan.sjodin@amd.com>
Harsha Jagasia <harsha.jagasia@amd.com>
Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
Konrad Trifunovic <konrad.trifunovic@inria.fr>
Adrien Eliche <aeliche@isty.uvsq.fr>
Merge from graphite branch.
* configure: Regenerate.
* Makefile.in: Regenerate.
* configure.ac (host_libs): Add ppl and cloog.
Add checks for PPL and CLooG.
* Makefile.def (ppl, cloog): Added modules and dependences.
* Makefile.tpl (PPLLIBS, PPLINC, CLOOGLIBS, CLOOGINC): New.
(HOST_PPLLIBS, HOST_PPLINC, HOST_CLOOGLIBS, HOST_CLOOGINC): New.
2008-08-31 Aaron W. LaFramboise <aaronavay62@aaronwl.com> 2008-08-31 Aaron W. LaFramboise <aaronavay62@aaronwl.com>
* configure.ac (RPATH_ENVVAR): Use PATH on Windows. * configure.ac (RPATH_ENVVAR): Use PATH on Windows.
......
...@@ -68,6 +68,16 @@ host_modules= { module= mpfr; lib_path=.libs; bootstrap=true; ...@@ -68,6 +68,16 @@ host_modules= { module= mpfr; lib_path=.libs; bootstrap=true;
no_install= true; no_install= true;
host="none-${host_vendor}-${host_os}"; host="none-${host_vendor}-${host_os}";
target="none-${host_vendor}-${host_os}"; }; target="none-${host_vendor}-${host_os}"; };
host_modules= { module= ppl; lib_path=.libs; bootstrap=true;
extra_configure_flags='--disable-shared --with-libgmp-prefix=$$r/$(HOST_SUBDIR)/gmp/ --with-libgmpxx-prefix=$$r/$(HOST_SUBDIR)/gmp/';
no_install= true;
host="none-${host_vendor}-${host_os}";
target="none-${host_vendor}-${host_os}"; };
host_modules= { module= cloog; lib_path=.libs; bootstrap=true;
extra_configure_flags='--disable-shared --with-gmp-library=$$r/$(HOST_SUBDIR)/gmp/.libs --with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-ppl=$$r/$(HOST_SUBDIR)/ppl/ --with-bits=gmp';
no_install= true;
host="none-${host_vendor}-${host_os}";
target="none-${host_vendor}-${host_os}"; };
host_modules= { module= gnuserv; }; host_modules= { module= gnuserv; };
host_modules= { module= gold; bootstrap=true; }; host_modules= { module= gold; bootstrap=true; };
host_modules= { module= gprof; }; host_modules= { module= gprof; };
...@@ -295,6 +305,8 @@ dependencies = { module=all-gcc; on=all-libiberty; hard=true; }; ...@@ -295,6 +305,8 @@ dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
dependencies = { module=all-gcc; on=all-gmp; }; dependencies = { module=all-gcc; on=all-gmp; };
dependencies = { module=all-gcc; on=all-intl; }; dependencies = { module=all-gcc; on=all-intl; };
dependencies = { module=all-gcc; on=all-mpfr; }; dependencies = { module=all-gcc; on=all-mpfr; };
dependencies = { module=all-gcc; on=all-ppl; };
dependencies = { module=all-gcc; on=all-cloog; };
dependencies = { module=all-gcc; on=all-build-texinfo; }; dependencies = { module=all-gcc; on=all-build-texinfo; };
dependencies = { module=all-gcc; on=all-build-bison; }; dependencies = { module=all-gcc; on=all-build-bison; };
dependencies = { module=all-gcc; on=all-build-byacc; }; dependencies = { module=all-gcc; on=all-build-byacc; };
...@@ -318,6 +330,9 @@ dependencies = { module=all-fixincludes; on=all-libiberty; }; ...@@ -318,6 +330,9 @@ dependencies = { module=all-fixincludes; on=all-libiberty; };
dependencies = { module=all-gnattools; on=all-target-libada; }; dependencies = { module=all-gnattools; on=all-target-libada; };
dependencies = { module=configure-mpfr; on=all-gmp; }; dependencies = { module=configure-mpfr; on=all-gmp; };
dependencies = { module=configure-ppl; on=all-gmp; };
dependencies = { module=configure-ppl; on=all-mpfr; };
dependencies = { module=configure-cloog; on=all-ppl; };
// Host modules specific to gdb. // Host modules specific to gdb.
dependencies = { module=configure-gdb; on=all-intl; }; dependencies = { module=configure-gdb; on=all-intl; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -199,6 +199,10 @@ HOST_EXPORTS = \ ...@@ -199,6 +199,10 @@ HOST_EXPORTS = \
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \ GMPINC="$(HOST_GMPINC)"; export GMPINC; \
PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
PPLINC="$(HOST_PPLINC)"; export PPLINC; \
CLOOGLIBS="$(HOST_CLOOGLIBS)"; export CLOOGLIBS; \
CLOOGINC="$(HOST_CLOOGINC)"; export CLOOGINC; \
@if gcc-bootstrap @if gcc-bootstrap
$(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \
@endif gcc-bootstrap @endif gcc-bootstrap
...@@ -258,6 +262,14 @@ NORMAL_TARGET_EXPORTS = \ ...@@ -258,6 +262,14 @@ NORMAL_TARGET_EXPORTS = \
HOST_GMPLIBS = @gmplibs@ HOST_GMPLIBS = @gmplibs@
HOST_GMPINC = @gmpinc@ HOST_GMPINC = @gmpinc@
# Where to find PPL
HOST_PPLLIBS = @ppllibs@
HOST_PPLINC = @pplinc@
# Where to find CLOOG
HOST_CLOOGLIBS = @clooglibs@
HOST_CLOOGINC = @clooginc@
# ---------------------------------------------- # ----------------------------------------------
# Programs producing files for the BUILD machine # Programs producing files for the BUILD machine
# ---------------------------------------------- # ----------------------------------------------
......
...@@ -158,7 +158,7 @@ build_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fix ...@@ -158,7 +158,7 @@ build_tools="build-texinfo build-byacc build-flex build-bison build-m4 build-fix
# these libraries are used by various programs built for the host environment # these libraries are used by various programs built for the host environment
# #
host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr" host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr ppl cloog"
# these tools are built for the host environment # these tools are built for the host environment
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
...@@ -1310,6 +1310,97 @@ fi ...@@ -1310,6 +1310,97 @@ fi
AC_SUBST(gmplibs) AC_SUBST(gmplibs)
AC_SUBST(gmpinc) AC_SUBST(gmpinc)
# Check for PPL
ppl_major_version=0
ppl_minor_version=10
ppllibs=
pplinc=
AC_ARG_WITH(ppl, [ --with-ppl=PATH Specify prefix directory for the installed PPL package
Equivalent to --with-ppl-include=PATH/include
plus --with-ppl-lib=PATH/lib])
AC_ARG_WITH(ppl_include, [ --with-ppl-include=PATH Specify directory for installed PPL include files])
AC_ARG_WITH(ppl_lib, [ --with-ppl-lib=PATH Specify the directory for the installed PPL library])
if test "x$with_ppl" != x; then
ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx"
pplinc="-I$with_ppl/include $pplinc"
LIBS="$ppllibs $LIBS"
fi
if test "x$with_ppl_include" != x; then
pplinc="-I$with_ppl_include $pplinc"
fi
if test "x$with_ppl_lib" != x; then
ppllibs="-L$with_ppl_lib -lppl_c -lppl -lgmpxx"
LIBS="$ppllibs $LIBS"
fi
if test "x$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then
ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/.libs -L$$r/$(HOST_SUBDIR)/ppl/_libs -lppl_c -lppl -lgmpxx '
pplinc='-I$$r/$(HOST_SUBDIR)/ppl/include -I$$s/ppl/include '
LIBS="$ppllibs $LIBS"
fi
# Flags needed for PPL
AC_SUBST(ppllibs)
AC_SUBST(pplinc)
# Check for CLOOG
clooglibs=
clooginc=
AC_ARG_WITH(cloog, [ --with-cloog=PATH Specify prefix directory for the installed CLOOG package
Equivalent to --with-cloog-include=PATH/include
plus --with-cloog-lib=PATH/lib])
AC_ARG_WITH(cloog_include, [ --with-cloog-include=PATH Specify directory for installed CLOOG include files])
AC_ARG_WITH(cloog_lib, [ --with-cloog-lib=PATH Specify the directory for the installed CLOOG library])
if test "x$with_cloog" != x; then
clooglibs="-L$with_cloog/lib -lcloog"
clooginc="-I$with_cloog/include -DCLOOG_PPL_BACKEND "
LIBS="$clooglibs $LIBS"
fi
if test "x$with_cloog_include" != x; then
clooginc="-I$with_cloog_include -DCLOOG_PPL_BACKEND "
fi
if test "x$with_cloog_lib" != x; then
clooglibs="-L$with_cloog_lib -lcloog"
LIBS="$clooglibs $LIBS"
fi
if test "x$with_cloog$with_cloog_include$with_cloog_lib" = x && test -d ${srcdir}/cloog; then
clooglibs='-L$$r/$(HOST_SUBDIR)/cloog/.libs -L$$r/$(HOST_SUBDIR)/cloog/_libs -lcloog '
clooginc='-I$$r/$(HOST_SUBDIR)/cloog/include -I$$s/cloog/include -DCLOOG_PPL_BACKEND '
LIBS="$clooglibs $LIBS"
fi
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $pplinc $gmpinc"
AC_MSG_CHECKING([for version $ppl_major_version.$ppl_minor_version of PPL])
AC_TRY_COMPILE([#include "ppl_c.h"],[
#if PPL_VERSION_MAJOR != $ppl_major_version || PPL_VERSION_MINOR != $ppl_minor_version
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); clooglibs= ; clooginc= ])
CFLAGS="$saved_CFLAGS"
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $clooginc $gmpinc $pplinc"
AC_MSG_CHECKING([for correct version of CLooG])
AC_TRY_COMPILE([#include "cloog/cloog.h"],[
#if CLOOG_VERSION_MAJOR != 0 || CLOOG_VERSION_MINOR != 15
choke me
#endif
], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); clooglibs= ; clooginc= ])
CFLAGS="$saved_CFLAGS"
# Flags needed for CLOOG
AC_SUBST(clooglibs)
AC_SUBST(clooginc)
# By default, C is the only stage 1 language. # By default, C is the only stage 1 language.
stage1_languages=,c, stage1_languages=,c,
......
...@@ -183,6 +183,8 @@ dfp.o-warn = -Wno-error ...@@ -183,6 +183,8 @@ dfp.o-warn = -Wno-error
bitmap.o-warn = -Wno-error bitmap.o-warn = -Wno-error
# dominance.c contains a -Wc++compat warning. # dominance.c contains a -Wc++compat warning.
dominance.o-warn = -Wno-error dominance.o-warn = -Wno-error
# graphite.c contains code calling cloog that has problems.
graphite.o-warn = -Wno-error
# All warnings have to be shut off in stage1 if the compiler used then # All warnings have to be shut off in stage1 if the compiler used then
# isn't gcc; configure determines that. WARN_CFLAGS will be either # isn't gcc; configure determines that. WARN_CFLAGS will be either
...@@ -281,6 +283,14 @@ ZLIBINC = @zlibinc@ ...@@ -281,6 +283,14 @@ ZLIBINC = @zlibinc@
GMPLIBS = @GMPLIBS@ GMPLIBS = @GMPLIBS@
GMPINC = @GMPINC@ GMPINC = @GMPINC@
# How to find PPL
PPLLIBS = @PPLLIBS@
PPLINC = @PPLINC@
# How to find CLOOG
CLOOGLIBS = @CLOOGLIBS@
CLOOGINC = @CLOOGINC@
CPPLIB = ../libcpp/libcpp.a CPPLIB = ../libcpp/libcpp.a
CPPINC = -I$(srcdir)/../libcpp/include CPPINC = -I$(srcdir)/../libcpp/include
...@@ -891,7 +901,8 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) ...@@ -891,7 +901,8 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
# How to link with both our special library facilities # How to link with both our special library facilities
# and the system's installed libraries. # and the system's installed libraries.
LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \
$(GMPLIBS) $(CLOOGLIBS) $(PPLLIBS)
# Any system libraries needed just for GNAT. # Any system libraries needed just for GNAT.
SYSLIBS = @GNAT_LIBEXC@ SYSLIBS = @GNAT_LIBEXC@
...@@ -920,7 +931,8 @@ BUILD_ERRORS = build/errors.o ...@@ -920,7 +931,8 @@ BUILD_ERRORS = build/errors.o
# libintl.h will be found in ../intl if we are using the included libintl. # libintl.h will be found in ../intl if we are using the included libintl.
INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
-I$(srcdir)/../include @INCINTL@ \ -I$(srcdir)/../include @INCINTL@ \
$(CPPINC) $(GMPINC) $(DECNUMINC) $(CPPINC) $(GMPINC) $(DECNUMINC) \
$(PPLINC) $(CLOOGINC)
.c.o: .c.o:
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION) $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
...@@ -1094,6 +1106,7 @@ OBJS-common = \ ...@@ -1094,6 +1106,7 @@ OBJS-common = \
global.o \ global.o \
graph.o \ graph.o \
graphds.o \ graphds.o \
graphite.o \
gtype-desc.o \ gtype-desc.o \
haifa-sched.o \ haifa-sched.o \
hooks.o \ hooks.o \
...@@ -2340,6 +2353,10 @@ tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ ...@@ -2340,6 +2353,10 @@ tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
$(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h langhooks.h $(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h langhooks.h
graphite.o: graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) domwalk.h \
$(TREE_DATA_REF_H) $(SCEV_H) tree-pass.h tree-chrec.h graphite.h pointer-set.h
tree-vect-analyze.o: tree-vect-analyze.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ tree-vect-analyze.o: tree-vect-analyze.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RECOG_H) $(BASIC_BLOCK_H) \ $(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RECOG_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \ $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
......
...@@ -1620,3 +1620,18 @@ single_exit (const struct loop *loop) ...@@ -1620,3 +1620,18 @@ single_exit (const struct loop *loop)
else else
return NULL; return NULL;
} }
/* Returns true when BB has an edge exiting LOOP. */
bool
is_loop_exit (struct loop *loop, basic_block bb)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
if (loop_exit_edge_p (loop, e))
return true;
return false;
}
...@@ -228,6 +228,7 @@ extern int num_loop_insns (const struct loop *); ...@@ -228,6 +228,7 @@ extern int num_loop_insns (const struct loop *);
extern int average_num_loop_insns (const struct loop *); extern int average_num_loop_insns (const struct loop *);
extern unsigned get_loop_level (const struct loop *); extern unsigned get_loop_level (const struct loop *);
extern bool loop_exit_edge_p (const struct loop *, const_edge); extern bool loop_exit_edge_p (const struct loop *, const_edge);
extern bool is_loop_exit (struct loop *, basic_block);
extern void mark_loop_exit_edges (void); extern void mark_loop_exit_edges (void);
/* Loops & cfg manipulation. */ /* Loops & cfg manipulation. */
...@@ -284,6 +285,9 @@ extern bool can_duplicate_loop_p (const struct loop *loop); ...@@ -284,6 +285,9 @@ extern bool can_duplicate_loop_p (const struct loop *loop);
#define DLTHE_FLAG_COMPLETTE_PEEL 4 /* Update frequencies expecting #define DLTHE_FLAG_COMPLETTE_PEEL 4 /* Update frequencies expecting
a complete peeling. */ a complete peeling. */
extern edge create_empty_if_region_on_edge (edge, tree);
extern struct loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree,
tree *, struct loop *);
extern struct loop * duplicate_loop (struct loop *, struct loop *); extern struct loop * duplicate_loop (struct loop *, struct loop *);
extern bool duplicate_loop_to_header_edge (struct loop *, edge, extern bool duplicate_loop_to_header_edge (struct loop *, edge,
unsigned, sbitmap, edge, unsigned, sbitmap, edge,
......
...@@ -547,6 +547,22 @@ Common Report Var(flag_gcse_after_reload) Optimization ...@@ -547,6 +547,22 @@ Common Report Var(flag_gcse_after_reload) Optimization
Perform global common subexpression elimination after register allocation Perform global common subexpression elimination after register allocation
has finished has finished
fgraphite
Common Report Var(flag_graphite)
Enable in and out of Graphite representation
floop-strip-mine
Common Report Var(flag_loop_strip_mine) Optimization
Enable Loop Strip Mining transformation
floop-interchange
Common Report Var(flag_loop_interchange) Optimization
Enable Loop Interchange transformation
floop-block
Common Report Var(flag_loop_block) Optimization
Enable Loop Blocking transformation
fguess-branch-probability fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities Enable guessing of branch probabilities
......
...@@ -1327,6 +1327,12 @@ ...@@ -1327,6 +1327,12 @@
#endif #endif
/* Define if cloog is in use. */
#ifndef USED_FOR_TARGET
#undef HAVE_cloog
#endif
/* Define as const if the declaration of iconv() needs const. */ /* Define as const if the declaration of iconv() needs const. */
#ifndef USED_FOR_TARGET #ifndef USED_FOR_TARGET
#undef ICONV_CONST #undef ICONV_CONST
......
...@@ -3883,6 +3883,15 @@ fi ...@@ -3883,6 +3883,15 @@ fi
AC_ARG_VAR(GMPLIBS,[How to link GMP]) AC_ARG_VAR(GMPLIBS,[How to link GMP])
AC_ARG_VAR(GMPINC,[How to find GMP include files]) AC_ARG_VAR(GMPINC,[How to find GMP include files])
AC_ARG_VAR(PPLLIBS,[How to link PPL])
AC_ARG_VAR(PPLINC,[How to find PPL include files])
AC_ARG_VAR(CLOOGLIBS,[How to link CLOOG])
AC_ARG_VAR(CLOOGINC,[How to find CLOOG include files])
if test "x${CLOOGLIBS}" != "x" ; then
AC_DEFINE(HAVE_cloog, 1, [Define if cloog is in use.])
fi
# Configure the subdirectories # Configure the subdirectories
# AC_CONFIG_SUBDIRS($subdirs) # AC_CONFIG_SUBDIRS($subdirs)
......
...@@ -338,6 +338,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -338,6 +338,7 @@ Objective-C and Objective-C++ Dialects}.
-fira-coalesce -fno-ira-share-save-slots @gol -fira-coalesce -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
-fivopts -fkeep-inline-functions -fkeep-static-consts @gol -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
-floop-block -floop-interchange -floop-strip-mine @gol
-fmerge-all-constants -fmerge-constants -fmodulo-sched @gol -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
-fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
-fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
...@@ -6012,6 +6013,81 @@ at @option{-O} and higher. ...@@ -6012,6 +6013,81 @@ at @option{-O} and higher.
Perform linear loop transformations on tree. This flag can improve cache Perform linear loop transformations on tree. This flag can improve cache
performance and allow further loop optimizations to take place. performance and allow further loop optimizations to take place.
@item -floop-interchange
Perform loop interchange transformations on loops. Interchanging two
nested loops switches the inner and outer loops. For example, given a
loop like:
@smallexample
DO J = 1, M
DO I = 1, N
A(J, I) = A(J, I) * C
ENDDO
ENDDO
@end smallexample
loop interchange will transform the loop as if the user had written:
@smallexample
DO I = 1, N
DO J = 1, M
A(J, I) = A(J, I) * C
ENDDO
ENDDO
@end smallexample
which can be beneficial when @code{N} is larger than the caches,
because in Fortran, the elements of an array are stored in memory
contiguously by column, and the original loop iterates over rows,
potentially creating at each access a cache miss. This optimization
applies to all the languages supported by GCC and is not limited to
Fortran.
@item -floop-strip-mine
Perform loop strip mining transformations on loops. Strip mining
splits a loop into two nested loops. The outer loop has strides
equal to the strip size and the inner loop has strides of the
original loop within a strip. For example, given a loop like:
@smallexample
DO I = 1, N
A(I) = A(I) + C
ENDDO
@end smallexample
loop strip mining will transform the loop as if the user had written:
@smallexample
DO II = 1, N, 4
DO I = II, min (II + 4, N)
A(I) = A(I) + C
ENDDO
ENDDO
@end smallexample
This optimization applies to all the languages supported by GCC and is
not limited to Fortran.
@item -floop-block
Perform loop blocking transformations on loops. Blocking strip mines
each loop in the loop nest such that the memory accesses of the
element loops fit inside caches. For example, given a loop like:
@smallexample
DO I = 1, N
DO J = 1, M
A(J, I) = B(I) + C(J)
ENDDO
ENDDO
@end smallexample
loop blocking will transform the loop as if the user had written:
@smallexample
DO II = 1, N, 64
DO JJ = 1, M, 64
DO I = II, min (II + 64, N)
DO J = JJ, min (JJ + 64, M)
A(J, I) = B(I) + C(J)
ENDDO
ENDDO
ENDDO
ENDDO
@end smallexample
which can be beneficial when @code{M} is larger than the caches,
because the innermost loop will iterate over a smaller amount of data
that can be kept in the caches. This optimization applies to all the
languages supported by GCC and is not limited to Fortran.
@item -fcheck-data-deps @item -fcheck-data-deps
@opindex fcheck-data-deps @opindex fcheck-data-deps
Compare the results of several data dependence analyzers. This option Compare the results of several data dependence analyzers. This option
......
...@@ -40,6 +40,15 @@ Print the tree that is $ in C syntax. ...@@ -40,6 +40,15 @@ Print the tree that is $ in C syntax.
Works only when an inferior is executing. Works only when an inferior is executing.
end end
define pgg
set debug_gimple_stmt ($)
end
document pgg
Print the Gimple statement that is $ in C syntax.
Works only when an inferior is executing.
end
define pgs define pgs
set debug_generic_stmt ($) set debug_generic_stmt ($)
end end
......
...@@ -38,6 +38,12 @@ DEF_VEC_P(gimple_seq); ...@@ -38,6 +38,12 @@ DEF_VEC_P(gimple_seq);
DEF_VEC_ALLOC_P(gimple_seq,gc); DEF_VEC_ALLOC_P(gimple_seq,gc);
DEF_VEC_ALLOC_P(gimple_seq,heap); DEF_VEC_ALLOC_P(gimple_seq,heap);
/* For each block, the PHI nodes that need to be rewritten are stored into
these vectors. */
typedef VEC(gimple, heap) *gimple_vec;
DEF_VEC_P (gimple_vec);
DEF_VEC_ALLOC_P (gimple_vec, heap);
enum gimple_code { enum gimple_code {
#define DEFGSCODE(SYM, STRING, STRUCT) SYM, #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
#include "gimple.def" #include "gimple.def"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
...@@ -147,7 +147,6 @@ static lambda_lattice lambda_lattice_new (int, int, struct obstack *); ...@@ -147,7 +147,6 @@ static lambda_lattice lambda_lattice_new (int, int, struct obstack *);
static lambda_lattice lambda_lattice_compute_base (lambda_loopnest, static lambda_lattice lambda_lattice_compute_base (lambda_loopnest,
struct obstack *); struct obstack *);
static tree find_induction_var_from_exit_cond (struct loop *);
static bool can_convert_to_perfect_nest (struct loop *); static bool can_convert_to_perfect_nest (struct loop *);
/* Create a new lambda body vector. */ /* Create a new lambda body vector. */
...@@ -1434,7 +1433,7 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth, ...@@ -1434,7 +1433,7 @@ gcc_loop_to_lambda_loop (struct loop *loop, int depth,
/* Given a LOOP, find the induction variable it is testing against in the exit /* Given a LOOP, find the induction variable it is testing against in the exit
condition. Return the induction variable if found, NULL otherwise. */ condition. Return the induction variable if found, NULL otherwise. */
static tree tree
find_induction_var_from_exit_cond (struct loop *loop) find_induction_var_from_exit_cond (struct loop *loop)
{ {
gimple expr = get_loop_exit_condition (loop); gimple expr = get_loop_exit_condition (loop);
......
...@@ -39,6 +39,9 @@ DEF_VEC_ALLOC_P (lambda_vector_vec_p, heap); ...@@ -39,6 +39,9 @@ DEF_VEC_ALLOC_P (lambda_vector_vec_p, heap);
all vectors are the same length). */ all vectors are the same length). */
typedef lambda_vector *lambda_matrix; typedef lambda_vector *lambda_matrix;
DEF_VEC_P (lambda_matrix);
DEF_VEC_ALLOC_P (lambda_matrix, heap);
/* A transformation matrix, which is a self-contained ROWSIZE x COLSIZE /* A transformation matrix, which is a self-contained ROWSIZE x COLSIZE
matrix. Rather than use floats, we simply keep a single DENOMINATOR that matrix. Rather than use floats, we simply keep a single DENOMINATOR that
represents the denominator for every element in the matrix. */ represents the denominator for every element in the matrix. */
...@@ -213,6 +216,7 @@ void lambda_loopnest_to_gcc_loopnest (struct loop *, ...@@ -213,6 +216,7 @@ void lambda_loopnest_to_gcc_loopnest (struct loop *,
lambda_loopnest, lambda_trans_matrix, lambda_loopnest, lambda_trans_matrix,
struct obstack *); struct obstack *);
void remove_iv (gimple); void remove_iv (gimple);
tree find_induction_var_from_exit_cond (struct loop *);
static inline void lambda_vector_negate (lambda_vector, lambda_vector, int); static inline void lambda_vector_negate (lambda_vector, lambda_vector, int);
static inline void lambda_vector_mult_const (lambda_vector, lambda_vector, int, int); static inline void lambda_vector_mult_const (lambda_vector, lambda_vector, int, int);
...@@ -374,6 +378,33 @@ lambda_vector_matrix_mult (lambda_vector vect, int m, lambda_matrix mat, ...@@ -374,6 +378,33 @@ lambda_vector_matrix_mult (lambda_vector vect, int m, lambda_matrix mat,
dest[i] += mat[j][i] * vect[j]; dest[i] += mat[j][i] * vect[j];
} }
/* Compare two vectors returning an integer less than, equal to, or
greater than zero if the first argument is considered to be respectively
less than, equal to, or greater than the second.
We use the lexicographic order. */
static inline int
lambda_vector_compare (lambda_vector vec1, int length1, lambda_vector vec2,
int length2)
{
int min_length;
int i;
if (length1 < length2)
min_length = length1;
else
min_length = length2;
for (i = 0; i < min_length; i++)
if (vec1[i] < vec2[i])
return -1;
else if (vec1[i] > vec2[i])
return 1;
else
continue;
return length1 - length2;
}
/* Print out a vector VEC of length N to OUTFILE. */ /* Print out a vector VEC of length N to OUTFILE. */
......
...@@ -655,6 +655,7 @@ init_optimization_passes (void) ...@@ -655,6 +655,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_check_data_deps); NEXT_PASS (pass_check_data_deps);
NEXT_PASS (pass_loop_distribution); NEXT_PASS (pass_loop_distribution);
NEXT_PASS (pass_linear_transform); NEXT_PASS (pass_linear_transform);
NEXT_PASS (pass_graphite_transforms);
NEXT_PASS (pass_iv_canon); NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_if_conversion); NEXT_PASS (pass_if_conversion);
NEXT_PASS (pass_vectorize); NEXT_PASS (pass_vectorize);
......
2008-09-02 Sebastian Pop <sebastian.pop@amd.com>
Tobias Grosser <grosser@fim.uni-passau.de>
Jan Sjodin <jan.sjodin@amd.com>
Harsha Jagasia <harsha.jagasia@amd.com>
Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
Konrad Trifunovic <konrad.trifunovic@inria.fr>
Adrien Eliche <aeliche@isty.uvsq.fr>
Merge from graphite branch.
* gcc.dg/graphite/scop-{0,1,2,3,4,5,6,7,8,9,
10,11,12,13,14,15,16,17,18}.c: New.
* gcc.dg/graphite/graphite.exp: New.
* gcc.dg/graphite/scop-matmult.c: New.
* gcc.dg/graphite/block-0.c: New.
* lib/target-supports.exp (check_effective_target_fgraphite): New.
* gfortran.dg/graphite/block-1.f90: New.
* gfortran.dg/graphite/scop-{1,2}.f: New.
* gfortran.dg/graphite/block-{1,3,4}.f90: New.
* gfortran.dg/graphite/graphite.exp: New.
2008-09-02 Richard Guenther <rguenther@suse.de> 2008-09-02 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37327 PR tree-optimization/37327
......
/* { dg-options "-O -floop-block -fdump-tree-graphite-all" } */
#define N 1000
int toto()
{
int j;
int i;
int a[N];
int b[N];
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
a[j] = a[i] + 1;
return a[0];
}
main()
{
return toto();
}
/* { dg-final { scan-tree-dump-times "Loop blocked" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
#define MAX 8192
int main()
{
int i, j;
int sum = 0;
int A[MAX * MAX];
int B[MAX * MAX];
for (i = 0; i < MAX; i++)
for (j = 0; j < MAX; j++)
{
A[i*MAX + j] = j;
B[i*MAX + j] = j;
}
for (i = 0; i < MAX; i++)
for (j = 0; j < MAX; j++)
A[i*MAX + j] += B[j*MAX + i];
for(i = 0; i < MAX; i++)
for(j = 0; j < MAX; j++)
sum += A[i*MAX + j];
return sum;
}
/* { dg-final { scan-tree-dump-times "Loop blocked" 3 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# GCC testsuite that uses the `dg.exp' driver.
# Load support procs.
load_lib gcc-dg.exp
if ![check_effective_target_fgraphite] {
return
}
# The default action for a test is 'compile'. Save current default.
global dg-do-what-default
set save-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default compile
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS " -ansi -pedantic-errors"
}
# Initialize `dg'.
dg-init
# Main loop.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
"" $DEFAULT_CFLAGS
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
# All done.
dg-finish
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
int foo (void);
void bar (void);
int toto()
{
/* Scop 1. */
int i, j, k;
int a[100][100];
int b[100];
int N = foo ();
for (i = 0; i < 2*N+ 100; i++)
for (j = 0; j < 200; j++)
a[j][i] = a[j+1][10] + 2;
return a[3][5] + b[1];
/* End scop 1. */
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
a[j][i] = a[j+1][i-1] + 2;
b[i] = b[i-1] + 2;
bar ();
for (j = 1; j < 100; j++)
a[j][i] = a[j+1][i-1] + 2;
b[i] = a[i-1][i] + 2;
for (j = 1; j < 100; j++)
a[j][i] = a[j+1][i-1] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
bar ();
else
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
a[i][i] = 2;
}
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-5] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar ();
int toto()
{
int i,j, b;
int a[100];
if (i == 20)
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 3;
bar();
}
else
{
if (i == 30)
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 5;
}
}
for (j = 0; j <= 20; j++)
a[j] = b + i;
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar ();
int toto()
{
int i,j, b;
int a[100];
switch (i)
{
case 5:
for (j = 0; j <= 20; j++)
a[j] = b + i + 12;
break;
case 8:
for (j = 0; j <= 20; j++)
a[j] = b + i + 122;
break;
case 15:
for (j = 0; j <= 20; j++)
a[j] = b + i + 12;
break;
case 18:
for (j = 0; j <= 20; j++)
a[j] = b + i + 4;
break;
default:
for (j = 0; j <= 20; j++)
a[j] = b + i + 3;
}
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 5" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar ();
int toto()
{
int i,j, b;
int a[100];
if (i == 20)
{
b = 3;
goto B;
}
else
{
if (i == 30)
{
a[i] = b;
for (j = 0; j <= 20; j++)
a[j] = b + i;
B:
for (j = 0; j <= 20; j++)
a[j+b] = b + i;
bar ();
}
else
{
a[i] = b + 3;
}
}
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar ();
int toto()
{
int i,j, b;
int a[100];
for (j = 0; j <= 20; j++)
{
a[j] = b + i;
if (j * i == b)
break;
a[j+b] = b + i;
}
a[i] = b + 3;
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
# define EXTERN(type, array) extern type array[]
typedef unsigned char uch;
typedef unsigned short ush;
EXTERN(uch, window);
EXTERN(ush, prev);
#ifndef WSIZE
# define WSIZE 0x8000
#endif
#define MIN_MATCH 3
#define MAX_MATCH 258
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
#define MAX_DIST (WSIZE-MIN_LOOKAHEAD)
#define near
typedef unsigned IPos;
unsigned near max_chain_length;
extern unsigned near strstart;
unsigned int near prev_length;
#define NIL 0
unsigned near good_match;
int near nice_match;
#define WMASK (WSIZE-1)
int longest_match(IPos cur_match)
{
unsigned chain_length = max_chain_length;
register uch *scan = window + strstart;
register uch *match;
register int len;
int best_len = prev_length;
IPos limit = strstart > (IPos)MAX_DIST ? strstart - (IPos)MAX_DIST : NIL;
register uch *strend = window + strstart + MAX_MATCH;
register uch scan_end = scan[best_len];
if (prev_length >= good_match) {
}
do {
if (match[best_len] != scan_end ||
*++match != scan[1]) continue;
do {
} while (*++scan == *++match && *++scan == *++match &&
scan < strend);
len = MAX_MATCH - (int)(strend - scan);
if (len > best_len) {
best_len = len;
if (len >= nice_match) break;
}
} while ((cur_match = prev[cur_match & WMASK]) > limit
&& --chain_length != 0);
return best_len;
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
#define N 10000
void foo (int);
int test ()
{
int a[N][N];
int b[N][N];
unsigned i, j;
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
a[i][j] = i*j;
for (j = 1; j < N; j++)
for (i = 0; i < N; i++)
a[i][j] = a[i][j-1] + b[i][j];
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
foo (a[i][j]);
}
/* Interchange is legal for loops 0 and 1 of the first two SCoPs */
/* { dg-final { scan-tree-dump-times "Interchange valid for loops 0 and 1:" 2 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
#define N 10000
void foo (int);
int test ()
{
int a[N][N];
unsigned i, j;
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
a[i][j] = i*j;
for (i = 1; i < N; i++)
for (j = 1; j < (N-1) ; j++)
a[i][j] = a[i-1][j+1] * a[i-1][j+1]/2;
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
foo (a[i][j]);
}
/* Interchange is not legal for loops 0 and 1 of SCoP 2. */
/* { dg-final { scan-tree-dump-times "Interchange not valid for loops 0 and 1:" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
#define N 24
#define M 1000
float A[1000][1000], B[1000][1000], C[1000][1000];
void test (void)
{
int i, j, k;
/* These loops contain too few iterations for being strip-mined by 64. */
for (i = 0; i < 24; i++)
for (j = 0; j < 24; j++)
for (k = 0; k < 24; k++)
A[i][j] += B[i][k] * C[k][j];
/* These loops should still be strip mined. */
for (i = 0; i < 1000; i++)
for (j = 0; j < 1000; j++)
for (k = 0; k < 1000; k++)
A[i][j] += B[i][k] * C[k][j];
}
/* { dg-final { scan-tree-dump-times "Strip Mining is not profitable" 3 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
for (k = 1; k < 100; k++)
a[j][k] = a[j+1][i-1] + 2;
b[i] = b[i-1] + 2;
bar ();
for (j = 1; j < 100; j++)
a[j][i] = a[j+1][i-1] + 2;
b[i] = b[i-1] + 2;
bar ();
for (j = 1; j < 100; j++)
a[j][i] = a[j+1][i-1] + 2;
b[i] = a[i-1][i] + 2;
for (j = 1; j < 100; j++)
a[j][i] = a[j+1][i-1] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 4" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 80; j++)
a[j][i] = a[j+1][2*i-1*j] + 12;
b[i] = b[i-1] + 10;
for (j = 1; j < 60; j++)
a[j][i] = a[j+1][i-1] + 8;
if (i == 23)
b[i] = a[i-1][i] + 6;
for (j = 1; j < 40; j++)
a[j][i] = a[j+1][i-1] + 4;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar ();
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 80; j++)
a[j][i] = a[j+1][2*i-1*j] + 12;
b[i] = b[i-1] + 10;
for (j = 1; j < 60; j++)
a[j][i] = a[j+1][i-1] + 8;
bar ();
if (i == 23)
b[i] = a[i-1][i] + 6;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar ();
int toto()
{
int i,j, b;
int a[100];
if (i == 20)
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 3;
bar();
}
else
{
if (i == 30)
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 5;
}
else
{
for (j = 0; j <= 20; j++)
a[j] = b + i;
b = 8;
}
}
return a[b];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
b[i+k] = b[i+k-1] + 2;
else
{
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-1] + 2;
bar ();
}
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-5] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
{
bar ();
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
}
else
a[i][i] = 2;
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-5] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
int bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
{
for (j = 1; j < 100; j++)
if (bar ())
b[i+j] = b[i+j-1] + 2;
}
else
a[i][i] = 2;
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-5] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
void bar (void);
int toto()
{
int i, j, k;
int a[100][100];
int b[100];
for (i = 1; i < 100; i++)
{
for (j = 1; j < 100; j++)
b[i+j] = b[i+j-1] + 2;
if (i * 2 == i + 8)
bar ();
else
a[i][i] = 2;
for (k = 1; k < 100; k++)
b[i+k] = b[i+k-5] + 2;
}
return a[3][5] + b[1];
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
float A[1000][1000], B[1000][1000], C[1000][1000];
/* Multiply two n x n matrices A and B and store the result in C. */
void matmult (int n)
{
int i,j,k;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
for (k = 0; k < n; k++)
A[i][j] += B[i][k] * C[k][j];
}
/* This one fails because the number of iterations cannot be
determined anymore for the outermost loop. */
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
subroutine matrix_multiply(a,b,c,n)
real(8), dimension(n,n) :: a,b,c
! The following code is disabled for the moment.
! c=0.d0
end subroutine matrix_multiply
! { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }
! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
SUBROUTINE MATRIX_MUL_UNROLLED (A, B, C, L, M, N)
DIMENSION A(L,M), B(M,N), C(L,N)
DO 100 K = 1, N
DO 100 I = 1, L
C(I,K) = 0.
100 CONTINUE
DO 110 J = 1, M, 4
DO 110 K = 1, N
DO 110 I = 1, L
C(I,K) = C(I,K) + A(I,J) * B(J,K)
$ + A(I,J+1) * B(J+1,K) + A(I,J+2) * B(J+2,K)
$ + A(I,J+3) * B(J+3,K)
110 CONTINUE
RETURN
END
! { dg-final { scan-tree-dump-times "Loop blocked" 3 "graphite" { xfail { "*-*-*" } } } }
! { dg-final { cleanup-tree-dump "graphite" } }
! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
subroutine matrix_multiply(a,b,c,n)
real(8), dimension(n,n) :: a,b,c
do i = 1,n
do j = 1,n
do k = 1,n
c(j,i) = c(j,i) + a(k,i) * b(j,k)
enddo
enddo
enddo
end subroutine matrix_multiply
! { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }
! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
subroutine matrix_multiply(a,b,c,n)
real(8), dimension(n,n) :: a,b,c
! The following code is disabled for the moment.
! c=0.d0
do i = 1,n
do j = 1,n
do k = 1,n
c(j,i) = c(j,i) + a(k,i) * b(j,k)
enddo
enddo
enddo
end subroutine matrix_multiply
! { dg-final { scan-tree-dump-times "Loop blocked" 2 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }
# Copyright (C) 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# GCC testsuite that uses the `dg.exp' driver.
# Load support procs.
load_lib gfortran-dg.exp
if ![check_effective_target_fgraphite] {
return
}
# The default action for a test is 'compile'. Save current default.
global dg-do-what-default
set save-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default compile
# If a testcase doesn't have special options, use these.
set DEFAULT_GRAPHITE_FLAGS ""
# Initialize `dg'.
dg-init
# Main loop.
gfortran-dg-runtest [lsort \
[glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] $DEFAULT_GRAPHITE_FLAGS
gfortran-dg-runtest [lsort \
[glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] $DEFAULT_GRAPHITE_FLAGS
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
# All done.
dg-finish
C { dg-options "-O2 -fgraphite" }
dimension p1(2),t(6,4),b1(2),b2(2),al1(2),al2(2),g1(2),g2(2)
save
if(nlin.eq.0) then
do 20 l=1,2
ll=2*l
b2(l)=t(6-ll,ll-1)*t(6-ll,ll-1)+t(7-ll,ll-1)*t(7-ll,ll-1)
write(*,*) b2(l)
20 continue
endif
end
...@@ -562,6 +562,15 @@ proc check_effective_target_tls_runtime {} { ...@@ -562,6 +562,15 @@ proc check_effective_target_tls_runtime {} {
}] }]
} }
# Return 1 if compilation with -fgraphite is error-free for trivial
# code, 0 otherwise.
proc check_effective_target_fgraphite {} {
return [check_no_compiler_messages fgraphite object {
void foo (void) { }
} "-fgraphite"]
}
# Return 1 if compilation with -fopenmp is error-free for trivial # Return 1 if compilation with -fopenmp is error-free for trivial
# code, 0 otherwise. # code, 0 otherwise.
......
...@@ -125,6 +125,7 @@ DEFTIMEVAR (TV_TREE_LOOP_UNSWITCH , "tree loop unswitching") ...@@ -125,6 +125,7 @@ DEFTIMEVAR (TV_TREE_LOOP_UNSWITCH , "tree loop unswitching")
DEFTIMEVAR (TV_COMPLETE_UNROLL , "complete unrolling") DEFTIMEVAR (TV_COMPLETE_UNROLL , "complete unrolling")
DEFTIMEVAR (TV_TREE_PARALLELIZE_LOOPS, "tree parallelize loops") DEFTIMEVAR (TV_TREE_PARALLELIZE_LOOPS, "tree parallelize loops")
DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree vectorization") DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree vectorization")
DEFTIMEVAR (TV_GRAPHITE_TRANSFORMS , "GRAPHITE loop transforms")
DEFTIMEVAR (TV_TREE_LINEAR_TRANSFORM , "tree loop linear") DEFTIMEVAR (TV_TREE_LINEAR_TRANSFORM , "tree loop linear")
DEFTIMEVAR (TV_TREE_LOOP_DISTRIBUTION, "tree loop distribution") DEFTIMEVAR (TV_TREE_LOOP_DISTRIBUTION, "tree loop distribution")
DEFTIMEVAR (TV_CHECK_DATA_DEPS , "tree check data dependences") DEFTIMEVAR (TV_CHECK_DATA_DEPS , "tree check data dependences")
......
...@@ -6140,7 +6140,7 @@ print_loops (FILE *file, int verbosity) ...@@ -6140,7 +6140,7 @@ print_loops (FILE *file, int verbosity)
{ {
basic_block bb; basic_block bb;
bb = BASIC_BLOCK (NUM_FIXED_BLOCKS); bb = ENTRY_BLOCK_PTR;
if (bb && bb->loop_father) if (bb && bb->loop_father)
print_loop_and_siblings (file, bb->loop_father, 0, verbosity); print_loop_and_siblings (file, bb->loop_father, 0, verbosity);
} }
......
...@@ -1407,3 +1407,26 @@ scev_direction (const_tree chrec) ...@@ -1407,3 +1407,26 @@ scev_direction (const_tree chrec)
else else
return EV_DIR_GROWS; return EV_DIR_GROWS;
} }
/* Iterates over all the components of SCEV, and calls CBCK. */
void
for_each_scev_op (tree *scev, bool (*cbck) (tree *, void *), void *data)
{
switch (TREE_CODE_LENGTH (TREE_CODE (*scev)))
{
case 3:
for_each_scev_op (&TREE_OPERAND (*scev, 2), cbck, data);
case 2:
for_each_scev_op (&TREE_OPERAND (*scev, 1), cbck, data);
case 1:
for_each_scev_op (&TREE_OPERAND (*scev, 0), cbck, data);
default:
cbck (scev, data);
break;
}
}
...@@ -70,6 +70,7 @@ extern tree evolution_part_in_loop_num (tree, unsigned); ...@@ -70,6 +70,7 @@ extern tree evolution_part_in_loop_num (tree, unsigned);
extern tree hide_evolution_in_other_loops_than_loop (tree, unsigned); extern tree hide_evolution_in_other_loops_than_loop (tree, unsigned);
extern tree reset_evolution_in_loop (unsigned, tree, tree); extern tree reset_evolution_in_loop (unsigned, tree, tree);
extern tree chrec_merge (tree, tree); extern tree chrec_merge (tree, tree);
extern void for_each_scev_op (tree *, bool (*) (tree *, void *), void *);
/* Observers. */ /* Observers. */
extern bool eq_evolutions_p (const_tree, const_tree); extern bool eq_evolutions_p (const_tree, const_tree);
......
...@@ -1224,7 +1224,7 @@ disjoint_objects_p (tree a, tree b) ...@@ -1224,7 +1224,7 @@ disjoint_objects_p (tree a, tree b)
/* Returns false if we can prove that data references A and B do not alias, /* Returns false if we can prove that data references A and B do not alias,
true otherwise. */ true otherwise. */
static bool bool
dr_may_alias_p (const struct data_reference *a, const struct data_reference *b) dr_may_alias_p (const struct data_reference *a, const struct data_reference *b)
{ {
const_tree addr_a = DR_BASE_ADDRESS (a); const_tree addr_a = DR_BASE_ADDRESS (a);
...@@ -3303,6 +3303,21 @@ access_functions_are_affine_or_constant_p (const struct data_reference *a, ...@@ -3303,6 +3303,21 @@ access_functions_are_affine_or_constant_p (const struct data_reference *a,
return true; return true;
} }
/* Return true if we can create an affine data-ref for OP in STMT. */
bool
stmt_simple_memref_p (struct loop *loop, gimple stmt, tree op)
{
data_reference_p dr;
dr = create_data_ref (loop, op, stmt, true);
if (!access_functions_are_affine_or_constant_p (dr, loop))
return false;
free_data_ref (dr);
return true;
}
/* Initializes an equation for an OMEGA problem using the information /* Initializes an equation for an OMEGA problem using the information
contained in the ACCESS_FUN. Returns true when the operation contained in the ACCESS_FUN. Returns true when the operation
succeeded. succeeded.
...@@ -4069,9 +4084,9 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references) ...@@ -4069,9 +4084,9 @@ get_references_in_stmt (gimple stmt, VEC (data_ref_loc, heap) **references)
/* Stores the data references in STMT to DATAREFS. If there is an unanalyzable /* Stores the data references in STMT to DATAREFS. If there is an unanalyzable
reference, returns false, otherwise returns true. NEST is the outermost reference, returns false, otherwise returns true. NEST is the outermost
loop of the loop nest in that the references should be analyzed. */ loop of the loop nest in which the references should be analyzed. */
static bool bool
find_data_references_in_stmt (struct loop *nest, gimple stmt, find_data_references_in_stmt (struct loop *nest, gimple stmt,
VEC (data_reference_p, heap) **datarefs) VEC (data_reference_p, heap) **datarefs)
{ {
...@@ -4116,7 +4131,7 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt, ...@@ -4116,7 +4131,7 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
TODO: This function should be made smarter so that it can handle address TODO: This function should be made smarter so that it can handle address
arithmetic as if they were array accesses, etc. */ arithmetic as if they were array accesses, etc. */
static tree tree
find_data_references_in_loop (struct loop *loop, find_data_references_in_loop (struct loop *loop,
VEC (data_reference_p, heap) **datarefs) VEC (data_reference_p, heap) **datarefs)
{ {
...@@ -4644,6 +4659,7 @@ create_rdg_edge_for_ddr (struct graph *rdg, ddr_p ddr) ...@@ -4644,6 +4659,7 @@ create_rdg_edge_for_ddr (struct graph *rdg, ddr_p ddr)
e->data = XNEW (struct rdg_edge); e->data = XNEW (struct rdg_edge);
RDGE_LEVEL (e) = level; RDGE_LEVEL (e) = level;
RDGE_RELATION (e) = ddr;
/* Determines the type of the data dependence. */ /* Determines the type of the data dependence. */
if (DR_IS_READ (dra) && DR_IS_READ (drb)) if (DR_IS_READ (dra) && DR_IS_READ (drb))
...@@ -4676,6 +4692,7 @@ create_rdg_edges_for_scalar (struct graph *rdg, tree def, int idef) ...@@ -4676,6 +4692,7 @@ create_rdg_edges_for_scalar (struct graph *rdg, tree def, int idef)
e = add_edge (rdg, idef, use); e = add_edge (rdg, idef, use);
e->data = XNEW (struct rdg_edge); e->data = XNEW (struct rdg_edge);
RDGE_TYPE (e) = flow_dd; RDGE_TYPE (e) = flow_dd;
RDGE_RELATION (e) = NULL;
} }
} }
...@@ -4701,7 +4718,7 @@ create_rdg_edges (struct graph *rdg, VEC (ddr_p, heap) *ddrs) ...@@ -4701,7 +4718,7 @@ create_rdg_edges (struct graph *rdg, VEC (ddr_p, heap) *ddrs)
/* Build the vertices of the reduced dependence graph RDG. */ /* Build the vertices of the reduced dependence graph RDG. */
static void void
create_rdg_vertices (struct graph *rdg, VEC (gimple, heap) *stmts) create_rdg_vertices (struct graph *rdg, VEC (gimple, heap) *stmts)
{ {
int i, j; int i, j;
...@@ -4826,6 +4843,21 @@ hash_stmt_vertex_del (void *e) ...@@ -4826,6 +4843,21 @@ hash_stmt_vertex_del (void *e)
scalar dependence. */ scalar dependence. */
struct graph * struct graph *
build_empty_rdg (int n_stmts)
{
int nb_data_refs = 10;
struct graph *rdg = new_graph (n_stmts);
rdg->indices = htab_create (nb_data_refs, hash_stmt_vertex_info,
eq_stmt_vertex_info, hash_stmt_vertex_del);
return rdg;
}
/* Build the Reduced Dependence Graph (RDG) with one vertex per
statement of the loop nest, and one edge per data dependence or
scalar dependence. */
struct graph *
build_rdg (struct loop *loop) build_rdg (struct loop *loop)
{ {
int nb_data_refs = 10; int nb_data_refs = 10;
...@@ -4842,21 +4874,23 @@ build_rdg (struct loop *loop) ...@@ -4842,21 +4874,23 @@ build_rdg (struct loop *loop)
&dependence_relations); &dependence_relations);
if (!known_dependences_p (dependence_relations)) if (!known_dependences_p (dependence_relations))
goto end_rdg; {
free_dependence_relations (dependence_relations);
free_data_refs (datarefs);
VEC_free (gimple, heap, stmts);
return rdg;
}
stmts_from_loop (loop, &stmts); stmts_from_loop (loop, &stmts);
rdg = new_graph (VEC_length (gimple, stmts)); rdg = build_empty_rdg (VEC_length (gimple, stmts));
rdg->indices = htab_create (nb_data_refs, hash_stmt_vertex_info, rdg->indices = htab_create (nb_data_refs, hash_stmt_vertex_info,
eq_stmt_vertex_info, hash_stmt_vertex_del); eq_stmt_vertex_info, hash_stmt_vertex_del);
create_rdg_vertices (rdg, stmts); create_rdg_vertices (rdg, stmts);
create_rdg_edges (rdg, dependence_relations); create_rdg_edges (rdg, dependence_relations);
end_rdg:
free_dependence_relations (dependence_relations);
free_data_refs (datarefs);
VEC_free (gimple, heap, stmts); VEC_free (gimple, heap, stmts);
return rdg; return rdg;
} }
......
...@@ -96,6 +96,8 @@ struct dr_alias ...@@ -96,6 +96,8 @@ struct dr_alias
bitmap vops; bitmap vops;
}; };
typedef struct scop *scop_p;
/* Each vector of the access matrix represents a linear access /* Each vector of the access matrix represents a linear access
function for a subscript. First elements correspond to the function for a subscript. First elements correspond to the
leftmost indices, ie. for a[i][j] the first vector corresponds to leftmost indices, ie. for a[i][j] the first vector corresponds to
...@@ -170,16 +172,20 @@ struct data_reference ...@@ -170,16 +172,20 @@ struct data_reference
/* Behavior of the memory reference in the innermost loop. */ /* Behavior of the memory reference in the innermost loop. */
struct innermost_loop_behavior innermost; struct innermost_loop_behavior innermost;
/* Decomposition to indices for alias analysis. */ /* Subscripts of this data reference. */
struct indices indices; struct indices indices;
/* Alias information for the data reference. */ /* Alias information for the data reference. */
struct dr_alias alias; struct dr_alias alias;
/* The SCoP in which the data reference was analyzed. */
scop_p scop;
/* Matrix representation for the data access functions. */ /* Matrix representation for the data access functions. */
struct access_matrix *access_matrix; struct access_matrix *access_matrix;
}; };
#define DR_SCOP(DR) (DR)->scop
#define DR_STMT(DR) (DR)->stmt #define DR_STMT(DR) (DR)->stmt
#define DR_REF(DR) (DR)->ref #define DR_REF(DR) (DR)->ref
#define DR_BASE_OBJECT(DR) (DR)->indices.base_object #define DR_BASE_OBJECT(DR) (DR)->indices.base_object
...@@ -373,6 +379,8 @@ void dr_analyze_innermost (struct data_reference *); ...@@ -373,6 +379,8 @@ void dr_analyze_innermost (struct data_reference *);
extern bool compute_data_dependences_for_loop (struct loop *, bool, extern bool compute_data_dependences_for_loop (struct loop *, bool,
VEC (data_reference_p, heap) **, VEC (data_reference_p, heap) **,
VEC (ddr_p, heap) **); VEC (ddr_p, heap) **);
extern tree find_data_references_in_loop (struct loop *,
VEC (data_reference_p, heap) **);
extern void print_direction_vector (FILE *, lambda_vector, int); extern void print_direction_vector (FILE *, lambda_vector, int);
extern void print_dir_vectors (FILE *, VEC (lambda_vector, heap) *, int); extern void print_dir_vectors (FILE *, VEC (lambda_vector, heap) *, int);
extern void print_dist_vectors (FILE *, VEC (lambda_vector, heap) *, int); extern void print_dist_vectors (FILE *, VEC (lambda_vector, heap) *, int);
...@@ -392,10 +400,18 @@ extern void free_dependence_relation (struct data_dependence_relation *); ...@@ -392,10 +400,18 @@ extern void free_dependence_relation (struct data_dependence_relation *);
extern void free_dependence_relations (VEC (ddr_p, heap) *); extern void free_dependence_relations (VEC (ddr_p, heap) *);
extern void free_data_ref (data_reference_p); extern void free_data_ref (data_reference_p);
extern void free_data_refs (VEC (data_reference_p, heap) *); extern void free_data_refs (VEC (data_reference_p, heap) *);
extern bool find_data_references_in_stmt (struct loop *, gimple,
VEC (data_reference_p, heap) **);
struct data_reference *create_data_ref (struct loop *, tree, gimple, bool); struct data_reference *create_data_ref (struct loop *, tree, gimple, bool);
bool find_loop_nest (struct loop *, VEC (loop_p, heap) **); extern bool find_loop_nest (struct loop *, VEC (loop_p, heap) **);
void compute_all_dependences (VEC (data_reference_p, heap) *, extern void compute_all_dependences (VEC (data_reference_p, heap) *,
VEC (ddr_p, heap) **, VEC (loop_p, heap) *, bool); VEC (ddr_p, heap) **, VEC (loop_p, heap) *,
bool);
extern void create_rdg_vertices (struct graph *, VEC (gimple, heap) *);
extern bool dr_may_alias_p (const struct data_reference *,
const struct data_reference *);
extern bool stmt_simple_memref_p (struct loop *, gimple, tree);
/* Return true when the DDR contains two data references that have the /* Return true when the DDR contains two data references that have the
same access functions. */ same access functions. */
...@@ -511,15 +527,21 @@ typedef struct rdg_edge ...@@ -511,15 +527,21 @@ typedef struct rdg_edge
/* Type of the dependence. */ /* Type of the dependence. */
enum rdg_dep_type type; enum rdg_dep_type type;
/* Levels of the dependence: the depth of the loops that /* Levels of the dependence: the depth of the loops that carry the
carry the dependence. */ dependence. */
unsigned level; unsigned level;
/* Dependence relation between data dependences, NULL when one of
the vertices is a scalar. */
ddr_p relation;
} *rdg_edge_p; } *rdg_edge_p;
#define RDGE_TYPE(E) ((struct rdg_edge *) ((E)->data))->type #define RDGE_TYPE(E) ((struct rdg_edge *) ((E)->data))->type
#define RDGE_LEVEL(E) ((struct rdg_edge *) ((E)->data))->level #define RDGE_LEVEL(E) ((struct rdg_edge *) ((E)->data))->level
#define RDGE_RELATION(E) ((struct rdg_edge *) ((E)->data))->relation
struct graph *build_rdg (struct loop *); struct graph *build_rdg (struct loop *);
struct graph *build_empty_rdg (int);
void free_rdg (struct graph *); void free_rdg (struct graph *);
/* Return the index of the variable VAR in the LOOP_NEST array. */ /* Return the index of the variable VAR in the LOOP_NEST array. */
...@@ -561,7 +583,21 @@ void lambda_collect_parameters (VEC (data_reference_p, heap) *, ...@@ -561,7 +583,21 @@ void lambda_collect_parameters (VEC (data_reference_p, heap) *,
bool lambda_compute_access_matrices (VEC (data_reference_p, heap) *, bool lambda_compute_access_matrices (VEC (data_reference_p, heap) *,
VEC (tree, heap) *, int); VEC (tree, heap) *, int);
/* In tree-data-refs.c */ /* In tree-data-ref.c */
void split_constant_offset (tree , tree *, tree *); void split_constant_offset (tree , tree *, tree *);
/* Strongly connected components of the reduced data dependence graph. */
typedef struct rdg_component
{
int num;
VEC (int, heap) *vertices;
} *rdgc;
DEF_VEC_P (rdgc);
DEF_VEC_ALLOC_P (rdgc, heap);
DEF_VEC_P (bitmap);
DEF_VEC_ALLOC_P (bitmap, heap);
#endif /* GCC_TREE_DATA_REF_H */ #endif /* GCC_TREE_DATA_REF_H */
...@@ -786,6 +786,8 @@ extern gimple get_single_def_stmt_with_phi (tree, gimple); ...@@ -786,6 +786,8 @@ extern gimple get_single_def_stmt_with_phi (tree, gimple);
/* In tree-phinodes.c */ /* In tree-phinodes.c */
extern void reserve_phi_args_for_new_edge (basic_block); extern void reserve_phi_args_for_new_edge (basic_block);
extern void add_phi_node_to_bb (gimple phi, basic_block bb);
extern gimple make_phi_node (tree var, int len);
extern gimple create_phi_node (tree, basic_block); extern gimple create_phi_node (tree, basic_block);
extern void add_phi_arg (gimple, tree, edge); extern void add_phi_arg (gimple, tree, edge);
extern void remove_phi_args (edge); extern void remove_phi_args (edge);
...@@ -1023,6 +1025,7 @@ bool gimple_duplicate_loop_to_header_edge (struct loop *, edge, ...@@ -1023,6 +1025,7 @@ bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
int); int);
struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge); struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
void rename_variables_in_loop (struct loop *); void rename_variables_in_loop (struct loop *);
void rename_variables_in_bb (basic_block bb);
struct loop *tree_ssa_loop_version (struct loop *, tree, struct loop *tree_ssa_loop_version (struct loop *, tree,
basic_block *); basic_block *);
tree expand_simple_operations (tree); tree expand_simple_operations (tree);
...@@ -1116,6 +1119,10 @@ bool sra_type_can_be_decomposed_p (tree); ...@@ -1116,6 +1119,10 @@ bool sra_type_can_be_decomposed_p (tree);
/* In tree-loop-linear.c */ /* In tree-loop-linear.c */
extern void linear_transform_loops (void); extern void linear_transform_loops (void);
extern unsigned perfect_loop_nest_depth (struct loop *);
/* In graphite.c */
extern void graphite_transform_loops (void);
/* In tree-data-ref.c */ /* In tree-data-ref.c */
extern void tree_check_data_deps (void); extern void tree_check_data_deps (void);
......
...@@ -130,12 +130,6 @@ static bitmap mem_syms_to_rename; ...@@ -130,12 +130,6 @@ static bitmap mem_syms_to_rename;
released after we finish updating the SSA web. */ released after we finish updating the SSA web. */
static bitmap names_to_release; static bitmap names_to_release;
/* For each block, the PHI nodes that need to be rewritten are stored into
these vectors. */
typedef VEC(gimple, heap) *gimple_vec;
DEF_VEC_P (gimple_vec);
DEF_VEC_ALLOC_P (gimple_vec, heap);
static VEC(gimple_vec, heap) *phis_to_rewrite; static VEC(gimple_vec, heap) *phis_to_rewrite;
/* The bitmap of non-NULL elements of PHIS_TO_REWRITE. */ /* The bitmap of non-NULL elements of PHIS_TO_REWRITE. */
......
...@@ -710,17 +710,6 @@ rdg_flag_loop_exits (struct graph *rdg, bitmap loops, bitmap partition, ...@@ -710,17 +710,6 @@ rdg_flag_loop_exits (struct graph *rdg, bitmap loops, bitmap partition,
} }
} }
/* Strongly connected components of the reduced data dependence graph. */
typedef struct rdg_component
{
int num;
VEC (int, heap) *vertices;
} *rdgc;
DEF_VEC_P (rdgc);
DEF_VEC_ALLOC_P (rdgc, heap);
/* Flag all the nodes of RDG containing memory accesses that could /* Flag all the nodes of RDG containing memory accesses that could
potentially belong to arrays already accessed in the current potentially belong to arrays already accessed in the current
PARTITION. */ PARTITION. */
...@@ -864,9 +853,6 @@ rdg_build_components (struct graph *rdg, VEC (int, heap) *starting_vertices, ...@@ -864,9 +853,6 @@ rdg_build_components (struct graph *rdg, VEC (int, heap) *starting_vertices,
BITMAP_FREE (saved_components); BITMAP_FREE (saved_components);
} }
DEF_VEC_P (bitmap);
DEF_VEC_ALLOC_P (bitmap, heap);
/* Aggregate several components into a useful partition that is /* Aggregate several components into a useful partition that is
registered in the PARTITIONS vector. Partitions will be registered in the PARTITIONS vector. Partitions will be
distributed in different loops. */ distributed in different loops. */
......
...@@ -272,7 +272,7 @@ try_interchange_loops (lambda_trans_matrix trans, ...@@ -272,7 +272,7 @@ try_interchange_loops (lambda_trans_matrix trans,
/* Return the number of nested loops in LOOP_NEST, or 0 if the loops /* Return the number of nested loops in LOOP_NEST, or 0 if the loops
are not perfectly nested. */ are not perfectly nested. */
static unsigned int unsigned int
perfect_loop_nest_depth (struct loop *loop_nest) perfect_loop_nest_depth (struct loop *loop_nest)
{ {
struct loop *temp; struct loop *temp;
......
...@@ -322,6 +322,7 @@ extern struct gimple_opt_pass pass_iv_canon; ...@@ -322,6 +322,7 @@ extern struct gimple_opt_pass pass_iv_canon;
extern struct gimple_opt_pass pass_scev_cprop; extern struct gimple_opt_pass pass_scev_cprop;
extern struct gimple_opt_pass pass_empty_loop; extern struct gimple_opt_pass pass_empty_loop;
extern struct gimple_opt_pass pass_record_bounds; extern struct gimple_opt_pass pass_record_bounds;
extern struct gimple_opt_pass pass_graphite_transforms;
extern struct gimple_opt_pass pass_if_conversion; extern struct gimple_opt_pass pass_if_conversion;
extern struct gimple_opt_pass pass_loop_distribution; extern struct gimple_opt_pass pass_loop_distribution;
extern struct gimple_opt_pass pass_vectorize; extern struct gimple_opt_pass pass_vectorize;
......
...@@ -202,10 +202,9 @@ ideal_phi_node_len (int len) ...@@ -202,10 +202,9 @@ ideal_phi_node_len (int len)
return new_len; return new_len;
} }
/* Return a PHI node with LEN argument slots for variable VAR. */ /* Return a PHI node with LEN argument slots for variable VAR. */
static gimple gimple
make_phi_node (tree var, int len) make_phi_node (tree var, int len)
{ {
gimple phi; gimple phi;
...@@ -348,15 +347,12 @@ reserve_phi_args_for_new_edge (basic_block bb) ...@@ -348,15 +347,12 @@ reserve_phi_args_for_new_edge (basic_block bb)
} }
} }
/* Adds PHI to BB. */
/* Create a new PHI node for variable VAR at basic block BB. */ void
add_phi_node_to_bb (gimple phi, basic_block bb)
gimple
create_phi_node (tree var, basic_block bb)
{ {
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
gimple phi = make_phi_node (var, EDGE_COUNT (bb->preds));
/* Add the new PHI node to the list of PHI nodes for block BB. */ /* Add the new PHI node to the list of PHI nodes for block BB. */
if (phi_nodes (bb) == NULL) if (phi_nodes (bb) == NULL)
set_phi_nodes (bb, gimple_seq_alloc ()); set_phi_nodes (bb, gimple_seq_alloc ());
...@@ -367,6 +363,16 @@ create_phi_node (tree var, basic_block bb) ...@@ -367,6 +363,16 @@ create_phi_node (tree var, basic_block bb)
/* Associate BB to the PHI node. */ /* Associate BB to the PHI node. */
gimple_set_bb (phi, bb); gimple_set_bb (phi, bb);
}
/* Create a new PHI node for variable VAR at basic block BB. */
gimple
create_phi_node (tree var, basic_block bb)
{
gimple phi = make_phi_node (var, EDGE_COUNT (bb->preds));
add_phi_node_to_bb (phi, bb);
return phi; return phi;
} }
......
...@@ -5021,18 +5021,38 @@ create_new_ivs (struct ivopts_data *data, struct iv_ca *set) ...@@ -5021,18 +5021,38 @@ create_new_ivs (struct ivopts_data *data, struct iv_ca *set)
} }
} }
/* Returns the phi-node in BB with result RESULT. */
static gimple
get_phi_with_result (basic_block bb, tree result)
{
gimple_stmt_iterator i = gsi_start_phis (bb);
for (; !gsi_end_p (i); gsi_next (&i))
if (gimple_phi_result (gsi_stmt (i)) == result)
return gsi_stmt (i);
gcc_unreachable ();
return NULL;
}
/* Removes statement STMT (real or a phi node). If INCLUDING_DEFINED_NAME /* Removes statement STMT (real or a phi node). If INCLUDING_DEFINED_NAME
is true, remove also the ssa name defined by the statement. */ is true, remove also the ssa name defined by the statement. */
static void static void
remove_statement (gimple stmt, bool including_defined_name) remove_statement (gimple stmt, bool including_defined_name)
{ {
gimple_stmt_iterator bsi = gsi_for_stmt (stmt);
if (gimple_code (stmt) == GIMPLE_PHI) if (gimple_code (stmt) == GIMPLE_PHI)
remove_phi_node (&bsi, including_defined_name); {
gimple bb_phi = get_phi_with_result (gimple_bb (stmt),
gimple_phi_result (stmt));
gimple_stmt_iterator bsi = gsi_for_stmt (bb_phi);
remove_phi_node (&bsi, including_defined_name);
}
else else
{ {
gimple_stmt_iterator bsi = gsi_for_stmt (stmt);
gsi_remove (&bsi, true); gsi_remove (&bsi, true);
release_defs (stmt); release_defs (stmt);
} }
......
...@@ -287,6 +287,49 @@ struct gimple_opt_pass pass_linear_transform = ...@@ -287,6 +287,49 @@ struct gimple_opt_pass pass_linear_transform =
} }
}; };
/* GRAPHITE optimizations. */
static unsigned int
graphite_transforms (void)
{
if (!current_loops)
return 0;
graphite_transform_loops ();
return 0;
}
static bool
gate_graphite_transforms (void)
{
/* Enable -fgraphite pass if any one of the graphite optimization flags
is turned on. */
if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine)
flag_graphite = 1;
return flag_graphite != 0;
}
struct gimple_opt_pass pass_graphite_transforms =
{
{
GIMPLE_PASS,
"graphite", /* name */
gate_graphite_transforms, /* gate */
graphite_transforms, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_GRAPHITE_TRANSFORMS, /* tv_id */
PROP_cfg | PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_verify_loops /* todo_flags_finish */
}
};
/* Check the correctness of the data dependence analyzers. */ /* Check the correctness of the data dependence analyzers. */
static unsigned int static unsigned int
......
...@@ -201,7 +201,7 @@ rename_use_op (use_operand_p op_p) ...@@ -201,7 +201,7 @@ rename_use_op (use_operand_p op_p)
/* Renames the variables in basic block BB. */ /* Renames the variables in basic block BB. */
static void void
rename_variables_in_bb (basic_block bb) rename_variables_in_bb (basic_block bb)
{ {
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment