diff options
Diffstat (limited to 'polly')
| -rwxr-xr-x | polly/Makefile.config.in | 1 | ||||
| -rw-r--r-- | polly/autoconf/aclocal.m4 | 3 | ||||
| -rw-r--r-- | polly/autoconf/configure.ac | 7 | ||||
| -rwxr-xr-x | polly/autoconf/m4/find_lib_and_headers.m4 | 3 | ||||
| -rw-r--r-- | polly/cmake/FindIsl.cmake | 5 | ||||
| -rwxr-xr-x | polly/configure | 112 | ||||
| -rwxr-xr-x | polly/include/polly/Config/config.h.cmake | 1 | ||||
| -rw-r--r-- | polly/include/polly/Config/config.h.in | 6 | ||||
| -rwxr-xr-x | polly/lib/CodeGen/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | polly/lib/CodeGen/IslCodeGeneration.cpp | 21 |
10 files changed, 152 insertions, 14 deletions
diff --git a/polly/Makefile.config.in b/polly/Makefile.config.in index 948fcf37cef..f8a014a6c00 100755 --- a/polly/Makefile.config.in +++ b/polly/Makefile.config.in @@ -29,6 +29,7 @@ endif POLLY_CXXFLAGS += "-fno-rtti -fno-exceptions" CLOOG_FOUND := @cloog_found@ +ISL_CODEGEN_FOUND := @isl_codegen_found@ OPENSCOP_FOUND := @openscop_found@ SCOPLIB_FOUND := @scoplib_found@ diff --git a/polly/autoconf/aclocal.m4 b/polly/autoconf/aclocal.m4 index 720f8ee7131..0db70c1a618 100644 --- a/polly/autoconf/aclocal.m4 +++ b/polly/autoconf/aclocal.m4 @@ -36,7 +36,8 @@ AC_DEFUN([find_lib_and_headers], given_lib_path=lib_not_give_$1] ) # Check for library and headers works - AC_MSG_CHECKING([for $1 in $given_inc_path, $given_lib_path]) + AC_MSG_CHECKING([for $1: $2 in $given_inc_path, and lib$3 in $given_lib_path]) + # try to compile a file that includes a header of the library AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <$2>]], [[;]])], [AC_MSG_RESULT([ok]) diff --git a/polly/autoconf/configure.ac b/polly/autoconf/configure.ac index 63600a8e76e..5c34f866435 100644 --- a/polly/autoconf/configure.ac +++ b/polly/autoconf/configure.ac @@ -80,12 +80,17 @@ find_lib_and_headers([gmp], [gmp.h], [gmp], [required]) dnl Find Isl find_lib_and_headers([isl], [isl/config.h], [isl], [required]) +dnl Find whether ISL has a codegen.h file. +find_lib_and_headers([isl], [isl/codegen.h], [isl]) +AS_IF([test "x$isl_found" = "xyes"], + [AC_DEFINE([ISL_CODEGEN_FOUND],[1],[Define if ISL has a code generator])]) + dnl Check that we have cloog. saved_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $gmp_inc $isl_inc" find_lib_and_headers([cloog], [cloog/isl/cloog.h], [cloog-isl], [required]) CXXFLAGS=$saved_CXXFLAGS -AS_IF([test "cloog_found" = "xyes"], +AS_IF([test "x$cloog_found" = "xyes"], [AC_DEFINE([CLOOG_FOUND],[1],[Define if cloog found])]) dnl Check that we have openscop. diff --git a/polly/autoconf/m4/find_lib_and_headers.m4 b/polly/autoconf/m4/find_lib_and_headers.m4 index 88880619ffd..e872819abc2 100755 --- a/polly/autoconf/m4/find_lib_and_headers.m4 +++ b/polly/autoconf/m4/find_lib_and_headers.m4 @@ -23,7 +23,8 @@ AC_DEFUN([find_lib_and_headers], given_lib_path=lib_not_give_$1] ) # Check for library and headers works - AC_MSG_CHECKING([for $1 in $given_inc_path, $given_lib_path]) + AC_MSG_CHECKING([for $1: $2 in $given_inc_path, and lib$3 in $given_lib_path]) + # try to compile a file that includes a header of the library AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <$2>]], [[;]])], [AC_MSG_RESULT([ok]) diff --git a/polly/cmake/FindIsl.cmake b/polly/cmake/FindIsl.cmake index bbebbaa8f88..c739602480a 100644 --- a/polly/cmake/FindIsl.cmake +++ b/polly/cmake/FindIsl.cmake @@ -1,4 +1,9 @@ FIND_PATH(ISL_INCLUDE_DIR isl/set.h) +FIND_PATH(ISL_CODEGEN_DIR isl/codegen.h) + +IF (ISL_CODEGEN_DIR) + SET(ISL_CODEGEN_FOUND TRUE) +ENDIF (ISL_CODEGEN_DIR) FIND_LIBRARY(ISL_LIBRARY NAMES isl) diff --git a/polly/configure b/polly/configure index 93aff2ee856..984c4625d8e 100755 --- a/polly/configure +++ b/polly/configure @@ -2409,8 +2409,9 @@ else fi # Check for library and headers works - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp in $given_inc_path, $given_lib_path" >&5 -$as_echo_n "checking for gmp in $given_inc_path, $given_lib_path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gmp: gmp.h in $given_inc_path, and libgmp in $given_lib_path" >&5 +$as_echo_n "checking for gmp: gmp.h in $given_inc_path, and libgmp in $given_lib_path... " >&6; } + # try to compile a file that includes a header of the library cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2488,8 +2489,9 @@ else fi # Check for library and headers works - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl in $given_inc_path, $given_lib_path" >&5 -$as_echo_n "checking for isl in $given_inc_path, $given_lib_path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl: isl/config.h in $given_inc_path, and libisl in $given_lib_path" >&5 +$as_echo_n "checking for isl: isl/config.h in $given_inc_path, and libisl in $given_lib_path... " >&6; } + # try to compile a file that includes a header of the library cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2541,6 +2543,91 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + OLD_CXXFLAGS=$CXXFLAGS; + OLD_LDFLAGS=$LDFLAGS; + OLD_LIBS=$LIBS; + + LIBS="$LIBS -lisl"; + + # Get include path and lib path + +# Check whether --with-isl was given. +if test "${with_isl+set}" = set; then : + withval=$with_isl; given_inc_path="$withval/include"; CXXFLAGS="-I$given_inc_path $CXXFLAGS"; + given_lib_path="$withval/lib"; LDFLAGS="-L$given_lib_path $LDFLAGS" +else + given_inc_path=inc_not_give_isl; + given_lib_path=lib_not_give_isl + +fi + + # Check for library and headers works + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl: isl/codegen.h in $given_inc_path, and libisl in $given_lib_path" >&5 +$as_echo_n "checking for isl: isl/codegen.h in $given_inc_path, and libisl in $given_lib_path... " >&6; } + + # try to compile a file that includes a header of the library + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <isl/codegen.h> +int +main () +{ +; + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } + isl_found="yes" + + if test "x$given_inc_path" != "xinc_not_give_isl"; then : + isl_inc="-I$given_inc_path" + +fi + isl_lib="-lisl" + + if test "x$given_lib_path" != "xlib_not_give_isl"; then : + isl_ld="-L$given_lib_path" + +fi +else + if test "x" = "xrequired"; then : + as_fn_error $? "isl required but not found" "$LINENO" 5 +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +$as_echo "not found" >&6; } +fi + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + # reset original CXXFLAGS + CXXFLAGS=$OLD_CXXFLAGS + LDFLAGS=$OLD_LDFLAGS; + LIBS=$OLD_LIBS + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test "x$isl_found" = "xyes"; then : + +$as_echo "#define ISL_CODEGEN_FOUND 1" >>confdefs.h + +fi + saved_CXXFLAGS=$CXXFLAGS CXXFLAGS="$CXXFLAGS $gmp_inc $isl_inc" @@ -2569,8 +2656,9 @@ else fi # Check for library and headers works - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cloog in $given_inc_path, $given_lib_path" >&5 -$as_echo_n "checking for cloog in $given_inc_path, $given_lib_path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cloog: cloog/isl/cloog.h in $given_inc_path, and libcloog-isl in $given_lib_path" >&5 +$as_echo_n "checking for cloog: cloog/isl/cloog.h in $given_inc_path, and libcloog-isl in $given_lib_path... " >&6; } + # try to compile a file that includes a header of the library cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2622,7 +2710,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu CXXFLAGS=$saved_CXXFLAGS -if test "cloog_found" = "xyes"; then : +if test "x$cloog_found" = "xyes"; then : $as_echo "#define CLOOG_FOUND 1" >>confdefs.h @@ -2654,8 +2742,9 @@ else fi # Check for library and headers works - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openscop in $given_inc_path, $given_lib_path" >&5 -$as_echo_n "checking for openscop in $given_inc_path, $given_lib_path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openscop: openscop/scop.h in $given_inc_path, and libopenscop in $given_lib_path" >&5 +$as_echo_n "checking for openscop: openscop/scop.h in $given_inc_path, and libopenscop in $given_lib_path... " >&6; } + # try to compile a file that includes a header of the library cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2738,8 +2827,9 @@ else fi # Check for library and headers works - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for scoplib in $given_inc_path, $given_lib_path" >&5 -$as_echo_n "checking for scoplib in $given_inc_path, $given_lib_path... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for scoplib: scoplib/scop.h in $given_inc_path, and libscoplib in $given_lib_path" >&5 +$as_echo_n "checking for scoplib: scoplib/scop.h in $given_inc_path, and libscoplib in $given_lib_path... " >&6; } + # try to compile a file that includes a header of the library cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ diff --git a/polly/include/polly/Config/config.h.cmake b/polly/include/polly/Config/config.h.cmake index 7ae020c6b3a..3f0a9010988 100755 --- a/polly/include/polly/Config/config.h.cmake +++ b/polly/include/polly/Config/config.h.cmake @@ -14,6 +14,7 @@ #define POLLY_CONFIG_H #cmakedefine CLOOG_FOUND +#cmakedefine ISL_CODEGEN_FOUND #cmakedefine OPENSCOP_FOUND #cmakedefine SCOPLIB_FOUND diff --git a/polly/include/polly/Config/config.h.in b/polly/include/polly/Config/config.h.in index bca1dd88a6d..3c3e903c973 100644 --- a/polly/include/polly/Config/config.h.in +++ b/polly/include/polly/Config/config.h.in @@ -1,8 +1,14 @@ /* include/polly/Config/config.h.in. Generated from autoconf/configure.ac by autoheader. */ +/* Define if cloog found */ +#undef CLOOG_FOUND + /* Use gmp for isl */ #undef CLOOG_INT_GMP +/* Define if ISL has a code generator */ +#undef ISL_CODEGEN_FOUND + /* Define if openscop found */ #undef OPENSCOP_FOUND diff --git a/polly/lib/CodeGen/CMakeLists.txt b/polly/lib/CodeGen/CMakeLists.txt index 138f00aa84c..5e7e2ad18ea 100755 --- a/polly/lib/CodeGen/CMakeLists.txt +++ b/polly/lib/CodeGen/CMakeLists.txt @@ -3,8 +3,15 @@ if (CLOOG_FOUND) Cloog.cpp CodeGeneration.cpp) endif (CLOOG_FOUND) + +if (ISL_CODEGEN_FOUND) + set(ISL_CODEGEN_FILES + IslCodeGeneration.cpp) +endif (ISL_CODEGEN_FOUND) + add_polly_library(PollyCodeGen BlockGenerators.cpp ${CLOOG_FILES} + ${ISL_CODEGEN_FILES} LoopGenerators.cpp ) diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp new file mode 100644 index 00000000000..51aaec7d581 --- /dev/null +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -0,0 +1,21 @@ +//===------ IslCodeGeneration.cpp - Code generate the Scops using ISL. ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// The IslCodeGeneration pass takes a Scop created by ScopInfo and translates it +// back to LLVM-IR using the ISL code generator. +// +// The Scop describes the high level memory behaviour of a control flow region. +// Transformation passes can update the schedule (execution order) of statements +// in the Scop. ISL is used to generate an abstract syntax tree that reflects +// the updated execution order. This clast is used to create new LLVM-IR that is +// computationally equivalent to the original control flow region, but executes +// its code in the new execution order defined by the changed scattering. +// +//===----------------------------------------------------------------------===// + |

