[polly] r242770 - Add configure-time test for latest ISL
Michael Kruse
llvm at meinersbur.de
Tue Jul 21 05:01:14 PDT 2015
Author: meinersbur
Date: Tue Jul 21 07:01:14 2015
New Revision: 242770
URL: http://llvm.org/viewvc/llvm-project?rev=242770&view=rev
Log:
Add configure-time test for latest ISL
Query the isl_config.h macros recently added to ISL. One of it looks for
the ffs (find first set), whose functionality is available in Visual
Studio with _BitScanForward. Also add isl_ffs.c to the source files
which contains the implementation of ffs using _BitScanForward.
Reviewers: grosser
Modified:
polly/trunk/lib/CMakeLists.txt
polly/trunk/lib/External/isl_config.h.cmake
Modified: polly/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CMakeLists.txt?rev=242770&r1=242769&r2=242770&view=diff
==============================================================================
--- polly/trunk/lib/CMakeLists.txt (original)
+++ polly/trunk/lib/CMakeLists.txt Tue Jul 21 07:01:14 2015
@@ -32,6 +32,7 @@ elseif (EXISTS "${ISL_SOURCE_DIR}/gitver
string(REGEX REPLACE ".*\\\"([^\\\"]*)\\\".*" "\\1" GIT_HEAD_ID "${GITVERSION_H}")
elseif ()
# Unknown revision
+ # TODO: We could look for a .git and get the revision from HEAD
set(GIT_HEAD_ID "UNKNOWN")
endif ()
@@ -45,6 +46,19 @@ set(USE_SMALL_INT_OPT ON)
# Determine compiler characteristics
include(CheckCSourceCompiles)
+# Like check_c_source_compiles, but sets the result to either
+# 0 (error while compiling) or 1 (compiled successfully)
+# Required for compatibility with autotool's AC_CHECK_DECLS
+function (check_c_source_compiles_numeric _prog _var)
+ check_c_source_compiles("${_prog}" "${_var}")
+ if ("${${_var}}")
+ set("${_var}" 1 PARENT_SCOPE)
+ else ()
+ set("${_var}" 0 PARENT_SCOPE)
+ endif ()
+endfunction ()
+
+
check_c_source_compiles("
int func(void) __attribute__((__warn_unused_result__));
int main() { return 0; }
@@ -55,29 +69,79 @@ if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
endif ()
check_c_source_compiles("
+ static void foo(void) __attribute__ ((unused));
+ int main() { return 0; }
+ " HAVE___ATTRIBUTE__)
+
+
+check_c_source_compiles_numeric("
#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("
+check_c_source_compiles_numeric("
int main() { __builtin_ffs(0); return 0; }
" HAVE_DECL___BUILTIN_FFS)
-if (NOT HAVE_DECL___BUILTIN_FFS)
- set(HAVE_DECL___BUILTIN_FFS 0)
+
+check_c_source_compiles_numeric("
+ #include <intrin.h>
+ int main() { _BitScanForward(NULL, 0); return 0; }
+ " HAVE_DECL__BITSCANFORWARD)
+
+if (NOT HAVE_DECL_FFS AND
+ NOT HAVE_DECL___BUILTIN_FFS AND
+ NOT HAVE_DECL__BITSCANFORWARD)
+ message(FATAL_ERROR "No ffs implementation found")
endif ()
-check_c_source_compiles("
- static void foo(void) __attribute__ ((unused));
- int main() { return 0; }
- " HAVE___ATTRIBUTE__)
+
+check_c_source_compiles_numeric("
+ #include <strings.h>
+ int main() { strcasecmp(\"\", \"\"); return 0; }
+ " HAVE_DECL_STRCASECMP)
+
+check_c_source_compiles_numeric("
+ #include <string.h>
+ int main() { _stricmp(\"\", \"\"); return 0; }
+ " HAVE_DECL__STRICMP)
+
+if (NOT HAVE_DECL_STRCASECMP AND NOT HAVE_DECL__STRICMP)
+ message(FATAL_ERROR "No strcasecmp implementation found")
+endif ()
+
+
+check_c_source_compiles_numeric("
+ #include <strings.h>
+ int main() { strncasecmp(\"\", \"\", 0); return 0; }
+ " HAVE_DECL_STRNCASECMP)
+
+check_c_source_compiles_numeric("
+ #include <string.h>
+ int main() { _strnicmp(\"\", \"\", 0); return 0; }
+ " HAVE_DECL__STRNICMP)
+
+if (NOT HAVE_DECL_STRNCASECMP AND NOT HAVE_DECL__STRNICMP)
+ message(FATAL_ERROR "No strncasecmp implementation found")
+endif ()
+
+
+check_c_source_compiles_numeric("
+ #include <stdio.h>
+ int main() { snprintf((void*)0, 0, \"\"); return 0; }
+ " HAVE_DECL_SNPRINTF)
+
+check_c_source_compiles_numeric("
+ #include <stdio.h>
+ int main() { _snprintf((void*)0, 0, \"\"); return 0; }
+ " HAVE_DECL__SNPRINTF)
+
+if (NOT HAVE_DECL_SNPRINTF AND NOT HAVE_DECL__SNPRINTF)
+ message(FATAL_ERROR "No snprintf implementation found")
+endif ()
# 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")
-file(WRITE "${ISL_BINARY_DIR}/include/isl/stdint.h" "#include <stdint.h>")
# ISL files to compile
set (ISL_FILES
@@ -103,6 +167,7 @@ set (ISL_FILES
External/isl/isl_equalities.c
External/isl/isl_factorization.c
External/isl/isl_farkas.c
+ External/isl/isl_ffs.c
External/isl/isl_flow.c
External/isl/isl_fold.c
External/isl/isl_hash.c
Modified: polly/trunk/lib/External/isl_config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl_config.h.cmake?rev=242770&r1=242769&r2=242770&view=diff
==============================================================================
--- polly/trunk/lib/External/isl_config.h.cmake (original)
+++ polly/trunk/lib/External/isl_config.h.cmake Tue Jul 21 07:01:14 2015
@@ -1,8 +1,10 @@
+/* define if your compiler has __attribute__ */
+#cmakedefine HAVE___ATTRIBUTE__ /**/
-/* most gcc compilers know a function __attribute__((__warn_unused_result__))
- */
+/* 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@
@@ -10,8 +12,37 @@
don't. */
#define HAVE_DECL___BUILTIN_FFS @HAVE_DECL___BUILTIN_FFS@
-/* define if your compiler has __attribute__ */
-#cmakedefine HAVE___ATTRIBUTE__ /**/
+/* Define to 1 if you have the declaration of `_BitScanForward', and to 0 if
+ you don't. */
+#define HAVE_DECL__BITSCANFORWARD @HAVE_DECL__BITSCANFORWARD@
+
+
+/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
+ don't. */
+#define HAVE_DECL_STRCASECMP @HAVE_DECL_STRCASECMP@
+
+/* Define to 1 if you have the declaration of `_stricmp', and to 0 if you
+ don't. */
+#define HAVE_DECL__STRICMP @HAVE_DECL__STRICMP@
+
+
+/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
+ don't. */
+#define HAVE_DECL_STRNCASECMP @HAVE_DECL_STRNCASECMP@
+
+/* Define to 1 if you have the declaration of `_strnicmp', and to 0 if you
+ don't. */
+#define HAVE_DECL__STRNICMP @HAVE_DECL__STRNICMP@
+
+
+/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
+ don't. */
+#define HAVE_DECL_SNPRINTF @HAVE_DECL_SNPRINTF@
+
+/* Define to 1 if you have the declaration of `_snprintf', and to 0 if you
+ don't. */
+#define HAVE_DECL__SNPRINTF @HAVE_DECL__SNPRINTF@
+
/* use gmp to implement isl_int */
#cmakedefine USE_GMP_FOR_MP
More information about the llvm-commits
mailing list