Index: Makefile.config.in =================================================================== --- Makefile.config.in +++ Makefile.config.in @@ -46,6 +46,7 @@ # Set include directories POLLY_INC := @cuda_inc@ \ + -I$(POLLY_OBJ_ROOT)/lib/External/isl \ -I$(POLLY_SRC_ROOT)/lib/JSON/include \ -I$(POLLY_SRC_ROOT)/lib/External/isl/include \ -I$(POLLY_SRC_ROOT)/lib/External/isl/imath \ Index: autoconf/configure.ac =================================================================== --- autoconf/configure.ac +++ autoconf/configure.ac @@ -95,6 +95,9 @@ dnl * Create the output files dnl ************************************************************************** +dnl Let ISL's configure generate isl_config.h and gitversion.h +AC_CONFIG_SUBDIRS(lib/External/isl) + dnl This must be last AC_CONFIG_HEADERS(include/polly/Config/config.h) AC_OUTPUT Index: configure =================================================================== --- configure +++ configure @@ -585,8 +585,10 @@ PACKAGE_URL='' ac_unique_file=""lib/Analysis/ScopInfo.cpp"" +enable_option_checking=no ac_subst_vars='LTLIBOBJS LIBOBJS +subdirs cuda_ld cuda_lib cuda_inc @@ -655,7 +657,7 @@ LIBS CPPFLAGS CCC' - +ac_subdirs_all='lib/External/isl' # Initialize some variables set by options. ac_init_help= @@ -2492,6 +2494,11 @@ fi + + +subdirs="$subdirs lib/External/isl" + + ac_config_headers="$ac_config_headers include/polly/Config/config.h" cat >confcache <<\_ACEOF @@ -3775,6 +3782,151 @@ # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_sub_configure_args " '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Pass --silent + if test "$silent" = yes; then + ac_sub_configure_args="--silent $ac_sub_configure_args" + fi + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5 + $as_echo "$ac_msg" >&6 + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +$as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + as_fn_error $? "$ac_sub_configure failed for $ac_dir" "$LINENO" 5 + fi + + cd "$ac_popdir" + done +fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} Index: lib/CMakeLists.txt =================================================================== --- lib/CMakeLists.txt +++ lib/CMakeLists.txt @@ -16,6 +16,72 @@ set (GPGPU_CODEGEN_FILES) endif (GPU_CODEGEN) + +# External: Integer Set Library +set(ISL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External/isl") +set(ISL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/External/isl") + +# Determine version of isl +if (EXISTS "${ISL_SOURCE_DIR}/GIT_HEAD_ID") + # The source comes from a 'make dist' archive + file(READ "${ISL_SOURCE_DIR}/GIT_HEAD_ID" GIT_HEAD_ID) + string(STRIP "${GIT_HEAD_ID}" GIT_HEAD_ID) +elseif (EXISTS "${ISL_SOURCE_DIR}/gitversion.h") + # The source directory is preconfigured + file(READ "${ISL_SOURCE_DIR}/gitversion.h" GITVERSION_H) + string(REGEX REPLACE ".*\\\"([^\\\"]*)\\\".*" "\\1" GIT_HEAD_ID "${GITVERSION_H}") +elseif () + # Unknown revision + set(GIT_HEAD_ID "UNKNOWN") +endif () + +message(STATUS "ISL version: ${GIT_HEAD_ID}") + +# Enable small integer optimization and imath +set(USE_GMP_FOR_MP OFF) +set(USE_IMATH_FOR_MP ON) +set(USE_SMALL_INT_OPT OFF) + +# Determine compiler characteristics +include(CheckCSourceCompiles) + +check_c_source_compiles(" + int func(void) __attribute__((__warn_unused_result__)); + int main() { return 0; } + " HAS_ATTRIBUTE_WARN_UNUSED_RESULT) +set(GCC_WARN_UNUSED_RESULT) +if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT) + set(GCC_WARN_UNUSED_RESULT "__attribute__((__warn_unused_result__))") +endif () + +check_c_source_compiles(" + #include + int main() { ffs(0); return 0; } + " HAVE_DECL_FFS) +if (NOT HAVE_DECL_FFS) + set(HAVE_DECL_FFS 0) +endif () + +check_c_source_compiles(" + int main() { __builtin_ffs(0); return 0; } + " HAVE_DECL___BUILTIN_FFS) +if (NOT HAVE_DECL___BUILTIN_FFS) + set(HAVE_DECL___BUILTIN_FFS 0) +endif () + +check_c_source_compiles(" + static void foo(void) __attribute__ ((unused)); + int main() { return 0; } + " HAVE___ATTRIBUTE__) + +# Write configure result +configure_file("External/gitversion.h.cmake" "${ISL_BINARY_DIR}/gitversion.h") +configure_file("External/isl_config.h.cmake" "${ISL_BINARY_DIR}/isl_config.h") + +# Tell the compiler where to look for the generated files +include_directories("${ISL_BINARY_DIR}") + +# ISL files to compile set (ISL_FILES External/isl/basis_reduction_tab.c External/isl/isl_aff.c @@ -92,9 +158,6 @@ External/isl/imath/gmp_compat.c External/isl/imath/imath.c External/isl/imath/imrat.c - External/isl/imath/iprime.c - External/isl/imath/pi.c - External/isl/imath/rsamath.c ) Index: lib/External/gitversion.h.cmake =================================================================== --- /dev/null +++ lib/External/gitversion.h.cmake @@ -0,0 +1 @@ +#define GIT_HEAD_ID "@GIT_HEAD_ID@" Index: lib/External/isl_config.h.cmake =================================================================== --- /dev/null +++ lib/External/isl_config.h.cmake @@ -0,0 +1,25 @@ + +/* most gcc compilers know a function __attribute__((__warn_unused_result__)) + */ +#define GCC_WARN_UNUSED_RESULT @GCC_WARN_UNUSED_RESULT@ + +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#define HAVE_DECL_FFS @HAVE_DECL_FFS@ + +/* Define to 1 if you have the declaration of `__builtin_ffs', and to 0 if you + don't. */ +#define HAVE_DECL___BUILTIN_FFS @HAVE_DECL___BUILTIN_FFS@ + +/* define if your compiler has __attribute__ */ +#cmakedefine HAVE___ATTRIBUTE__ /**/ + +/* use gmp to implement isl_int */ +#cmakedefine USE_GMP_FOR_MP + +/* use imath to implement isl_int */ +#cmakedefine USE_IMATH_FOR_MP + +/* Use small integer optimization */ +#cmakedefine USE_SMALL_INT_OPT + +#include Index: lib/Makefile =================================================================== --- lib/Makefile +++ lib/Makefile @@ -104,11 +104,7 @@ External/isl/print.c \ External/isl/imath/gmp_compat.c \ External/isl/imath/imath.c \ - External/isl/imath/imdrover.c \ - External/isl/imath/imrat.c \ - External/isl/imath/iprime.c \ - External/isl/imath/pi.c \ - External/isl/imath/rsamath.c + External/isl/imath/imrat.c SOURCES= Polly.cpp \ Support/GICHelper.cpp \