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
This commit is contained in:
Tobias Grosser 2012-10-21 21:48:21 +00:00
parent 6c8e696618
commit 0c55514a43
12 changed files with 9 additions and 151 deletions

View File

@ -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@

View File

@ -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

View File

@ -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)

91
polly/configure vendored
View File

@ -2517,13 +2517,13 @@ 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; }
{ $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; }
# try to compile a file that includes a header of the library
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <isl/config.h>
#include <isl/ast.h>
int
main ()
{
@ -2571,91 +2571,6 @@ 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; }
# try to compile a file that includes a header of the library
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <isl/ast.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"

View File

@ -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 */

View File

@ -14,7 +14,6 @@
#define POLLY_CONFIG_H
#cmakedefine CLOOG_FOUND
#cmakedefine ISL_CODEGEN_FOUND
#cmakedefine OPENSCOP_FOUND
#cmakedefine PLUTO_FOUND
#cmakedefine SCOPLIB_FOUND

View File

@ -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

View File

@ -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&);

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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)