From 0c55514a43af13d26534c30fcae0c6a9c408bf19 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sun, 21 Oct 2012 21:48:21 +0000 Subject: [PATCH] autoconf/cmake: Always require isl code generation. This change ensures that isl is only detected if it includes code generation support. This allows us to remove a lot of conditional compilation and also avoids missing test cases in case the feature is not available. llvm-svn: 166403 --- polly/Makefile.config.in | 1 - polly/autoconf/configure.ac | 7 +-- polly/cmake/FindIsl.cmake | 7 +-- polly/configure | 87 +------------------------------ polly/include/polly/CodeGen/IslAst.h | 5 -- polly/include/polly/Config/config.h.cmake | 1 - polly/include/polly/Config/config.h.in | 3 -- polly/include/polly/LinkAllPasses.h | 8 --- polly/lib/CodeGen/CMakeLists.txt | 8 ++- polly/lib/CodeGen/IslAst.cpp | 3 -- polly/lib/CodeGen/IslCodeGeneration.cpp | 4 -- polly/lib/RegisterPasses.cpp | 22 +------- 12 files changed, 7 insertions(+), 149 deletions(-) diff --git a/polly/Makefile.config.in b/polly/Makefile.config.in index 44a2fb9..231fb98 100755 --- a/polly/Makefile.config.in +++ b/polly/Makefile.config.in @@ -29,7 +29,6 @@ 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@ CUDALIB_FOUND := @cuda_found@ diff --git a/polly/autoconf/configure.ac b/polly/autoconf/configure.ac index 9ce989a..cbc1f49 100644 --- a/polly/autoconf/configure.ac +++ b/polly/autoconf/configure.ac @@ -78,12 +78,7 @@ dnl Find Gmp 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/ast.h], [isl]) -AS_IF([test "x$isl_found" = "xyes"], - [AC_DEFINE([ISL_CODEGEN_FOUND],[1],[Define if ISL has a code generator])]) +find_lib_and_headers([isl], [isl/ast.h], [isl], [required]) dnl Check that we have cloog. saved_CXXFLAGS=$CXXFLAGS diff --git a/polly/cmake/FindIsl.cmake b/polly/cmake/FindIsl.cmake index 21ad8a2..0fa95cd 100644 --- a/polly/cmake/FindIsl.cmake +++ b/polly/cmake/FindIsl.cmake @@ -1,9 +1,4 @@ -FIND_PATH(ISL_INCLUDE_DIR isl/set.h) -FIND_PATH(ISL_CODEGEN_DIR isl/ast.h) - -IF (ISL_CODEGEN_DIR) - SET(ISL_CODEGEN_FOUND TRUE) -ENDIF (ISL_CODEGEN_DIR) +FIND_PATH(ISL_INCLUDE_DIR isl/ast.h) FIND_LIBRARY(ISL_LIBRARY NAMES isl) diff --git a/polly/configure b/polly/configure index 13bbaf0..0e24058 100755 --- a/polly/configure +++ b/polly/configure @@ -2517,86 +2517,6 @@ else fi # Check for library and headers works - { $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. */ -#include -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 "xrequired" = "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 - - - - - 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/ast.h in $given_inc_path, and libisl in $given_lib_path" >&5 $as_echo_n "checking for isl: isl/ast.h in $given_inc_path, and libisl in $given_lib_path... " >&6; } @@ -2628,7 +2548,7 @@ fi fi else - if test "x" = "xrequired"; then : + if test "xrequired" = "xrequired"; then : as_fn_error $? "isl required but not found" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 @@ -2650,11 +2570,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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" diff --git a/polly/include/polly/CodeGen/IslAst.h b/polly/include/polly/CodeGen/IslAst.h index eb6fa6b..dfb4127 100644 --- a/polly/include/polly/CodeGen/IslAst.h +++ b/polly/include/polly/CodeGen/IslAst.h @@ -23,9 +23,6 @@ #define POLLY_ISL_AST_H #include "polly/Config/config.h" - -#ifdef ISL_CODEGEN_FOUND - #include "polly/ScopPass.h" struct clast_name; @@ -70,6 +67,4 @@ namespace llvm { class PassRegistry; void initializeIslAstInfoPass(llvm::PassRegistry&); } - -#endif /* ISL_CODEGEN_FOUND */ #endif /* POLLY_ISL_AST_H */ diff --git a/polly/include/polly/Config/config.h.cmake b/polly/include/polly/Config/config.h.cmake index cc5c4f3..c81c1b0 100755 --- a/polly/include/polly/Config/config.h.cmake +++ b/polly/include/polly/Config/config.h.cmake @@ -14,7 +14,6 @@ #define POLLY_CONFIG_H #cmakedefine CLOOG_FOUND -#cmakedefine ISL_CODEGEN_FOUND #cmakedefine OPENSCOP_FOUND #cmakedefine PLUTO_FOUND #cmakedefine SCOPLIB_FOUND diff --git a/polly/include/polly/Config/config.h.in b/polly/include/polly/Config/config.h.in index ab763da..42edd3b 100644 --- a/polly/include/polly/Config/config.h.in +++ b/polly/include/polly/Config/config.h.in @@ -12,9 +12,6 @@ /* Define if gpu codegen is enabled */ #undef GPU_CODEGEN -/* Define if ISL has a code generator */ -#undef ISL_CODEGEN_FOUND - /* Define if openscop found */ #undef OPENSCOP_FOUND diff --git a/polly/include/polly/LinkAllPasses.h b/polly/include/polly/LinkAllPasses.h index 783f478..5a33589 100644 --- a/polly/include/polly/LinkAllPasses.h +++ b/polly/include/polly/LinkAllPasses.h @@ -48,12 +48,8 @@ namespace polly { llvm::Pass *createRegionSimplifyPass(); llvm::Pass *createScopDetectionPass(); llvm::Pass *createScopInfoPass(); - -#ifdef ISL_CODEGEN_FOUND llvm::Pass *createIslAstInfoPass(); llvm::Pass *createIslCodeGenerationPass(); -#endif - llvm::Pass *createIslScheduleOptimizerPass(); llvm::Pass *createTempScopInfoPass(); @@ -106,10 +102,8 @@ namespace { #ifdef PLUTO_FOUND createPlutoOptimizerPass(); #endif -#ifdef ISL_CODEGEN_FOUND createIslAstInfoPass(); createIslCodeGenerationPass(); -#endif createIslScheduleOptimizerPass(); createTempScopInfoPass(); @@ -137,10 +131,8 @@ namespace llvm { void initializeIndependentBlocksPass(llvm::PassRegistry&); void initializeJSONExporterPass(llvm::PassRegistry&); void initializeJSONImporterPass(llvm::PassRegistry&); -#ifdef ISL_CODEGEN_FOUND void initializeIslAstInfoPass(llvm::PassRegistry&); void initializeIslCodeGenerationPass(llvm::PassRegistry&); -#endif void initializeIslScheduleOptimizerPass(llvm::PassRegistry&); #ifdef PLUTO_FOUND void initializePlutoOptimizerPass(llvm::PassRegistry&); diff --git a/polly/lib/CodeGen/CMakeLists.txt b/polly/lib/CodeGen/CMakeLists.txt index d5bdf3d..b1c29c5 100755 --- a/polly/lib/CodeGen/CMakeLists.txt +++ b/polly/lib/CodeGen/CMakeLists.txt @@ -4,11 +4,9 @@ if (CLOOG_FOUND) CodeGeneration.cpp) endif (CLOOG_FOUND) -if (ISL_CODEGEN_FOUND) - set(ISL_CODEGEN_FILES - IslAst.cpp - IslCodeGeneration.cpp) -endif (ISL_CODEGEN_FOUND) +set(ISL_CODEGEN_FILES + IslAst.cpp + IslCodeGeneration.cpp) if (GPU_CODEGEN) set (GPGPU_CODEGEN_FILES diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp index e342228..0df63ef 100644 --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -21,7 +21,6 @@ #include "polly/CodeGen/IslAst.h" -#ifdef ISL_CODEGEN_FOUND #include "polly/LinkAllPasses.h" #include "polly/ScopInfo.h" @@ -209,5 +208,3 @@ INITIALIZE_PASS_END(IslAstInfo, "polly-ast", Pass *polly::createIslAstInfoPass() { return new IslAstInfo(); } - -#endif // CLOOG_FOUND diff --git a/polly/lib/CodeGen/IslCodeGeneration.cpp b/polly/lib/CodeGen/IslCodeGeneration.cpp index e0856ea..9bfdd1d 100644 --- a/polly/lib/CodeGen/IslCodeGeneration.cpp +++ b/polly/lib/CodeGen/IslCodeGeneration.cpp @@ -20,8 +20,6 @@ //===----------------------------------------------------------------------===// #include "polly/Config/config.h" -#ifdef ISL_CODEGEN_FOUND - #include "polly/Dependences.h" #include "polly/LinkAllPasses.h" #include "polly/ScopInfo.h" @@ -897,5 +895,3 @@ INITIALIZE_PASS_END(IslCodeGeneration, "polly-codegen-isl", Pass *polly::createIslCodeGenerationPass() { return new IslCodeGeneration(); } - -#endif /* ISL_CODEGEN_FOUND */ diff --git a/polly/lib/RegisterPasses.cpp b/polly/lib/RegisterPasses.cpp index c87b6c7..d74e87f 100644 --- a/polly/lib/RegisterPasses.cpp +++ b/polly/lib/RegisterPasses.cpp @@ -64,23 +64,11 @@ Optimizer("polly-optimizer", clEnumValEnd), cl::Hidden, cl::init(OPTIMIZER_ISL), cl::ZeroOrMore); -#ifndef CLOOG_FOUND -#ifndef ISL_CODEGEN_FOUND - #error No code generator found. -#endif -#endif - enum CodeGenChoice { #ifdef CLOOG_FOUND - CODEGEN_CLOOG - #ifdef ISL_CODEGEN_FOUND - , // Avoid a warning in C++03 pedantic mode - #endif + CODEGEN_CLOOG, #endif - -#ifdef ISL_CODEGEN_FOUND CODEGEN_ISL -#endif }; #ifdef CLOOG_FOUND @@ -97,9 +85,7 @@ CodeGenerator("polly-code-generator", #ifdef CLOOG_FOUND clEnumValN(CODEGEN_CLOOG, "cloog", "CLooG"), #endif -#ifdef ISL_CODEGEN_FOUND clEnumValN(CODEGEN_ISL, "isl", "isl code generator"), -#endif clEnumValEnd), cl::Hidden, cl::init(DefaultCodeGen), cl::ZeroOrMore); @@ -167,18 +153,14 @@ static void initializePollyPasses(PassRegistry &Registry) { initializeCloogInfoPass(Registry); initializeCodeGenerationPass(Registry); #endif -#ifdef ISL_CODEGEN_FOUND initializeIslCodeGenerationPass(Registry); -#endif initializeCodePreparationPass(Registry); initializeDeadCodeElimPass(Registry); initializeDependencesPass(Registry); initializeIndependentBlocksPass(Registry); initializeJSONExporterPass(Registry); initializeJSONImporterPass(Registry); -#ifdef ISL_CODEGEN_FOUND initializeIslAstInfoPass(Registry); -#endif initializeIslScheduleOptimizerPass(Registry); #ifdef SCOPLIB_FOUND initializePoccPass(Registry); @@ -294,11 +276,9 @@ static void registerPollyPasses(llvm::PassManagerBase &PM) { } break; #endif -#ifdef ISL_CODEGEN_FOUND case CODEGEN_ISL: PM.add(polly::createIslCodeGenerationPass()); break; -#endif } if (CFGPrinter) -- 2.7.4