[polly] r240301 - Prepare replacing ISL by its 'make dist' files

Michael Kruse llvm at meinersbur.de
Mon Jun 22 10:52:33 PDT 2015


Author: meinersbur
Date: Mon Jun 22 12:52:33 2015
New Revision: 240301

URL: http://llvm.org/viewvc/llvm-project?rev=240301&view=rev
Log:
Prepare replacing ISL by its 'make dist' files

Currently the Polly repository contains the ISL sources with bogus
isl_config.h and gitversion.h. This is problematic. In this state a
 macro

    #define __attribute__(x)

becomes active in the source, leading to various problems e.g. when
included before system header files. This patch will instead generate
the two files specific to the host system at configure-time.

For CMake, we replicate the tests that ISL's configure performs using
try_compile(). In autotools build, we just invoke ISL's configure to
generate the two files. This consequently required regenerating
autoconf/configure.

'make dist' distributions of ISL contain a file GIT_HEAD_ID which
contains the version the distribution is derived from. The repository
files themselves do not contain such a hint. In a later commit we will
replace the isl directory by the contents of such a .tar.gz. It does
not contain the files imdrover.c iprime.c pi.c and rsamath.c currently
compiled into Polly, but not used and therefore are removed by this
patch.

In the long term we plan to generate a dedicated library for ISL instead
of adding its files to Polly.

This also does not yet include the switch to small-integer optimized ISL
nor enabling C99 mode required for the former. Those will come as well
in separate patches.

Differential version: http://reviews.llvm.org/D10603

Reviewers: grosser 


Added:
    polly/trunk/lib/External/gitversion.h.cmake
    polly/trunk/lib/External/isl_config.h.cmake
Modified:
    polly/trunk/CMakeLists.txt
    polly/trunk/Makefile.config.in
    polly/trunk/autoconf/configure.ac
    polly/trunk/configure
    polly/trunk/lib/CMakeLists.txt
    polly/trunk/lib/Makefile

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=240301&r1=240300&r2=240301&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Mon Jun 22 12:52:33 2015
@@ -114,6 +114,7 @@ include_directories(
   BEFORE
   ${CMAKE_CURRENT_SOURCE_DIR}/include
   ${CMAKE_CURRENT_SOURCE_DIR}/lib/JSON/include
+  ${CMAKE_CURRENT_BINARY_DIR}/lib/External/isl
   ${CMAKE_CURRENT_SOURCE_DIR}/lib/External/isl/include
   ${CMAKE_CURRENT_SOURCE_DIR}/lib/External/isl/imath
   ${CMAKE_CURRENT_SOURCE_DIR}/lib/External/isl

Modified: polly/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/Makefile.config.in?rev=240301&r1=240300&r2=240301&view=diff
==============================================================================
--- polly/trunk/Makefile.config.in (original)
+++ polly/trunk/Makefile.config.in Mon Jun 22 12:52:33 2015
@@ -46,6 +46,7 @@ CUDALIB_FOUND := @cuda_found@
 
 # 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 \

Modified: polly/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/autoconf/configure.ac?rev=240301&r1=240300&r2=240301&view=diff
==============================================================================
--- polly/trunk/autoconf/configure.ac (original)
+++ polly/trunk/autoconf/configure.ac Mon Jun 22 12:52:33 2015
@@ -95,6 +95,9 @@ dnl ************************************
 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

Modified: polly/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/configure?rev=240301&r1=240300&r2=240301&view=diff
==============================================================================
--- polly/trunk/configure (original)
+++ polly/trunk/configure Mon Jun 22 12:52:33 2015
@@ -585,8 +585,10 @@ PACKAGE_BUGREPORT='polly-dev at googlegroup
 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 @@ LDFLAGS
 LIBS
 CPPFLAGS
 CCC'
-
+ac_subdirs_all='lib/External/isl'
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -2492,6 +2494,11 @@ $as_echo "#define CUDALIB_FOUND 1" >>con
 fi
 
 
+
+
+subdirs="$subdirs lib/External/isl"
+
+
 ac_config_headers="$ac_config_headers include/polly/Config/config.h"
 
 cat >confcache <<\_ACEOF
@@ -3775,6 +3782,151 @@ if test "$no_create" != yes; then
   # 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;}

Modified: polly/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CMakeLists.txt?rev=240301&r1=240300&r2=240301&view=diff
==============================================================================
--- polly/trunk/lib/CMakeLists.txt (original)
+++ polly/trunk/lib/CMakeLists.txt Mon Jun 22 12:52:33 2015
@@ -16,6 +16,69 @@ if (GPU_CODEGEN)
   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 <strings.h>
+  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")
+
+# ISL files to compile
 set (ISL_FILES
     External/isl/basis_reduction_tab.c
     External/isl/isl_aff.c
@@ -92,9 +155,6 @@ set (ISL_FILES
     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
     )
 
 

Added: polly/trunk/lib/External/gitversion.h.cmake
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/gitversion.h.cmake?rev=240301&view=auto
==============================================================================
--- polly/trunk/lib/External/gitversion.h.cmake (added)
+++ polly/trunk/lib/External/gitversion.h.cmake Mon Jun 22 12:52:33 2015
@@ -0,0 +1 @@
+#define GIT_HEAD_ID "@GIT_HEAD_ID@"

Added: polly/trunk/lib/External/isl_config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl_config.h.cmake?rev=240301&view=auto
==============================================================================
--- polly/trunk/lib/External/isl_config.h.cmake (added)
+++ polly/trunk/lib/External/isl_config.h.cmake Mon Jun 22 12:52:33 2015
@@ -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 <isl_config_post.h>

Modified: polly/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Makefile?rev=240301&r1=240300&r2=240301&view=diff
==============================================================================
--- polly/trunk/lib/Makefile (original)
+++ polly/trunk/lib/Makefile Mon Jun 22 12:52:33 2015
@@ -104,11 +104,7 @@ ISL_FILES= External/isl/basis_reduction_
            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 \





More information about the llvm-commits mailing list