[polly] r223141 - Drop Cloog support

Johannes Doerfert doerfert at cs.uni-saarland.de
Tue Dec 2 11:26:59 PST 2014


Author: jdoerfert
Date: Tue Dec  2 13:26:58 2014
New Revision: 223141

URL: http://llvm.org/viewvc/llvm-project?rev=223141&view=rev
Log:
Drop Cloog support

  This commit drops the Cloog support for Polly. The scripts and
  documentation are changed to only use isl as prerequisity. In the code
  all Cloog specific parts have been removed and all relevant tests have
  been ported to the isl backend when it was created.

Added:
    polly/trunk/utils/checkout_cloog.sh   (with props)
    polly/trunk/utils/checkout_isl.sh
Removed:
    polly/trunk/cmake/FindCloog.cmake
    polly/trunk/include/polly/CodeGen/Cloog.h
    polly/trunk/lib/CodeGen/Cloog.cpp
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/test/Cloog/
Modified:
    polly/trunk/CMakeLists.txt
    polly/trunk/Makefile.config.in
    polly/trunk/autoconf/configure.ac
    polly/trunk/configure
    polly/trunk/include/polly/CodeGen/CodeGeneration.h
    polly/trunk/include/polly/Config/config.h.in
    polly/trunk/include/polly/LinkAllPasses.h
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/CMakeLists.txt
    polly/trunk/lib/Makefile
    polly/trunk/lib/Support/RegisterPasses.cpp
    polly/trunk/lib/Transform/IndependentBlocks.cpp
    polly/trunk/test/Isl/CodeGen/openmp_limit_threads.ll
    polly/trunk/test/Isl/CodeGen/single_do_loop_int_param_iterations.ll
    polly/trunk/test/Isl/CodeGen/single_do_loop_one_iteration.ll
    polly/trunk/test/Isl/CodeGen/test.ll
    polly/trunk/test/Isl/single_loop_uint_max_iterations.ll
    polly/trunk/test/Isl/single_loop_ull_max_iterations.ll
    polly/trunk/test/Makefile
    polly/trunk/test/lit.site.cfg.in
    polly/trunk/www/documentation/gpgpucodegen.html
    polly/trunk/www/documentation/passes.html
    polly/trunk/www/example_manual_matmul.html
    polly/trunk/www/experiments/matmul/runall.sh
    polly/trunk/www/get_started.html
    polly/trunk/www/polly.sh

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Tue Dec  2 13:26:58 2014
@@ -89,16 +89,6 @@ if(PLUTO_FOUND)
   set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${PLUTO_LIBRARY})
 endif(PLUTO_FOUND)
 
-option(POLLY_USE_CLOOG "Build Polly with Cloog support" ON)
-if(POLLY_USE_CLOOG)
-  # Build Cloog support in Polly (default is for cloog-isl).
-  FIND_PACKAGE(Cloog)
-  FIND_PACKAGE(Gmp REQUIRED)
-  if(CLOOG_FOUND)
-    set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${CLOOG_LIBRARY})
-  endif(CLOOG_FOUND)
-endif(POLLY_USE_CLOOG)
-
 if(GMP_FOUND)
   set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${GMP_LIBRARY})
 endif(GMP_FOUND)
@@ -111,9 +101,6 @@ if (POLLY_ENABLE_GPGPU_CODEGEN)
   set(GPU_CODEGEN TRUE)
 endif(POLLY_ENABLE_GPGPU_CODEGEN)
 
-if (CLOOG_FOUND)
-  INCLUDE_DIRECTORIES( ${CLOOG_INCLUDE_DIR} )
-endif(CLOOG_FOUND)
 if (PLUTO_FOUND)
   INCLUDE_DIRECTORIES( ${PLUTO_INCLUDE_DIR} )
 endif(PLUTO_FOUND)

Modified: polly/trunk/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/Makefile.config.in?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/Makefile.config.in (original)
+++ polly/trunk/Makefile.config.in Tue Dec  2 13:26:58 2014
@@ -29,13 +29,12 @@ endif
 POLLY_CXXFLAGS += "-fno-rtti -fno-exceptions"
 
 PLUTO_FOUND := @pluto_found@
-CLOOG_FOUND := @cloog_found@
 CUDALIB_FOUND := @cuda_found@
 
 # Set include directroys
-POLLY_INC :=  @gmp_inc@ @isl_inc@ @cloog_inc@ @cuda_inc@\
+POLLY_INC :=  @gmp_inc@ @isl_inc@ @cuda_inc@\
 				      @pluto_inc@ -I$(POLLY_SRC_ROOT)/lib/JSON/include
 
-POLLY_LD := @gmp_ld@ @isl_ld@ @cloog_ld@ @cuda_ld@ @pluto_ld@
+POLLY_LD := @gmp_ld@ @isl_ld@ @cuda_ld@ @pluto_ld@
 
-POLLY_LIB := @gmp_lib@ @isl_lib@ @cloog_lib@ @cuda_lib@ @pluto_lib@
+POLLY_LIB := @gmp_lib@ @isl_lib@ @cuda_lib@ @pluto_lib@

Modified: polly/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/autoconf/configure.ac?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/autoconf/configure.ac (original)
+++ polly/trunk/autoconf/configure.ac Tue Dec  2 13:26:58 2014
@@ -37,8 +37,6 @@ if test ${srcdir} != "." ; then
   fi
 fi
 
-AC_DEFINE([CLOOG_INT_GMP], [1], [Use gmp for isl])
-
 dnl **************************************************************************
 dnl * Determine which system we are building on
 dnl **************************************************************************
@@ -83,14 +81,6 @@ CXXFLAGS="$CXXFLAGS"
 find_lib_and_headers([isl], [isl/val.h], [isl], [required])
 CXXFLAGS=$saved_CXXFLAGS
 
-dnl Check that we have cloog.
-saved_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="$CXXFLAGS $gmp_inc $isl_inc"
-find_lib_and_headers([cloog], [cloog/isl/cloog.h], [cloog-isl])
-CXXFLAGS=$saved_CXXFLAGS
-AS_IF([test "x$cloog_found" = "xyes"],
-  [AC_DEFINE([CLOOG_FOUND],[1],[Define if cloog found])])
-
 dnl Check that we have libpluto.
 saved_CXXFLAGS=$CXXFLAGS
 CXXFLAGS="$CXXFLAGS $gmp_inc $isl_inc"

Removed: polly/trunk/cmake/FindCloog.cmake
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/cmake/FindCloog.cmake?rev=223140&view=auto
==============================================================================
--- polly/trunk/cmake/FindCloog.cmake (original)
+++ polly/trunk/cmake/FindCloog.cmake (removed)
@@ -1,19 +0,0 @@
-FIND_PATH(CLOOG_INCLUDE_DIR cloog/isl/cloog.h)
-
-FIND_LIBRARY(CLOOG_LIBRARY NAMES cloog-isl)
-
-IF (CLOOG_INCLUDE_DIR AND CLOOG_LIBRARY)
-  SET(CLOOG_FOUND TRUE)
-ENDIF (CLOOG_INCLUDE_DIR AND CLOOG_LIBRARY)
-
-
-IF (CLOOG_FOUND)
-  IF (NOT CLOOG_FIND_QUIETLY)
-    MESSAGE(STATUS "Found Cloog: ${CLOOG_LIBRARY}")
-  ENDIF (NOT CLOOG_FIND_QUIETLY)
-ELSE (CLOOG_FOUND)
-  IF (CLOOG_FIND_REQUIRED)
-    MESSAGE(FATAL_ERROR "Could not find Cloog")
-  ENDIF (CLOOG_FIND_REQUIRED)
-ENDIF (CLOOG_FOUND)
-

Modified: polly/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/configure?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/configure (original)
+++ polly/trunk/configure Tue Dec  2 13:26:58 2014
@@ -595,10 +595,6 @@ pluto_ld
 pluto_lib
 pluto_inc
 pluto_found
-cloog_ld
-cloog_lib
-cloog_inc
-cloog_found
 isl_ld
 isl_lib
 isl_inc
@@ -661,7 +657,6 @@ with_llvmsrc
 with_llvmobj
 with_gmp
 with_isl
-with_cloog
 with_pluto
 enable_polly_gpu_codegen
 with_cuda
@@ -1294,7 +1289,6 @@ Optional Packages:
   --with-llvmobj          Location of LLVM Object Code
   --with-gmp              prefix of gmp
   --with-isl              prefix of isl
-  --with-cloog            prefix of cloog
   --with-pluto            prefix of pluto
   --with-cuda             prefix of cuda
 
@@ -1897,7 +1891,6 @@ if test ${srcdir} != "." ; then
 fi
 
 
-$as_echo "#define CLOOG_INT_GMP 1" >>confdefs.h
 
 
 
@@ -2578,96 +2571,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 CXXFLAGS=$saved_CXXFLAGS
-
-saved_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="$CXXFLAGS $gmp_inc $isl_inc"
-
-  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 -lcloog-isl";
-
-  # Get include path and lib path
-
-# Check whether --with-cloog was given.
-if test "${with_cloog+set}" = set; then :
-  withval=$with_cloog; 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_cloog;
-       given_lib_path=lib_not_give_cloog
-
-fi
-
-  # Check for library and headers works
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cloog: cloog/isl/cloog.h in $given_inc_path, and libcloog-isl in $given_lib_path" >&5
-$as_echo_n "checking for cloog: cloog/isl/cloog.h in $given_inc_path, and libcloog-isl 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 <cloog/isl/cloog.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; }
-    cloog_found="yes"
-
-    if test "x$given_inc_path" != "xinc_not_give_cloog"; then :
-  cloog_inc="-I$given_inc_path"
-
-fi
-    cloog_lib="-lcloog-isl"
-
-    if test "x$given_lib_path" != "xlib_not_give_cloog"; then :
-  cloog_ld="-L$given_lib_path"
-
-fi
-else
-  if test "x" = "xrequired"; then :
-  as_fn_error $? "cloog 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
-
-
-CXXFLAGS=$saved_CXXFLAGS
-if test "x$cloog_found" = "xyes"; then :
-
-$as_echo "#define CLOOG_FOUND 1" >>confdefs.h
-
-fi
-
-saved_CXXFLAGS=$CXXFLAGS
 CXXFLAGS="$CXXFLAGS $gmp_inc $isl_inc"
 
   ac_ext=cpp
@@ -2755,17 +2658,6 @@ $as_echo "#define PLUTO_FOUND 1" >>confd
 
 fi
 
-
-  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;
-
 # Check whether --enable-polly_gpu_codegen was given.
 if test "${enable_polly_gpu_codegen+set}" = set; then :
   enableval=$enable_polly_gpu_codegen;

Removed: polly/trunk/include/polly/CodeGen/Cloog.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/Cloog.h?rev=223140&view=auto
==============================================================================
--- polly/trunk/include/polly/CodeGen/Cloog.h (original)
+++ polly/trunk/include/polly/CodeGen/Cloog.h (removed)
@@ -1,91 +0,0 @@
-//===- CLooG.h - CLooG interface --------------------------------*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// CLooG[1] interface.
-//
-// The CLooG interface takes a Scop and generates a CLooG AST (clast). This
-// clast can either be returned directly or it can be pretty printed to stdout.
-//
-// A typical clast output looks like this:
-//
-// for (c2 = max(0, ceild(n + m, 2); c2 <= min(511, floord(5 * n, 3)); c2++) {
-//   bb2(c2);
-// }
-//
-// [1] http://www.cloog.org/ - The Chunky Loop Generator
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef POLLY_CLOOG_H
-#define POLLY_CLOOG_H
-
-#include "polly/Config/config.h"
-#ifdef CLOOG_FOUND
-
-#include "polly/ScopPass.h"
-
-#define CLOOG_INT_GMP 1
-#include "cloog/cloog.h"
-
-struct clast_name;
-namespace llvm {
-class raw_ostream;
-}
-
-namespace polly {
-class Scop;
-class Cloog;
-
-class CloogInfo : public ScopPass {
-  Cloog *C;
-  Scop *scop;
-
-public:
-  static char ID;
-  CloogInfo() : ScopPass(ID), C(0) {}
-
-  /// Write a .cloog input file
-  void dump(FILE *F);
-
-  /// Print a source code representation of the program.
-  void pprint(llvm::raw_ostream &OS);
-
-  /// Create the CLooG AST from this program.
-  const struct clast_root *getClast();
-
-  bool runOnScop(Scop &S);
-  void printScop(llvm::raw_ostream &OS) const;
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
-  virtual void releaseMemory();
-};
-
-// Visitor class for clasts.
-// Only 'visitUser' has to be implemented by subclasses; the default
-// implementations of the other methods traverse the clast recursively.
-class ClastVisitor {
-public:
-  virtual void visit(const clast_stmt *stmt);
-
-  virtual void visitAssignment(const clast_assignment *stmt);
-  virtual void visitBlock(const clast_block *stmt);
-  virtual void visitFor(const clast_for *stmt);
-  virtual void visitGuard(const clast_guard *stmt);
-
-  virtual void visitUser(const clast_user_stmt *stmt) = 0;
-  virtual ~ClastVisitor() {}
-};
-}
-
-namespace llvm {
-class PassRegistry;
-void initializeCloogInfoPass(llvm::PassRegistry &);
-}
-
-#endif /* CLOOG_FOUND */
-#endif /* POLLY_CLOOG_H */

Modified: polly/trunk/include/polly/CodeGen/CodeGeneration.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/CodeGeneration.h?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/CodeGeneration.h (original)
+++ polly/trunk/include/polly/CodeGen/CodeGeneration.h Tue Dec  2 13:26:58 2014
@@ -27,13 +27,7 @@ enum VectorizerChoice {
 };
 extern VectorizerChoice PollyVectorizerChoice;
 
-enum CodeGenChoice {
-#ifdef CLOOG_FOUND
-  CODEGEN_CLOOG,
-#endif
-  CODEGEN_ISL,
-  CODEGEN_NONE
-};
+enum CodeGenChoice { CODEGEN_ISL, CODEGEN_NONE };
 extern CodeGenChoice PollyCodeGenChoice;
 
 /// @brief Flag to turn on/off annotation of alias scopes.

Modified: polly/trunk/include/polly/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Config/config.h.in?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/include/polly/Config/config.h.in (original)
+++ polly/trunk/include/polly/Config/config.h.in Tue Dec  2 13:26:58 2014
@@ -1,11 +1,5 @@
 /* include/polly/Config/config.h.in.  Generated from autoconf/configure.ac by autoheader.  */
 
-/* Define if cloog found */
-#undef CLOOG_FOUND
-
-/* Use gmp for isl */
-#undef CLOOG_INT_GMP
-
 /* Define if cudalib found */
 #undef CUDALIB_FOUND
 

Modified: polly/trunk/include/polly/LinkAllPasses.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/LinkAllPasses.h?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/include/polly/LinkAllPasses.h (original)
+++ polly/trunk/include/polly/LinkAllPasses.h Tue Dec  2 13:26:58 2014
@@ -26,11 +26,6 @@ class RegionPass;
 }
 
 namespace polly {
-#ifdef CLOOG_FOUND
-llvm::Pass *createCloogExporterPass();
-llvm::Pass *createCloogInfoPass();
-llvm::Pass *createCodeGenerationPass();
-#endif
 llvm::Pass *createCodePreparationPass();
 llvm::Pass *createDeadCodeElimPass();
 llvm::Pass *createDependencesPass();
@@ -66,11 +61,6 @@ struct PollyForcePassLinking {
     if (std::getenv("bar") != (char *)-1)
       return;
 
-#ifdef CLOOG_FOUND
-    polly::createCloogExporterPass();
-    polly::createCloogInfoPass();
-    polly::createCodeGenerationPass();
-#endif
     polly::createCodePreparationPass();
     polly::createDeadCodeElimPass();
     polly::createDependencesPass();
@@ -97,9 +87,6 @@ struct PollyForcePassLinking {
 
 namespace llvm {
 class PassRegistry;
-#ifdef CLOOG_FOUND
-void initializeCodeGenerationPass(llvm::PassRegistry &);
-#endif
 void initializeCodePreparationPass(llvm::PassRegistry &);
 void initializeDeadCodeElimPass(llvm::PassRegistry &);
 void initializeIndependentBlocksPass(llvm::PassRegistry &);

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Tue Dec  2 13:26:58 2014
@@ -207,14 +207,6 @@ ScopDetection::ScopDetection() : Functio
                     "accesses are enabled.\n");
     PollyUseRuntimeAliasChecks = false;
   }
-
-#ifdef CLOOG_FOUND
-  if (PollyCodeGenChoice == CODEGEN_CLOOG) {
-    DEBUG(errs() << "WARNING: We disable runtime alias checks as the cloog "
-                    "code generation cannot emit them.\n");
-    PollyUseRuntimeAliasChecks = false;
-  }
-#endif
 }
 
 template <class RR, typename... Args>

Modified: polly/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CMakeLists.txt?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/lib/CMakeLists.txt (original)
+++ polly/trunk/lib/CMakeLists.txt Tue Dec  2 13:26:58 2014
@@ -10,12 +10,6 @@ set(POLLY_JSON_FILES
     JSON/json_writer.cpp
 )
 
-if (CLOOG_FOUND)
-  set(CLOOG_FILES
-      CodeGen/Cloog.cpp
-      CodeGen/CodeGeneration.cpp)
-endif (CLOOG_FOUND)
-
 set(ISL_CODEGEN_FILES
     CodeGen/IslAst.cpp
     CodeGen/IslExprBuilder.cpp
@@ -35,7 +29,6 @@ add_polly_library(Polly
   Analysis/ScopPass.cpp
   Analysis/TempScopInfo.cpp
   CodeGen/BlockGenerators.cpp
-  ${CLOOG_FILES}
   ${ISL_CODEGEN_FILES}
   CodeGen/LoopGenerators.cpp
   CodeGen/IRBuilder.cpp

Removed: polly/trunk/lib/CodeGen/Cloog.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Cloog.cpp?rev=223140&view=auto
==============================================================================
--- polly/trunk/lib/CodeGen/Cloog.cpp (original)
+++ polly/trunk/lib/CodeGen/Cloog.cpp (removed)
@@ -1,365 +0,0 @@
-//===- Cloog.cpp - Cloog interface ----------------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Cloog[1] interface.
-//
-// The Cloog interface takes a Scop and generates a Cloog AST (clast). This
-// clast can either be returned directly or it can be pretty printed to stdout.
-//
-// A typical clast output looks like this:
-//
-// for (c2 = max(0, ceild(n + m, 2); c2 <= min(511, floord(5 * n, 3)); c2++) {
-//   bb2(c2);
-// }
-//
-// [1] http://www.cloog.org/ - The Chunky Loop Generator
-//
-//===----------------------------------------------------------------------===//
-
-#include "polly/CodeGen/Cloog.h"
-#ifdef CLOOG_FOUND
-#include "polly/LinkAllPasses.h"
-#include "polly/ScopInfo.h"
-
-#include "llvm/IR/Module.h"
-#include "llvm/Support/Debug.h"
-
-#include "cloog/isl/domain.h"
-#include "cloog/isl/cloog.h"
-
-#include <unistd.h>
-
-using namespace llvm;
-using namespace polly;
-
-#define DEBUG_TYPE "polly-cloog"
-
-namespace polly {
-class Cloog {
-  Scop *S;
-  CloogOptions *Options;
-  CloogState *State;
-  clast_stmt *ClastRoot;
-
-  void buildCloogOptions();
-  CloogUnionDomain *buildCloogUnionDomain();
-  CloogInput *buildCloogInput();
-
-public:
-  Cloog(Scop *Scop);
-
-  ~Cloog();
-
-  /// Write a .cloog input file
-  void dump(FILE *F);
-
-  /// Print a source code representation of the program.
-  void pprint(llvm::raw_ostream &OS);
-
-  /// Create the Cloog AST from this program.
-  clast_root *getClast();
-};
-
-Cloog::Cloog(Scop *Scop) : S(Scop) {
-  State = cloog_isl_state_malloc(Scop->getIslCtx());
-  buildCloogOptions();
-  ClastRoot = cloog_clast_create_from_input(buildCloogInput(), Options);
-}
-
-Cloog::~Cloog() {
-  cloog_clast_free(ClastRoot);
-  cloog_options_free(Options);
-  cloog_state_free(State);
-}
-
-// Create a FILE* write stream and get the output to it written
-// to a std::string.
-class FileToString {
-  int FD[2];
-  FILE *input;
-  static const int BUFFERSIZE = 20;
-
-  char buf[BUFFERSIZE + 1];
-
-public:
-  FileToString() {
-    pipe(FD);
-    input = fdopen(FD[1], "w");
-  }
-  ~FileToString() {
-    close(FD[0]);
-    // close(FD[1]);
-  }
-
-  FILE *getInputFile() { return input; }
-
-  void closeInput() {
-    fclose(input);
-    close(FD[1]);
-  }
-
-  std::string getOutput() {
-    std::string output;
-    int readSize;
-
-    while (true) {
-      readSize = read(FD[0], &buf, BUFFERSIZE);
-
-      if (readSize <= 0)
-        break;
-
-      output += std::string(buf, readSize);
-    }
-
-    return output;
-  }
-};
-
-/// Write .cloog input file.
-void Cloog::dump(FILE *F) {
-  CloogInput *Input = buildCloogInput();
-  cloog_input_dump_cloog(F, Input, Options);
-  cloog_input_free(Input);
-}
-
-/// Print a source code representation of the program.
-void Cloog::pprint(raw_ostream &OS) {
-  FileToString *Output = new FileToString();
-  clast_pprint(Output->getInputFile(), ClastRoot, 0, Options);
-  Output->closeInput();
-  OS << Output->getOutput();
-  delete (Output);
-}
-
-/// Create the Cloog AST from this program.
-clast_root *Cloog::getClast() { return (clast_root *)ClastRoot; }
-
-void Cloog::buildCloogOptions() {
-  Options = cloog_options_malloc(State);
-  Options->quiet = 1;
-  Options->strides = 1;
-  Options->save_domains = 1;
-  Options->noscalars = 1;
-
-  // Compute simple hulls to reduce code generation time.
-  Options->sh = 1;
-
-  // The last loop depth to optimize should be the last scattering dimension.
-  // CLooG by default will continue to split the loops even after the last
-  // scattering dimension. This splitting is problematic for the schedules
-  // calculated by the PoCC/isl/Pluto optimizer. Such schedules contain may
-  // not be fully defined, but statements without dependences may be mapped
-  // to the same exeuction time. For such schedules, continuing to split
-  // may lead to a larger set of if-conditions in the innermost loop.
-  Options->l = 0;
-}
-
-CloogUnionDomain *Cloog::buildCloogUnionDomain() {
-  CloogUnionDomain *DU = cloog_union_domain_alloc(S->getNumParams());
-
-  for (Scop::iterator SI = S->begin(), SE = S->end(); SI != SE; ++SI) {
-    ScopStmt *Stmt = *SI;
-    CloogScattering *Scattering;
-    CloogDomain *Domain;
-
-    Scattering = cloog_scattering_from_isl_map(Stmt->getScattering());
-    Domain = cloog_domain_from_isl_set(Stmt->getDomain());
-
-    std::string entryName = Stmt->getBaseName();
-
-    DU = cloog_union_domain_add_domain(DU, entryName.c_str(), Domain,
-                                       Scattering, Stmt);
-  }
-
-  return DU;
-}
-
-CloogInput *Cloog::buildCloogInput() {
-  // XXX: We do not copy the context of the scop, but use an unconstrained
-  //      context. This 'hack' is necessary as the context may contain bounds
-  //      on parameters such as [n] -> {:0 <= n < 2^32}. Those large
-  //      integers will cause CLooG to construct a clast that contains
-  //      expressions that include these large integers. Such expressions can
-  //      possibly not be evaluated correctly with i64 types. The cloog
-  //      based code generation backend, however, can not derive types
-  //      automatically and just assumes i64 types. Hence, it will break or
-  //      generate incorrect code.
-  //      This hack does not remove all possibilities of incorrectly generated
-  //      code, but it is ensures that for most problems the problems do not
-  //      show up. The correct solution, will be to automatically derive the
-  //      minimal types for each expression. This could be added to CLooG and it
-  //      will be available in the isl based code generation.
-  isl_set *EmptyContext = isl_set_universe(S->getParamSpace());
-  CloogDomain *Context = cloog_domain_from_isl_set(EmptyContext);
-  CloogUnionDomain *Statements = buildCloogUnionDomain();
-
-  isl_set *ScopContext = S->getContext();
-
-  for (unsigned i = 0; i < isl_set_dim(ScopContext, isl_dim_param); i++) {
-    isl_id *id = isl_set_get_dim_id(ScopContext, isl_dim_param, i);
-    Statements = cloog_union_domain_set_name(Statements, CLOOG_PARAM, i,
-                                             isl_id_get_name(id));
-    isl_id_free(id);
-  }
-
-  isl_set_free(ScopContext);
-
-  CloogInput *Input = cloog_input_alloc(Context, Statements);
-  return Input;
-}
-
-void ClastVisitor::visit(const clast_stmt *stmt) {
-  if (CLAST_STMT_IS_A(stmt, stmt_root))
-    assert(false && "No second root statement expected");
-  else if (CLAST_STMT_IS_A(stmt, stmt_ass))
-    return visitAssignment((const clast_assignment *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_user))
-    return visitUser((const clast_user_stmt *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_block))
-    return visitBlock((const clast_block *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_for))
-    return visitFor((const clast_for *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_guard))
-    return visitGuard((const clast_guard *)stmt);
-
-  if (stmt->next)
-    visit(stmt->next);
-}
-
-void ClastVisitor::visitAssignment(const clast_assignment *stmt) {}
-
-void ClastVisitor::visitBlock(const clast_block *stmt) { visit(stmt->body); }
-
-void ClastVisitor::visitFor(const clast_for *stmt) { visit(stmt->body); }
-
-void ClastVisitor::visitGuard(const clast_guard *stmt) { visit(stmt->then); }
-
-} // End namespace polly.
-
-namespace {
-
-struct CloogExporter : public ScopPass {
-  static char ID;
-  Scop *S;
-  explicit CloogExporter() : ScopPass(ID) {}
-
-  std::string getFileName(Region *R) const;
-  virtual bool runOnScop(Scop &S);
-  void getAnalysisUsage(AnalysisUsage &AU) const;
-};
-}
-std::string CloogExporter::getFileName(Region *R) const {
-  std::string FunctionName = R->getEntry()->getParent()->getName();
-  std::string ExitName, EntryName;
-
-  raw_string_ostream ExitStr(ExitName);
-  raw_string_ostream EntryStr(EntryName);
-
-  R->getEntry()->printAsOperand(EntryStr, false);
-  EntryStr.str();
-
-  if (R->getExit()) {
-    R->getExit()->printAsOperand(ExitStr, false);
-    ExitStr.str();
-  } else
-    ExitName = "FunctionExit";
-
-  std::string RegionName = EntryName + "---" + ExitName;
-  std::string FileName = FunctionName + "___" + RegionName + ".cloog";
-
-  return FileName;
-}
-
-char CloogExporter::ID = 0;
-bool CloogExporter::runOnScop(Scop &S) {
-  Region &R = S.getRegion();
-  CloogInfo &C = getAnalysis<CloogInfo>();
-
-  std::string FunctionName = R.getEntry()->getParent()->getName();
-  std::string Filename = getFileName(&R);
-
-  errs() << "Writing Scop '" << R.getNameStr() << "' in function '"
-         << FunctionName << "' to '" << Filename << "'...\n";
-
-  FILE *F = fopen(Filename.c_str(), "w");
-  C.dump(F);
-  fclose(F);
-
-  return false;
-}
-
-void CloogExporter::getAnalysisUsage(AnalysisUsage &AU) const {
-  // Get the Common analysis usage of ScopPasses.
-  ScopPass::getAnalysisUsage(AU);
-  AU.addRequired<CloogInfo>();
-}
-
-static RegisterPass<CloogExporter> A("polly-export-cloog",
-                                     "Polly - Export the Cloog input file"
-                                     " (Writes a .cloog file for each Scop)");
-
-llvm::Pass *polly::createCloogExporterPass() { return new CloogExporter(); }
-
-/// Write a .cloog input file
-void CloogInfo::dump(FILE *F) { C->dump(F); }
-
-/// Print a source code representation of the program.
-void CloogInfo::pprint(llvm::raw_ostream &OS) { C->pprint(OS); }
-
-/// Create the Cloog AST from this program.
-const struct clast_root *CloogInfo::getClast() { return C->getClast(); }
-
-void CloogInfo::releaseMemory() {
-  if (C) {
-    delete C;
-    C = 0;
-  }
-}
-
-bool CloogInfo::runOnScop(Scop &S) {
-  if (C)
-    delete C;
-
-  scop = &S;
-
-  C = new Cloog(&S);
-
-  Function *F = S.getRegion().getEntry()->getParent();
-  (void)F;
-
-  DEBUG(dbgs() << ":: " << F->getName());
-  DEBUG(dbgs() << " : " << S.getRegion().getNameStr() << "\n");
-  DEBUG(C->pprint(dbgs()));
-
-  return false;
-}
-
-void CloogInfo::printScop(raw_ostream &OS) const {
-  Function *function = scop->getRegion().getEntry()->getParent();
-
-  OS << function->getName() << "():\n";
-
-  C->pprint(OS);
-}
-
-void CloogInfo::getAnalysisUsage(AnalysisUsage &AU) const {
-  // Get the Common analysis usage of ScopPasses.
-  ScopPass::getAnalysisUsage(AU);
-}
-char CloogInfo::ID = 0;
-
-Pass *polly::createCloogInfoPass() { return new CloogInfo(); }
-
-INITIALIZE_PASS_BEGIN(CloogInfo, "polly-cloog", "Execute Cloog code generation",
-                      false, false);
-INITIALIZE_PASS_DEPENDENCY(ScopInfo);
-INITIALIZE_PASS_END(CloogInfo, "polly-cloog", "Execute Cloog code generation",
-                    false, false)
-
-#endif // CLOOG_FOUND

Removed: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=223140&view=auto
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp (removed)
@@ -1,1107 +0,0 @@
-//===------ CodeGeneration.cpp - Code generate the Scops. -----------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// The CodeGeneration pass takes a Scop created by ScopInfo and translates it
-// back to LLVM-IR using Cloog.
-//
-// The Scop describes the high level memory behaviour of a control flow region.
-// Transformation passes can update the schedule (execution order) of statements
-// in the Scop. Cloog is used to generate an abstract syntax tree (clast) that
-// reflects the updated execution order. This clast is used to create new
-// LLVM-IR that is computational equivalent to the original control flow region,
-// but executes its code in the new execution order defined by the changed
-// scattering.
-//
-//===----------------------------------------------------------------------===//
-
-#include "polly/CodeGen/Cloog.h"
-#ifdef CLOOG_FOUND
-
-#include "polly/Dependences.h"
-#include "polly/LinkAllPasses.h"
-#include "polly/Options.h"
-#include "polly/ScopInfo.h"
-#include "polly/TempScopInfo.h"
-#include "polly/CodeGen/CodeGeneration.h"
-#include "polly/CodeGen/BlockGenerators.h"
-#include "polly/CodeGen/LoopGenerators.h"
-#include "polly/CodeGen/PTXGenerator.h"
-#include "polly/CodeGen/Utils.h"
-#include "polly/Support/GICHelper.h"
-#include "polly/Support/ScopHelper.h"
-
-#include "llvm/IR/Module.h"
-#include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/PostOrderIterator.h"
-#include "llvm/Analysis/LoopInfo.h"
-#include "llvm/Analysis/ScalarEvolutionExpander.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/IR/DataLayout.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
-
-#define CLOOG_INT_GMP 1
-#include "cloog/cloog.h"
-#include "cloog/isl/cloog.h"
-
-#include "isl/aff.h"
-
-#include <vector>
-#include <utility>
-
-using namespace polly;
-using namespace llvm;
-
-#define DEBUG_TYPE "polly-codegen"
-
-struct isl_set;
-
-namespace polly {
-static cl::opt<bool>
-    OpenMP("enable-polly-openmp", cl::desc("Generate OpenMP parallel code"),
-           cl::value_desc("OpenMP code generation enabled if true"),
-           cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
-
-#ifdef GPU_CODEGEN
-static cl::opt<bool>
-    GPGPU("enable-polly-gpgpu", cl::desc("Generate GPU parallel code"),
-          cl::Hidden, cl::value_desc("GPGPU code generation enabled if true"),
-          cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
-
-static cl::opt<std::string>
-    GPUTriple("polly-gpgpu-triple",
-              cl::desc("Target triple for GPU code generation"), cl::Hidden,
-              cl::init(""), cl::cat(PollyCategory));
-#endif /* GPU_CODEGEN */
-
-typedef DenseMap<const char *, Value *> CharMapT;
-
-/// Class to generate LLVM-IR that calculates the value of a clast_expr.
-class ClastExpCodeGen {
-  PollyIRBuilder &Builder;
-  const CharMapT &IVS;
-
-  Value *codegen(const clast_name *e, Type *Ty);
-  Value *codegen(const clast_term *e, Type *Ty);
-  Value *codegen(const clast_binary *e, Type *Ty);
-  Value *codegen(const clast_reduction *r, Type *Ty);
-
-public:
-  // A generator for clast expressions.
-  //
-  // @param B The IRBuilder that defines where the code to calculate the
-  //          clast expressions should be inserted.
-  // @param IVMAP A Map that translates strings describing the induction
-  //              variables to the Values* that represent these variables
-  //              on the LLVM side.
-  ClastExpCodeGen(PollyIRBuilder &B, CharMapT &IVMap);
-
-  // Generates code to calculate a given clast expression.
-  //
-  // @param e The expression to calculate.
-  // @return The Value that holds the result.
-  Value *codegen(const clast_expr *e, Type *Ty);
-};
-
-Value *ClastExpCodeGen::codegen(const clast_name *e, Type *Ty) {
-  CharMapT::const_iterator I = IVS.find(e->name);
-
-  assert(I != IVS.end() && "Clast name not found");
-
-  return Builder.CreateSExtOrBitCast(I->second, Ty);
-}
-
-static APInt APInt_from_MPZ(const mpz_t mpz) {
-  uint64_t *p = nullptr;
-  size_t sz;
-
-  p = (uint64_t *)mpz_export(p, &sz, -1, sizeof(uint64_t), 0, 0, mpz);
-
-  if (p) {
-    APInt A((unsigned)mpz_sizeinbase(mpz, 2), (unsigned)sz, p);
-    A = A.zext(A.getBitWidth() + 1);
-    free(p);
-
-    if (mpz_sgn(mpz) == -1)
-      return -A;
-    else
-      return A;
-  } else {
-    uint64_t val = 0;
-    return APInt(1, 1, &val);
-  }
-}
-
-Value *ClastExpCodeGen::codegen(const clast_term *e, Type *Ty) {
-  APInt a = APInt_from_MPZ(e->val);
-
-  Value *ConstOne = ConstantInt::get(Builder.getContext(), a);
-  ConstOne = Builder.CreateSExtOrBitCast(ConstOne, Ty);
-
-  if (!e->var)
-    return ConstOne;
-
-  Value *var = codegen(e->var, Ty);
-  return Builder.CreateMul(ConstOne, var);
-}
-
-Value *ClastExpCodeGen::codegen(const clast_binary *e, Type *Ty) {
-  Value *LHS = codegen(e->LHS, Ty);
-
-  APInt RHS_AP = APInt_from_MPZ(e->RHS);
-
-  Value *RHS = ConstantInt::get(Builder.getContext(), RHS_AP);
-  RHS = Builder.CreateSExtOrBitCast(RHS, Ty);
-
-  switch (e->type) {
-  case clast_bin_mod:
-    return Builder.CreateSRem(LHS, RHS);
-  case clast_bin_fdiv: {
-    // floord(n,d) ((n < 0) ? (n - d + 1) : n) / d
-    Value *One = ConstantInt::get(Ty, 1);
-    Value *Zero = ConstantInt::get(Ty, 0);
-    Value *Sum1 = Builder.CreateSub(LHS, RHS);
-    Value *Sum2 = Builder.CreateAdd(Sum1, One);
-    Value *isNegative = Builder.CreateICmpSLT(LHS, Zero);
-    Value *Dividend = Builder.CreateSelect(isNegative, Sum2, LHS);
-    return Builder.CreateSDiv(Dividend, RHS);
-  }
-  case clast_bin_cdiv: {
-    // ceild(n,d) ((n < 0) ? n : (n + d - 1)) / d
-    Value *One = ConstantInt::get(Ty, 1);
-    Value *Zero = ConstantInt::get(Ty, 0);
-    Value *Sum1 = Builder.CreateAdd(LHS, RHS);
-    Value *Sum2 = Builder.CreateSub(Sum1, One);
-    Value *isNegative = Builder.CreateICmpSLT(LHS, Zero);
-    Value *Dividend = Builder.CreateSelect(isNegative, LHS, Sum2);
-    return Builder.CreateSDiv(Dividend, RHS);
-  }
-  case clast_bin_div:
-    return Builder.CreateSDiv(LHS, RHS);
-  }
-
-  llvm_unreachable("Unknown clast binary expression type");
-}
-
-Value *ClastExpCodeGen::codegen(const clast_reduction *r, Type *Ty) {
-  assert((r->type == clast_red_min || r->type == clast_red_max ||
-          r->type == clast_red_sum) &&
-         "Clast reduction type not supported");
-  Value *old = codegen(r->elts[0], Ty);
-
-  for (int i = 1; i < r->n; ++i) {
-    Value *exprValue = codegen(r->elts[i], Ty);
-
-    switch (r->type) {
-    case clast_red_min: {
-      Value *cmp = Builder.CreateICmpSLT(old, exprValue);
-      old = Builder.CreateSelect(cmp, old, exprValue);
-      break;
-    }
-    case clast_red_max: {
-      Value *cmp = Builder.CreateICmpSGT(old, exprValue);
-      old = Builder.CreateSelect(cmp, old, exprValue);
-      break;
-    }
-    case clast_red_sum:
-      old = Builder.CreateAdd(old, exprValue);
-      break;
-    }
-  }
-
-  return old;
-}
-
-ClastExpCodeGen::ClastExpCodeGen(PollyIRBuilder &B, CharMapT &IVMap)
-    : Builder(B), IVS(IVMap) {}
-
-Value *ClastExpCodeGen::codegen(const clast_expr *e, Type *Ty) {
-  switch (e->type) {
-  case clast_expr_name:
-    return codegen((const clast_name *)e, Ty);
-  case clast_expr_term:
-    return codegen((const clast_term *)e, Ty);
-  case clast_expr_bin:
-    return codegen((const clast_binary *)e, Ty);
-  case clast_expr_red:
-    return codegen((const clast_reduction *)e, Ty);
-  }
-
-  llvm_unreachable("Unknown clast expression!");
-}
-
-class ClastStmtCodeGen {
-public:
-  const std::vector<std::string> &getParallelLoops();
-
-private:
-  // The Scop we code generate.
-  Scop *S;
-  Pass *P;
-  LoopInfo &LI;
-  ScalarEvolution &SE;
-  DominatorTree &DT;
-  const DataLayout &DL;
-
-  // The Builder specifies the current location to code generate at.
-  PollyIRBuilder &Builder;
-
-  // Map the Values from the old code to their counterparts in the new code.
-  ValueMapT ValueMap;
-
-  // Map the loops from the old code to expressions function of the induction
-  // variables in the new code.  For example, when the code generator produces
-  // this AST:
-  //
-  //   for (int c1 = 0; c1 <= 1023; c1 += 1)
-  //     for (int c2 = 0; c2 <= 1023; c2 += 1)
-  //       Stmt(c2 + 3, c1);
-  //
-  // LoopToScev is a map associating:
-  //   "outer loop in the old loop nest" -> SCEV("c2 + 3"),
-  //   "inner loop in the old loop nest" -> SCEV("c1").
-  LoopToScevMapT LoopToScev;
-
-  // clastVars maps from the textual representation of a clast variable to its
-  // current *Value. clast variables are scheduling variables, original
-  // induction variables or parameters. They are used either in loop bounds or
-  // to define the statement instance that is executed.
-  //
-  //   for (s = 0; s < n + 3; ++i)
-  //     for (t = s; t < m; ++j)
-  //       Stmt(i = s + 3 * m, j = t);
-  //
-  // {s,t,i,j,n,m} is the set of clast variables in this clast.
-  CharMapT ClastVars;
-
-  // Codegenerator for clast expressions.
-  ClastExpCodeGen ExpGen;
-
-  // Do we currently generate parallel code?
-  bool parallelCodeGeneration;
-
-  std::vector<std::string> parallelLoops;
-
-  void codegen(const clast_assignment *a);
-
-  void codegen(const clast_assignment *a, ScopStmt *Statement,
-               unsigned Dimension, int vectorDim,
-               std::vector<ValueMapT> *VectorVMap = 0,
-               std::vector<LoopToScevMapT> *VLTS = 0);
-
-  void codegenSubstitutions(const clast_stmt *Assignment, ScopStmt *Statement,
-                            int vectorDim = 0,
-                            std::vector<ValueMapT> *VectorVMap = 0,
-                            std::vector<LoopToScevMapT> *VLTS = 0);
-
-  void codegen(const clast_user_stmt *u, std::vector<Value *> *IVS = nullptr,
-               const char *iterator = nullptr,
-               __isl_take isl_set *scatteringDomain = 0);
-
-  void codegen(const clast_block *b);
-
-  /// @brief Create a classical sequential loop.
-  void codegenForSequential(const clast_for *f);
-
-  /// @brief Create OpenMP structure values.
-  ///
-  /// Create a list of values that has to be stored into the OpenMP subfuncition
-  /// structure.
-  SetVector<Value *> getOMPValues(const clast_stmt *Body);
-
-  /// @brief Update ClastVars and ValueMap according to a value map.
-  ///
-  /// @param VMap A map from old to new values.
-  void updateWithValueMap(ParallelLoopGenerator::ValueToValueMapTy &VMap);
-
-  /// @brief Create an OpenMP parallel for loop.
-  ///
-  /// This loop reflects a loop as if it would have been created by an OpenMP
-  /// statement.
-  void codegenForOpenMP(const clast_for *f);
-
-#ifdef GPU_CODEGEN
-  /// @brief Create GPGPU device memory access values.
-  ///
-  /// Create a list of values that will be set to be parameters of the GPGPU
-  /// subfunction. These parameters represent device memory base addresses
-  /// and the size in bytes.
-  SetVector<Value *> getGPUValues(unsigned &OutputBytes);
-
-  /// @brief Create a GPU parallel for loop.
-  ///
-  /// This loop reflects a loop as if it would have been created by a GPU
-  /// statement.
-  void codegenForGPGPU(const clast_for *F);
-
-  /// @brief Get innermost for loop.
-  const clast_stmt *getScheduleInfo(const clast_for *F,
-                                    std::vector<int> &NumIters,
-                                    unsigned &LoopDepth,
-                                    unsigned &NonPLoopDepth);
-#endif /* GPU_CODEGEN */
-
-  /// @brief Check if a loop is parallel
-  ///
-  /// Detect if a clast_for loop can be executed in parallel.
-  ///
-  /// @param For The clast for loop to check.
-  ///
-  /// @return bool Returns true if the incoming clast_for statement can
-  ///              execute in parallel.
-  bool isParallelFor(const clast_for *For);
-
-  bool isInnermostLoop(const clast_for *f);
-
-  /// @brief Get the number of loop iterations for this loop.
-  /// @param f The clast for loop to check.
-  int getNumberOfIterations(const clast_for *f);
-
-  /// @brief Create vector instructions for this loop.
-  void codegenForVector(const clast_for *f);
-
-  void codegen(const clast_for *f);
-
-  Value *codegen(const clast_equation *eq);
-
-  void codegen(const clast_guard *g);
-
-  void codegen(const clast_stmt *stmt);
-
-  void addParameters(const CloogNames *names);
-
-  IntegerType *getIntPtrTy();
-
-public:
-  void codegen(const clast_root *r);
-
-  ClastStmtCodeGen(Scop *scop, PollyIRBuilder &B, Pass *P);
-};
-}
-
-IntegerType *ClastStmtCodeGen::getIntPtrTy() {
-  return P->getAnalysis<DataLayoutPass>().getDataLayout().getIntPtrType(
-      Builder.getContext());
-}
-
-const std::vector<std::string> &ClastStmtCodeGen::getParallelLoops() {
-  return parallelLoops;
-}
-
-void ClastStmtCodeGen::codegen(const clast_assignment *a) {
-  Value *V = ExpGen.codegen(a->RHS, getIntPtrTy());
-  ClastVars[a->LHS] = V;
-}
-
-void ClastStmtCodeGen::codegen(const clast_assignment *A, ScopStmt *Stmt,
-                               unsigned Dim, int VectorDim,
-                               std::vector<ValueMapT> *VectorVMap,
-                               std::vector<LoopToScevMapT> *VLTS) {
-  Value *RHS;
-
-  assert(!A->LHS && "Statement assignments do not have left hand side");
-
-  RHS = ExpGen.codegen(A->RHS, Builder.getInt64Ty());
-
-  const llvm::SCEV *URHS = S->getSE()->getUnknown(RHS);
-  if (VLTS)
-    (*VLTS)[VectorDim][Stmt->getLoopForDimension(Dim)] = URHS;
-  LoopToScev[Stmt->getLoopForDimension(Dim)] = URHS;
-}
-
-void ClastStmtCodeGen::codegenSubstitutions(const clast_stmt *Assignment,
-                                            ScopStmt *Statement, int vectorDim,
-                                            std::vector<ValueMapT> *VectorVMap,
-                                            std::vector<LoopToScevMapT> *VLTS) {
-  int Dimension = 0;
-
-  while (Assignment) {
-    assert(CLAST_STMT_IS_A(Assignment, stmt_ass) &&
-           "Substitions are expected to be assignments");
-    codegen((const clast_assignment *)Assignment, Statement, Dimension,
-            vectorDim, VectorVMap, VLTS);
-    Assignment = Assignment->next;
-    Dimension++;
-  }
-}
-
-// Takes the cloog specific domain and translates it into a map Statement ->
-// PartialSchedule, where the PartialSchedule contains all the dimensions that
-// have been code generated up to this point.
-static __isl_give isl_map *extractPartialSchedule(ScopStmt *Statement,
-                                                  __isl_take isl_set *Domain) {
-  isl_map *Schedule = Statement->getScattering();
-  int ScheduledDimensions = isl_set_dim(Domain, isl_dim_set);
-  int UnscheduledDimensions =
-      isl_map_dim(Schedule, isl_dim_out) - ScheduledDimensions;
-
-  isl_set_free(Domain);
-
-  return isl_map_project_out(Schedule, isl_dim_out, ScheduledDimensions,
-                             UnscheduledDimensions);
-}
-
-void ClastStmtCodeGen::codegen(const clast_user_stmt *u,
-                               std::vector<Value *> *IVS, const char *iterator,
-                               __isl_take isl_set *Domain) {
-  ScopStmt *Statement = (ScopStmt *)u->statement->usr;
-
-  if (u->substitutions)
-    codegenSubstitutions(u->substitutions, Statement);
-
-  int VectorDimensions = IVS ? IVS->size() : 1;
-
-  if (VectorDimensions == 1) {
-    BlockGenerator::generate(Builder, *Statement, ValueMap, LoopToScev, P, LI,
-                             SE);
-    isl_set_free(Domain);
-    return;
-  }
-
-  VectorValueMapT VectorMap(VectorDimensions);
-  std::vector<LoopToScevMapT> VLTS(VectorDimensions);
-
-  if (IVS) {
-    assert(u->substitutions && "Substitutions expected!");
-    int i = 0;
-    for (Value *IV : *IVS) {
-      ClastVars[iterator] = IV;
-      codegenSubstitutions(u->substitutions, Statement, i, &VectorMap, &VLTS);
-      i++;
-    }
-  }
-
-  // Copy the current value map into all vector maps if the key wasn't
-  // available yet. This is needed in case vector codegen is performed in
-  // OpenMP subfunctions.
-  for (const auto &KV : ValueMap)
-    for (int i = 0; i < VectorDimensions; ++i)
-      VectorMap[i].insert(KV);
-
-  isl_map *Schedule = extractPartialSchedule(Statement, Domain);
-  VectorBlockGenerator::generate(Builder, *Statement, VectorMap, VLTS, Schedule,
-                                 P, LI, SE);
-  isl_map_free(Schedule);
-}
-
-void ClastStmtCodeGen::codegen(const clast_block *b) {
-  if (b->body)
-    codegen(b->body);
-}
-
-void ClastStmtCodeGen::codegenForSequential(const clast_for *f) {
-  Value *LowerBound, *UpperBound, *IV, *Stride;
-  BasicBlock *ExitBlock;
-  Type *IntPtrTy = getIntPtrTy();
-
-  LowerBound = ExpGen.codegen(f->LB, IntPtrTy);
-  UpperBound = ExpGen.codegen(f->UB, IntPtrTy);
-  Stride = Builder.getInt(APInt_from_MPZ(f->stride));
-
-  IV = createLoop(LowerBound, UpperBound, Stride, Builder, P, LI, DT, ExitBlock,
-                  CmpInst::ICMP_SLE);
-
-  // Add loop iv to symbols.
-  ClastVars[f->iterator] = IV;
-
-  if (f->body)
-    codegen(f->body);
-
-  // Loop is finished, so remove its iv from the live symbols.
-  ClastVars.erase(f->iterator);
-  Builder.SetInsertPoint(ExitBlock->begin());
-}
-
-// Helper class to determine all scalar parameters used in the basic blocks of a
-// clast. Scalar parameters are scalar variables defined outside of the SCoP.
-class ParameterVisitor : public ClastVisitor {
-  std::set<Value *> Values;
-
-public:
-  ParameterVisitor() : ClastVisitor(), Values() {}
-
-  void visitUser(const clast_user_stmt *Stmt) {
-    const ScopStmt *S = static_cast<const ScopStmt *>(Stmt->statement->usr);
-    const BasicBlock *BB = S->getBasicBlock();
-
-    // Check all the operands of instructions in the basic block.
-    for (const Instruction &Inst : *BB) {
-      for (Value *SrcVal : Inst.operands()) {
-        if (Instruction *OpInst = dyn_cast<Instruction>(SrcVal))
-          if (S->getParent()->getRegion().contains(OpInst))
-            continue;
-
-        if (isa<Instruction>(SrcVal) || isa<Argument>(SrcVal))
-          Values.insert(SrcVal);
-      }
-    }
-  }
-
-  // Iterator to iterate over the values found.
-  typedef std::set<Value *>::const_iterator const_iterator;
-  inline const_iterator begin() const { return Values.begin(); }
-  inline const_iterator end() const { return Values.end(); }
-};
-
-SetVector<Value *> ClastStmtCodeGen::getOMPValues(const clast_stmt *Body) {
-  SetVector<Value *> Values;
-
-  // The clast variables
-  for (const auto &I : ClastVars)
-    Values.insert(I.second);
-
-  // Find the temporaries that are referenced in the clast statements'
-  // basic blocks but are not defined by these blocks (e.g., references
-  // to function arguments or temporaries defined before the start of
-  // the SCoP).
-  ParameterVisitor Params;
-  Params.visit(Body);
-
-  for (Value *V : Params) {
-    Values.insert(V);
-    DEBUG(dbgs() << "Adding temporary for OMP copy-in: " << *V << "\n");
-  }
-
-  return Values;
-}
-
-void ClastStmtCodeGen::updateWithValueMap(
-    ParallelLoopGenerator::ValueToValueMapTy &VMap) {
-  std::set<Value *> Inserted;
-
-  for (const auto &I : ClastVars) {
-    ClastVars[I.first] = VMap[I.second];
-    Inserted.insert(I.second);
-  }
-
-  for (const auto &I : VMap) {
-    if (Inserted.count(I.first))
-      continue;
-
-    ValueMap[I.first] = I.second;
-  }
-}
-
-static void clearDomtree(Function *F, DominatorTree &DT) {
-  DomTreeNode *N = DT.getNode(&F->getEntryBlock());
-  std::vector<BasicBlock *> Nodes;
-  for (po_iterator<DomTreeNode *> I = po_begin(N), E = po_end(N); I != E; ++I)
-    Nodes.push_back(I->getBlock());
-
-  for (BasicBlock *BB : Nodes)
-    DT.eraseNode(BB);
-}
-
-void ClastStmtCodeGen::codegenForOpenMP(const clast_for *For) {
-  Value *Stride, *LB, *UB, *IV;
-  BasicBlock::iterator LoopBody;
-  IntegerType *IntPtrTy = getIntPtrTy();
-  SetVector<Value *> Values;
-  ParallelLoopGenerator::ValueToValueMapTy VMap;
-  ParallelLoopGenerator OMPGen(Builder, P, LI, DT, DL);
-
-  Stride = Builder.getInt(APInt_from_MPZ(For->stride));
-  Stride = Builder.CreateSExtOrBitCast(Stride, IntPtrTy);
-  LB = ExpGen.codegen(For->LB, IntPtrTy);
-  UB = ExpGen.codegen(For->UB, IntPtrTy);
-
-  Values = getOMPValues(For->body);
-
-  IV = OMPGen.createParallelLoop(LB, UB, Stride, Values, VMap, &LoopBody);
-  BasicBlock::iterator AfterLoop = Builder.GetInsertPoint();
-  Builder.SetInsertPoint(LoopBody);
-
-  // Save the current values.
-  const ValueMapT ValueMapCopy = ValueMap;
-  const CharMapT ClastVarsCopy = ClastVars;
-
-  updateWithValueMap(VMap);
-  ClastVars[For->iterator] = IV;
-
-  if (For->body)
-    codegen(For->body);
-
-  // Restore the original values.
-  ValueMap = ValueMapCopy;
-  ClastVars = ClastVarsCopy;
-
-  clearDomtree((*LoopBody).getParent()->getParent(),
-               P->getAnalysis<DominatorTreeWrapperPass>().getDomTree());
-
-  Builder.SetInsertPoint(AfterLoop);
-}
-
-#ifdef GPU_CODEGEN
-static unsigned getArraySizeInBytes(const ArrayType *AT) {
-  unsigned Bytes = AT->getNumElements();
-  if (const ArrayType *T = dyn_cast<ArrayType>(AT->getElementType()))
-    Bytes *= getArraySizeInBytes(T);
-  else
-    Bytes *= AT->getElementType()->getPrimitiveSizeInBits() / 8;
-
-  return Bytes;
-}
-
-SetVector<Value *> ClastStmtCodeGen::getGPUValues(unsigned &OutputBytes) {
-  SetVector<Value *> Values;
-  OutputBytes = 0;
-
-  // Record the memory reference base addresses.
-  for (ScopStmt *Stmt : *S) {
-    for (MemoryAccess *MA : *Stmt) {
-      Value *BaseAddr = MA->getBaseAddr();
-      Values.insert((BaseAddr));
-
-      // FIXME: we assume that there is one and only one array to be written
-      // in a SCoP.
-      int NumWrites = 0;
-      if (MA->isWrite()) {
-        ++NumWrites;
-        assert(NumWrites <= 1 &&
-               "We support at most one array to be written in a SCoP.");
-        if (const PointerType *PT =
-                dyn_cast<PointerType>(BaseAddr->getType())) {
-          Type *T = PT->getArrayElementType();
-          const ArrayType *ATy = dyn_cast<ArrayType>(T);
-          OutputBytes = getArraySizeInBytes(ATy);
-        }
-      }
-    }
-  }
-
-  return Values;
-}
-
-const clast_stmt *ClastStmtCodeGen::getScheduleInfo(const clast_for *F,
-                                                    std::vector<int> &NumIters,
-                                                    unsigned &LoopDepth,
-                                                    unsigned &NonPLoopDepth) {
-  clast_stmt *Stmt = (clast_stmt *)F;
-  const clast_for *Result;
-  bool NonParaFlag = false;
-  LoopDepth = 0;
-  NonPLoopDepth = 0;
-
-  while (Stmt) {
-    if (CLAST_STMT_IS_A(Stmt, stmt_for)) {
-      const clast_for *T = (clast_for *)Stmt;
-      if (isParallelFor(T)) {
-        if (!NonParaFlag) {
-          NumIters.push_back(getNumberOfIterations(T));
-          Result = T;
-        }
-      } else
-        NonParaFlag = true;
-
-      Stmt = T->body;
-      LoopDepth++;
-      continue;
-    }
-    Stmt = Stmt->next;
-  }
-
-  assert(NumIters.size() == 4 &&
-         "The loops should be tiled into 4-depth parallel loops and an "
-         "innermost non-parallel one (if exist).");
-  NonPLoopDepth = LoopDepth - NumIters.size();
-  assert(NonPLoopDepth <= 1 &&
-         "We support only one innermost non-parallel loop currently.");
-  return (const clast_stmt *)Result->body;
-}
-
-void ClastStmtCodeGen::codegenForGPGPU(const clast_for *F) {
-  BasicBlock::iterator LoopBody;
-  SetVector<Value *> Values;
-  SetVector<Value *> IVS;
-  std::vector<int> NumIterations;
-  PTXGenerator::ValueToValueMapTy VMap;
-
-  assert(!GPUTriple.empty() &&
-         "Target triple should be set properly for GPGPU code generation.");
-  PTXGenerator PTXGen(Builder, P, GPUTriple);
-
-  // Get original IVS and ScopStmt
-  unsigned TiledLoopDepth, NonPLoopDepth;
-  const clast_stmt *InnerStmt =
-      getScheduleInfo(F, NumIterations, TiledLoopDepth, NonPLoopDepth);
-  const clast_stmt *TmpStmt;
-  const clast_user_stmt *U;
-  const clast_for *InnerFor;
-  if (CLAST_STMT_IS_A(InnerStmt, stmt_for)) {
-    InnerFor = (const clast_for *)InnerStmt;
-    TmpStmt = InnerFor->body;
-  } else
-    TmpStmt = InnerStmt;
-  U = (const clast_user_stmt *)TmpStmt;
-  ScopStmt *Statement = (ScopStmt *)U->statement->usr;
-  for (unsigned i = 0; i < Statement->getNumIterators() - NonPLoopDepth; i++) {
-    const Value *IV = Statement->getInductionVariableForDimension(i);
-    IVS.insert(const_cast<Value *>(IV));
-  }
-
-  unsigned OutBytes;
-  Values = getGPUValues(OutBytes);
-  PTXGen.setOutputBytes(OutBytes);
-  PTXGen.startGeneration(Values, IVS, VMap, &LoopBody);
-
-  BasicBlock::iterator AfterLoop = Builder.GetInsertPoint();
-  Builder.SetInsertPoint(LoopBody);
-
-  BasicBlock *AfterBB = nullptr;
-  if (NonPLoopDepth) {
-    Value *LowerBound, *UpperBound, *IV, *Stride;
-    Type *IntPtrTy = getIntPtrTy();
-    LowerBound = ExpGen.codegen(InnerFor->LB, IntPtrTy);
-    UpperBound = ExpGen.codegen(InnerFor->UB, IntPtrTy);
-    Stride = Builder.getInt(APInt_from_MPZ(InnerFor->stride));
-    IV = createLoop(LowerBound, UpperBound, Stride, Builder, P, LI, DT, AfterBB,
-                    CmpInst::ICMP_SLE);
-    const Value *OldIV_ = Statement->getInductionVariableForDimension(2);
-    Value *OldIV = const_cast<Value *>(OldIV_);
-    VMap.insert(std::make_pair(OldIV, IV));
-  }
-
-  updateWithValueMap(VMap);
-
-  BlockGenerator::generate(Builder, *Statement, ValueMap, LoopToScev, P, LI,
-                           SE);
-
-  if (AfterBB)
-    Builder.SetInsertPoint(AfterBB->begin());
-
-  // FIXME: The replacement of the host base address with the parameter of ptx
-  // subfunction should have been done by updateWithValueMap. We use the
-  // following codes to avoid affecting other parts of Polly. This should be
-  // fixed later.
-  Function *FN = Builder.GetInsertBlock()->getParent();
-  for (Value *BaseAddr : Values)
-    for (BasicBlock *BB : *FN)
-      for (Instruction *Inst : *BB)
-        Inst->replaceUsesOfWith(BaseAddr, ValueMap[BaseAddr]);
-  Builder.SetInsertPoint(AfterLoop);
-  PTXGen.setLaunchingParameters(NumIterations[0], NumIterations[1],
-                                NumIterations[2], NumIterations[3]);
-  PTXGen.finishGeneration(FN);
-}
-#endif
-
-bool ClastStmtCodeGen::isInnermostLoop(const clast_for *f) {
-  const clast_stmt *stmt = f->body;
-
-  while (stmt) {
-    if (!CLAST_STMT_IS_A(stmt, stmt_user))
-      return false;
-
-    stmt = stmt->next;
-  }
-
-  return true;
-}
-
-int ClastStmtCodeGen::getNumberOfIterations(const clast_for *For) {
-  isl_set *LoopDomain = isl_set_copy(isl_set_from_cloog_domain(For->domain));
-  int NumberOfIterations = polly::getNumberOfIterations(LoopDomain);
-  if (NumberOfIterations == -1)
-    return -1;
-  return NumberOfIterations / mpz_get_si(For->stride) + 1;
-}
-
-void ClastStmtCodeGen::codegenForVector(const clast_for *F) {
-  DEBUG(dbgs() << "Vectorizing loop '" << F->iterator << "'\n");
-  int VectorWidth = getNumberOfIterations(F);
-
-  Value *LB = ExpGen.codegen(F->LB, getIntPtrTy());
-
-  APInt Stride = APInt_from_MPZ(F->stride);
-  IntegerType *LoopIVType = dyn_cast<IntegerType>(LB->getType());
-  Stride = Stride.zext(LoopIVType->getBitWidth());
-  Value *StrideValue = ConstantInt::get(LoopIVType, Stride);
-
-  std::vector<Value *> IVS(VectorWidth);
-  IVS[0] = LB;
-
-  for (int i = 1; i < VectorWidth; i++)
-    IVS[i] = Builder.CreateAdd(IVS[i - 1], StrideValue, "p_vector_iv");
-
-  isl_set *Domain = isl_set_copy(isl_set_from_cloog_domain(F->domain));
-
-  // Add loop iv to symbols.
-  ClastVars[F->iterator] = LB;
-
-  const clast_stmt *Stmt = F->body;
-
-  while (Stmt) {
-    codegen((const clast_user_stmt *)Stmt, &IVS, F->iterator,
-            isl_set_copy(Domain));
-    Stmt = Stmt->next;
-  }
-
-  // Loop is finished, so remove its iv from the live symbols.
-  isl_set_free(Domain);
-  ClastVars.erase(F->iterator);
-}
-
-static isl_union_map *getCombinedScheduleForSpace(Scop *S, unsigned dimLevel) {
-  isl_space *Space = S->getParamSpace();
-  isl_union_map *schedule = isl_union_map_empty(Space);
-
-  for (ScopStmt *Stmt : *S) {
-    unsigned remainingDimensions = Stmt->getNumScattering() - dimLevel;
-    isl_map *Scattering = isl_map_project_out(
-        Stmt->getScattering(), isl_dim_out, dimLevel, remainingDimensions);
-    schedule = isl_union_map_add_map(schedule, Scattering);
-  }
-
-  return schedule;
-}
-
-bool ClastStmtCodeGen::isParallelFor(const clast_for *f) {
-  isl_set *Domain = isl_set_copy(isl_set_from_cloog_domain(f->domain));
-  assert(Domain && "Cannot access domain of loop");
-
-  Dependences &D = P->getAnalysis<Dependences>();
-  isl_union_map *Deps =
-      D.getDependences(Dependences::TYPE_RAW | Dependences::TYPE_WAW |
-                       Dependences::TYPE_WAR | Dependences::TYPE_RAW);
-  isl_union_map *Schedule =
-      getCombinedScheduleForSpace(S, isl_set_n_dim(Domain));
-  Schedule =
-      isl_union_map_intersect_range(Schedule, isl_union_set_from_set(Domain));
-  bool IsParallel = D.isParallel(Schedule, Deps);
-  isl_union_map_free(Schedule);
-  return IsParallel;
-}
-
-void ClastStmtCodeGen::codegen(const clast_for *f) {
-  bool Vector = PollyVectorizerChoice != VECTORIZER_NONE;
-  if ((Vector || OpenMP) && isParallelFor(f)) {
-    if (Vector && isInnermostLoop(f) && (-1 != getNumberOfIterations(f)) &&
-        (getNumberOfIterations(f) <= 16)) {
-      codegenForVector(f);
-      return;
-    }
-
-    if (OpenMP && !parallelCodeGeneration) {
-      parallelCodeGeneration = true;
-      parallelLoops.push_back(f->iterator);
-      codegenForOpenMP(f);
-      parallelCodeGeneration = false;
-      return;
-    }
-  }
-
-#ifdef GPU_CODEGEN
-  if (GPGPU && isParallelFor(f)) {
-    if (!parallelCodeGeneration) {
-      parallelCodeGeneration = true;
-      parallelLoops.push_back(f->iterator);
-      codegenForGPGPU(f);
-      parallelCodeGeneration = false;
-      return;
-    }
-  }
-#endif
-
-  codegenForSequential(f);
-}
-
-Value *ClastStmtCodeGen::codegen(const clast_equation *eq) {
-  Value *LHS = ExpGen.codegen(eq->LHS, getIntPtrTy());
-  Value *RHS = ExpGen.codegen(eq->RHS, getIntPtrTy());
-  CmpInst::Predicate P;
-
-  if (eq->sign == 0)
-    P = ICmpInst::ICMP_EQ;
-  else if (eq->sign > 0)
-    P = ICmpInst::ICMP_SGE;
-  else
-    P = ICmpInst::ICMP_SLE;
-
-  return Builder.CreateICmp(P, LHS, RHS);
-}
-
-void ClastStmtCodeGen::codegen(const clast_guard *g) {
-  Function *F = Builder.GetInsertBlock()->getParent();
-  LLVMContext &Context = F->getContext();
-
-  BasicBlock *CondBB =
-      SplitBlock(Builder.GetInsertBlock(), Builder.GetInsertPoint(), P);
-  CondBB->setName("polly.cond");
-  BasicBlock *MergeBB = SplitBlock(CondBB, CondBB->begin(), P);
-  MergeBB->setName("polly.merge");
-  BasicBlock *ThenBB = BasicBlock::Create(Context, "polly.then", F);
-
-  DominatorTree &DT = P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
-  DT.addNewBlock(ThenBB, CondBB);
-  DT.changeImmediateDominator(MergeBB, CondBB);
-
-  CondBB->getTerminator()->eraseFromParent();
-
-  Builder.SetInsertPoint(CondBB);
-
-  Value *Predicate = codegen(&(g->eq[0]));
-
-  for (int i = 1; i < g->n; ++i) {
-    Value *TmpPredicate = codegen(&(g->eq[i]));
-    Predicate = Builder.CreateAnd(Predicate, TmpPredicate);
-  }
-
-  Builder.CreateCondBr(Predicate, ThenBB, MergeBB);
-  Builder.SetInsertPoint(ThenBB);
-  Builder.CreateBr(MergeBB);
-  Builder.SetInsertPoint(ThenBB->begin());
-
-  LoopInfo &LI = P->getAnalysis<LoopInfo>();
-  Loop *L = LI.getLoopFor(CondBB);
-  if (L)
-    L->addBasicBlockToLoop(ThenBB, LI.getBase());
-
-  codegen(g->then);
-
-  Builder.SetInsertPoint(MergeBB->begin());
-}
-
-void ClastStmtCodeGen::codegen(const clast_stmt *stmt) {
-  if (CLAST_STMT_IS_A(stmt, stmt_root))
-    assert(false && "No second root statement expected");
-  else if (CLAST_STMT_IS_A(stmt, stmt_ass))
-    codegen((const clast_assignment *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_user))
-    codegen((const clast_user_stmt *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_block))
-    codegen((const clast_block *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_for))
-    codegen((const clast_for *)stmt);
-  else if (CLAST_STMT_IS_A(stmt, stmt_guard))
-    codegen((const clast_guard *)stmt);
-
-  if (stmt->next)
-    codegen(stmt->next);
-}
-
-void ClastStmtCodeGen::addParameters(const CloogNames *names) {
-  SCEVExpander Rewriter(P->getAnalysis<ScalarEvolution>(), "polly");
-
-  int i = 0;
-  for (Scop::param_iterator PI = S->param_begin(), PE = S->param_end();
-       PI != PE; ++PI) {
-    assert(i < names->nb_parameters && "Not enough parameter names");
-
-    const SCEV *Param = *PI;
-    Type *Ty = Param->getType();
-
-    Instruction *insertLocation = --(Builder.GetInsertBlock()->end());
-    Value *V = Rewriter.expandCodeFor(Param, Ty, insertLocation);
-    ClastVars[names->parameters[i]] = V;
-
-    ++i;
-  }
-}
-
-void ClastStmtCodeGen::codegen(const clast_root *r) {
-  addParameters(r->names);
-
-  parallelCodeGeneration = false;
-
-  const clast_stmt *stmt = (const clast_stmt *)r;
-  if (stmt->next)
-    codegen(stmt->next);
-}
-
-ClastStmtCodeGen::ClastStmtCodeGen(Scop *scop, PollyIRBuilder &B, Pass *P)
-    : S(scop), P(P), LI(P->getAnalysis<LoopInfo>()),
-      SE(P->getAnalysis<ScalarEvolution>()),
-      DT(P->getAnalysis<DominatorTreeWrapperPass>().getDomTree()),
-      DL(P->getAnalysis<DataLayoutPass>().getDataLayout()), Builder(B),
-      ExpGen(Builder, ClastVars) {}
-
-namespace {
-class CodeGeneration : public ScopPass {
-  std::vector<std::string> ParallelLoops;
-
-public:
-  static char ID;
-
-  CodeGeneration() : ScopPass(ID) {}
-
-  bool runOnScop(Scop &S) {
-    ParallelLoops.clear();
-
-    assert(!S.getRegion().isTopLevelRegion() &&
-           "Top level regions are not supported");
-
-    simplifyRegion(&S, this);
-
-    Value *RTC = ConstantInt::getTrue(S.getSE()->getContext());
-    BasicBlock *StartBlock = executeScopConditionally(S, this, RTC);
-
-    PollyIRBuilder Builder(StartBlock->begin());
-
-    ClastStmtCodeGen CodeGen(&S, Builder, this);
-    CloogInfo &C = getAnalysis<CloogInfo>();
-    CodeGen.codegen(C.getClast());
-
-    ParallelLoops.insert(ParallelLoops.begin(),
-                         CodeGen.getParallelLoops().begin(),
-                         CodeGen.getParallelLoops().end());
-    return true;
-  }
-
-  virtual void printScop(raw_ostream &OS) const {
-    for (const auto &PI : ParallelLoops)
-      OS << "Parallel loop with iterator '" << PI << "' generated\n";
-  }
-
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequired<CloogInfo>();
-    AU.addRequired<Dependences>();
-    AU.addRequired<DominatorTreeWrapperPass>();
-    AU.addRequired<RegionInfoPass>();
-    AU.addRequired<ScalarEvolution>();
-    AU.addRequired<ScopDetection>();
-    AU.addRequired<ScopInfo>();
-    AU.addRequired<DataLayoutPass>();
-    AU.addRequired<DataLayoutPass>();
-    AU.addRequired<LoopInfo>();
-
-    AU.addPreserved<CloogInfo>();
-    AU.addPreserved<DataLayoutPass>();
-    AU.addPreserved<Dependences>();
-    AU.addPreserved<LoopInfo>();
-    AU.addPreserved<DominatorTreeWrapperPass>();
-    AU.addPreserved<ScopDetection>();
-    AU.addPreserved<ScalarEvolution>();
-
-    // FIXME: We do not yet add regions for the newly generated code to the
-    //        region tree.
-    AU.addPreserved<RegionInfoPass>();
-    AU.addPreserved<TempScopInfo>();
-    AU.addPreserved<ScopInfo>();
-    AU.addPreservedID(IndependentBlocksID);
-  }
-};
-}
-
-char CodeGeneration::ID = 1;
-
-Pass *polly::createCodeGenerationPass() { return new CodeGeneration(); }
-
-INITIALIZE_PASS_BEGIN(CodeGeneration, "polly-codegen",
-                      "Polly - Create LLVM-IR from SCoPs", false, false);
-INITIALIZE_PASS_DEPENDENCY(CloogInfo);
-INITIALIZE_PASS_DEPENDENCY(Dependences);
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass);
-INITIALIZE_PASS_DEPENDENCY(RegionInfoPass);
-INITIALIZE_PASS_DEPENDENCY(DataLayoutPass);
-INITIALIZE_PASS_DEPENDENCY(ScalarEvolution);
-INITIALIZE_PASS_DEPENDENCY(ScopDetection);
-INITIALIZE_PASS_DEPENDENCY(DataLayoutPass);
-INITIALIZE_PASS_END(CodeGeneration, "polly-codegen",
-                    "Polly - Create LLVM-IR from SCoPs", false, false)
-
-#endif // CLOOG_FOUND

Modified: polly/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Makefile?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/lib/Makefile (original)
+++ polly/trunk/lib/Makefile Tue Dec  2 13:26:58 2014
@@ -16,11 +16,6 @@ LD.Flags += $(POLLY_LD) $(POLLY_LIB)
 include $(LEVEL)/Makefile.config
 
 # Enable optional source files
-ifeq ($(CLOOG_FOUND), yes)
-CLOOG_FILES= CodeGen/Cloog.cpp \
-	     CodeGen/CodeGeneration.cpp
-endif
-
 ifeq ($(GPU_CODEGEN), yes)
 GPGPU_CODEGEN_FILES= CodeGen/PTXGenerator.cpp
 endif
@@ -62,7 +57,6 @@ SOURCES= Polly.cpp \
 	 Transform/ScheduleOptimizer.cpp \
 	 ${GPGPU_FILES} \
 	 ${ISL_CODEGEN_FILES} \
-         ${CLOOG_FILES} \
 	 ${POLLY_JSON_FILES} \
 	 ${POLLY_PLUTO_FILES}
 

Modified: polly/trunk/lib/Support/RegisterPasses.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/RegisterPasses.cpp?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/lib/Support/RegisterPasses.cpp (original)
+++ polly/trunk/lib/Support/RegisterPasses.cpp Tue Dec  2 13:26:58 2014
@@ -21,7 +21,6 @@
 
 #include "polly/RegisterPasses.h"
 #include "polly/Canonicalization.h"
-#include "polly/CodeGen/Cloog.h"
 #include "polly/CodeGen/CodeGeneration.h"
 #include "polly/Dependences.h"
 #include "polly/LinkAllPasses.h"
@@ -68,12 +67,9 @@ static cl::opt<OptimizerChoice> Optimize
 CodeGenChoice polly::PollyCodeGenChoice;
 static cl::opt<CodeGenChoice, true> XCodeGenerator(
     "polly-code-generator", cl::desc("Select the code generator"),
-    cl::values(
-#ifdef CLOOG_FOUND
-        clEnumValN(CODEGEN_CLOOG, "cloog", "CLooG"),
-#endif
-        clEnumValN(CODEGEN_ISL, "isl", "isl code generator"),
-        clEnumValN(CODEGEN_NONE, "none", "no code generation"), clEnumValEnd),
+    cl::values(clEnumValN(CODEGEN_ISL, "isl", "isl code generator"),
+               clEnumValN(CODEGEN_NONE, "none", "no code generation"),
+               clEnumValEnd),
     cl::Hidden, cl::location(PollyCodeGenChoice), cl::init(CODEGEN_ISL),
     cl::ZeroOrMore, cl::cat(PollyCategory));
 
@@ -143,10 +139,6 @@ static cl::opt<bool, true> XPollyAnnotat
 
 namespace polly {
 void initializePollyPasses(PassRegistry &Registry) {
-#ifdef CLOOG_FOUND
-  initializeCloogInfoPass(Registry);
-  initializeCodeGenerationPass(Registry);
-#endif
   initializeIslCodeGenerationPass(Registry);
   initializeCodePreparationPass(Registry);
   initializeDeadCodeElimPass(Registry);
@@ -189,9 +181,7 @@ void initializePollyPasses(PassRegistry
 /// provided to analyze the run and compile time changes caused by the
 /// scheduling optimizer.
 ///
-/// Polly supports both CLooG (http://www.cloog.org) as well as the isl internal
-/// code generator. For the moment, the CLooG code generator is enabled by
-/// default.
+/// Polly supports the isl internal code generator.
 static void registerPollyPasses(llvm::PassManagerBase &PM) {
   registerCanonicalicationPasses(PM);
 
@@ -231,16 +221,6 @@ static void registerPollyPasses(llvm::Pa
     PM.add(polly::createJSONExporterPass());
 
   switch (PollyCodeGenChoice) {
-#ifdef CLOOG_FOUND
-  case CODEGEN_CLOOG:
-    PM.add(polly::createCodeGenerationPass());
-    if (PollyVectorizerChoice == VECTORIZER_BB) {
-      VectorizeConfig C;
-      C.FastDep = true;
-      PM.add(createBBVectorizePass(C));
-    }
-    break;
-#endif
   case CODEGEN_ISL:
     PM.add(polly::createIslCodeGenerationPass());
     break;

Modified: polly/trunk/lib/Transform/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndependentBlocks.cpp?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/Transform/IndependentBlocks.cpp Tue Dec  2 13:26:58 2014
@@ -14,7 +14,6 @@
 #include "polly/LinkAllPasses.h"
 #include "polly/Options.h"
 #include "polly/CodeGen/BlockGenerators.h"
-#include "polly/CodeGen/Cloog.h"
 #include "polly/ScopDetection.h"
 #include "polly/Support/ScopHelper.h"
 #include "llvm/Analysis/DominanceFrontier.h"
@@ -505,9 +504,6 @@ void IndependentBlocks::getAnalysisUsage
   AU.addPreserved<ScalarEvolution>();
   AU.addRequired<ScopDetection>();
   AU.addPreserved<ScopDetection>();
-#ifdef CLOOG_FOUND
-  AU.addPreserved<CloogInfo>();
-#endif
 }
 
 bool IndependentBlocks::runOnFunction(llvm::Function &F) {

Modified: polly/trunk/test/Isl/CodeGen/openmp_limit_threads.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/openmp_limit_threads.ll?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/openmp_limit_threads.ll (original)
+++ polly/trunk/test/Isl/CodeGen/openmp_limit_threads.ll Tue Dec  2 13:26:58 2014
@@ -1,6 +1,6 @@
-; RUN: opt %loadPolly -polly-codegen -enable-polly-openmp -S < %s | FileCheck %s --check-prefix=AUTO
-; RUN: opt %loadPolly -polly-codegen -enable-polly-openmp -polly-num-threads=1 -S < %s | FileCheck %s --check-prefix=ONE
-; RUN: opt %loadPolly -polly-codegen -enable-polly-openmp -polly-num-threads=4 -S < %s | FileCheck %s --check-prefix=FOUR
+; RUN: opt %loadPolly -polly-codegen-isl -polly-parallel -S < %s | FileCheck %s --check-prefix=AUTO
+; RUN: opt %loadPolly -polly-codegen-isl -polly-parallel -polly-num-threads=1 -S < %s | FileCheck %s --check-prefix=ONE
+; RUN: opt %loadPolly -polly-codegen-isl -polly-parallel -polly-num-threads=4 -S < %s | FileCheck %s --check-prefix=FOUR
 ;
 ; AUTO: call void @GOMP_parallel_loop_runtime_start(void (i8*)* @jd.polly.subfn, i8* %polly.par.userContext{{[0-9]*}}, i32 0, i64 0, i64 1024, i64 1)
 ; ONE: call void @GOMP_parallel_loop_runtime_start(void (i8*)* @jd.polly.subfn, i8* %polly.par.userContext{{[0-9]*}}, i32 1, i64 0, i64 1024, i64 1)
@@ -8,7 +8,8 @@
 ;
 ;    void jd(int *A) {
 ;      for (int i = 0; i < 1024; i++)
-;        A[i] = 0;
+;        for (int j = 0; j < 1024; j++)
+;          A[i + j * 1024] = 0;
 ;    }
 ;
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@@ -17,20 +18,37 @@ define void @jd(i32* %A) {
 entry:
   br label %for.cond
 
-for.cond:                                         ; preds = %for.inc, %entry
-  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
-  %exitcond = icmp ne i64 %indvars.iv, 1024
-  br i1 %exitcond, label %for.body, label %for.end
+for.cond:                                         ; preds = %for.inc4, %entry
+  %indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc4 ], [ 0, %entry ]
+  %exitcond5 = icmp ne i64 %indvars.iv3, 1024
+  br i1 %exitcond5, label %for.body, label %for.end6
 
 for.body:                                         ; preds = %for.cond
-  %arrayidx = getelementptr inbounds i32* %A, i64 %indvars.iv
+  br label %for.cond1
+
+for.cond1:                                        ; preds = %for.inc, %for.body
+  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ]
+  %exitcond = icmp ne i64 %indvars.iv, 1024
+  br i1 %exitcond, label %for.body3, label %for.end
+
+for.body3:                                        ; preds = %for.cond1
+  %tmp = shl nsw i64 %indvars.iv, 10
+  %tmp6 = add nsw i64 %indvars.iv3, %tmp
+  %arrayidx = getelementptr inbounds i32* %A, i64 %tmp6
   store i32 0, i32* %arrayidx, align 4
   br label %for.inc
 
-for.inc:                                          ; preds = %for.body
+for.inc:                                          ; preds = %for.body3
   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  br label %for.cond1
+
+for.end:                                          ; preds = %for.cond1
+  br label %for.inc4
+
+for.inc4:                                         ; preds = %for.end
+  %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
   br label %for.cond
 
-for.end:                                          ; preds = %for.cond
+for.end6:                                         ; preds = %for.cond
   ret void
 }

Modified: polly/trunk/test/Isl/CodeGen/single_do_loop_int_param_iterations.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/single_do_loop_int_param_iterations.ll?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/single_do_loop_int_param_iterations.ll (original)
+++ polly/trunk/test/Isl/CodeGen/single_do_loop_int_param_iterations.ll Tue Dec  2 13:26:58 2014
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-cloog-scop -S -analyze  < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-ast -S -analyze  < %s | FileCheck %s
 ; XFAIL: *
 
 ;define N 20

Modified: polly/trunk/test/Isl/CodeGen/single_do_loop_one_iteration.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/single_do_loop_one_iteration.ll?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/single_do_loop_one_iteration.ll (original)
+++ polly/trunk/test/Isl/CodeGen/single_do_loop_one_iteration.ll Tue Dec  2 13:26:58 2014
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-cloog-scop -S -analyze  < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-ast -S -analyze  < %s | FileCheck %s
 ; XFAIL: *
 
 ;#define N 20

Modified: polly/trunk/test/Isl/CodeGen/test.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/test.ll?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Isl/CodeGen/test.ll (original)
+++ polly/trunk/test/Isl/CodeGen/test.ll Tue Dec  2 13:26:58 2014
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-cloog -analyze  -S < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-ast -analyze  -S < %s | FileCheck %s
 ; XFAIL: *
 
 ;int bar1();

Modified: polly/trunk/test/Isl/single_loop_uint_max_iterations.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/single_loop_uint_max_iterations.ll?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Isl/single_loop_uint_max_iterations.ll (original)
+++ polly/trunk/test/Isl/single_loop_uint_max_iterations.ll Tue Dec  2 13:26:58 2014
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-cloog-scop -S -analyze  < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-ast -S -analyze  < %s | FileCheck %s
 ; XFAIL: *
 
 ;#include "limits.h"

Modified: polly/trunk/test/Isl/single_loop_ull_max_iterations.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/single_loop_ull_max_iterations.ll?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Isl/single_loop_ull_max_iterations.ll (original)
+++ polly/trunk/test/Isl/single_loop_ull_max_iterations.ll Tue Dec  2 13:26:58 2014
@@ -1,4 +1,4 @@
-; RUN: opt %loadPolly -polly-cloog-scop -S -analyze  < %s | FileCheck %s
+; RUN: opt %loadPolly -polly-ast -S -analyze  < %s | FileCheck %s
 ; XFAIL: *
 
 ;#include "limits.h"

Modified: polly/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Makefile?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/Makefile (original)
+++ polly/trunk/test/Makefile Tue Dec  2 13:26:58 2014
@@ -54,7 +54,6 @@ lit.site.cfg: FORCE
 	     -e "s#@LLVM_SHLIBEXT@#$(SHLIBEXT)#g" \
              -e "s#@POLLY_LIB_DIR@#$(LibDir)#g" \
              -e "s#@LINK_POLLY_INTO_TOOLS@#OFF#g" \
-             -e "s#@CLOOG_FOUND@#$(CLOOG_FOUND)#g" \
              -e "s#@CUDALIB_FOUND@#$(CUDALIB_FOUND)#g" \
 	     $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
 

Modified: polly/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/lit.site.cfg.in?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/test/lit.site.cfg.in (original)
+++ polly/trunk/test/lit.site.cfg.in Tue Dec  2 13:26:58 2014
@@ -8,7 +8,6 @@ config.polly_obj_root = "@POLLY_BINARY_D
 config.polly_lib_dir = "@POLLY_LIB_DIR@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.enable_gpgpu_codegen = "@CUDALIB_FOUND@"
-config.cloog_found = "@CLOOG_FOUND@"
 config.link_polly_into_tools = "@LINK_POLLY_INTO_TOOLS@"
 
 ## Check the current platform with regex

Added: polly/trunk/utils/checkout_cloog.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/checkout_cloog.sh?rev=223141&view=auto
==============================================================================
--- polly/trunk/utils/checkout_cloog.sh (added)
+++ polly/trunk/utils/checkout_cloog.sh Tue Dec  2 13:26:58 2014
@@ -0,0 +1 @@
+link checkout_isl.sh
\ No newline at end of file

Propchange: polly/trunk/utils/checkout_cloog.sh
------------------------------------------------------------------------------
    svn:special = *

Added: polly/trunk/utils/checkout_isl.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/utils/checkout_isl.sh?rev=223141&view=auto
==============================================================================
--- polly/trunk/utils/checkout_isl.sh (added)
+++ polly/trunk/utils/checkout_isl.sh Tue Dec  2 13:26:58 2014
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+ISL_HASH="2c19ecd444095d6f560349018f68993bc0e03691"
+
+PWD=`pwd`
+
+check_command_line() {
+  if [ $# -eq 1 ]
+  then
+    ISL_DIR="${1}"
+  else
+      echo "Usage: " ${0} '<Directory to checkout isl>'
+      exit 1
+  fi
+}
+
+check_isl_directory() {
+  if ! [ -e ${ISL_DIR} ]
+  then
+    echo :: Directory "'${ISL_DIR}'" does not exists. Trying to create it.
+    if ! mkdir -p "${ISL_DIR}"
+    then exit 1
+    fi
+  fi
+
+  if ! [ -d ${ISL_DIR} ]
+  then
+    echo "'${ISL_DIR}'" is not a directory
+    exit 1
+  fi
+
+  # Make it absolute
+  cd ${ISL_DIR}
+  ISL_DIR=`pwd`
+
+  if ! [ -e "${ISL_DIR}/.git" ]
+  then
+    echo ":: No git checkout found"
+    IS_GIT=0
+  else
+    echo ":: Existing git repo found"
+    IS_GIT=1
+  fi
+}
+
+complain() {
+  echo "$@"
+  exit 1
+}
+
+run() {
+  $cmdPre $*
+  if [ $? != 0 ]
+    then
+    complain $* failed
+  fi
+}
+
+check_command_line $@
+check_isl_directory
+
+if [ ${IS_GIT} -eq 0 ]
+then
+  echo :: Performing initial checkout
+  # Remove the existing CLooG and ISL dirs to avoid crashing older git versions.
+  cd ${ISL_DIR}/..
+  run rmdir "${ISL_DIR}"
+  run git clone http://repo.or.cz/r/isl.git ${ISL_DIR}
+fi
+
+echo :: Fetch version required by Polly
+run cd ${ISL_DIR}
+run git remote update
+
+echo :: Setting isl version
+run cd ${ISL_DIR}
+run git reset --hard "${ISL_HASH}"
+
+echo :: Generating configure
+run cd ${ISL_DIR}
+run ./autogen.sh
+
+echo :: If you install isl the first time run "'./configure'" followed by
+echo :: "'make'" and "'make install'", otherwise, just call "'make'" and
+echo :: "'make'" install.

Modified: polly/trunk/www/documentation/gpgpucodegen.html
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/documentation/gpgpucodegen.html?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/www/documentation/gpgpucodegen.html (original)
+++ polly/trunk/www/documentation/gpgpucodegen.html Tue Dec  2 13:26:58 2014
@@ -122,7 +122,7 @@ The jscop file describing the tiling tra
 We can test the schedule with the following command line.
 <pre>
 opt -load /path/to/polly/build/LLVMPolly.so -basicaa -polly-import-jscop
-    -polly-cloog -analyze -q ./test.ll
+    -polly-ast -analyze -q ./test.ll
     -polly-import-jscop-postfix=transformed+gpu
 </pre>
 The output of this schedule is:

Modified: polly/trunk/www/documentation/passes.html
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/documentation/passes.html?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/www/documentation/passes.html (original)
+++ polly/trunk/www/documentation/passes.html Tue Dec  2 13:26:58 2014
@@ -33,8 +33,6 @@
 <li><em>polly-opt-isl</em> Optimize the SCoP using isl</li>
 <li>Import/Export
 <ul>
-<li><em>polly-export-cloog</em> Export the CLooG input file
-(Writes a .cloog file for each SCoP)</li>
 <li><em>polly-export-scoplib</em> Export SCoPs with ScopLib library
 (Writes a .scoplib file for each SCoP) [removed after <a href="http://llvm.org/releases/download.html#3.4.2">LLVM 3.4.2</a>]</li>
 <li><em>polly-import-scoplib</em> Import SCoPs with ScopLib library
@@ -55,7 +53,7 @@
 </ul>
 <h2>Back End</h2>
 <ul>
-<li><em>polly-cloog</em> Execute CLooG code generation</li>
+<li><em>polly-ast</em> Execute isl code generation</li>
 <li><em>polly-codegen</em> Create LLVM-IR from the polyhedral information</li>
 </ul>
 

Modified: polly/trunk/www/example_manual_matmul.html
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/example_manual_matmul.html?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/www/example_manual_matmul.html (original)
+++ polly/trunk/www/example_manual_matmul.html Tue Dec  2 13:26:58 2014
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
           "http://www.w3.org/TR/html4/strict.dtd">
 <!-- Material used from: HTML 4.01 specs: http://www.w3.org/TR/html401/ -->
 <html>
@@ -64,7 +64,7 @@ To understand if Polly was able to detec
 structure of the detected SCoPs. In our example two SCoPs were detected. One in
 'init_array' the other in 'main'.
 
-<pre class="code">opt -basicaa -polly-cloog -analyze -q matmul.preopt.ll</pre>
+<pre class="code">opt -basicaa -polly-ast -analyze -q matmul.preopt.ll</pre>
 
 <pre>
 init_array():
@@ -118,18 +118,18 @@ Printing analysis 'Polly - Create polyhe
                { Stmt_5[i0, i1] : i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 };
            Scattering :=
                { Stmt_5[i0, i1] -> scattering[0, i0, 0, i1, 0] };
-           WriteAccess := 
+           WriteAccess :=
                { Stmt_5[i0, i1] -> MemRef_A[1037i0 + i1] };
-           WriteAccess := 
+           WriteAccess :=
                { Stmt_5[i0, i1] -> MemRef_B[1047i0 + i1] };
    	FinalRead
            Domain :=
                { FinalRead[0] };
            Scattering :=
                { FinalRead[i0] -> scattering[200000000, o1, o2, o3, o4] };
-           ReadAccess := 
+           ReadAccess :=
                { FinalRead[i0] -> MemRef_A[o0] };
-           ReadAccess := 
+           ReadAccess :=
                { FinalRead[i0] -> MemRef_B[o0] };
    }
 [...]
@@ -143,31 +143,31 @@ Printing analysis 'Polly - Create polyhe
                { Stmt_4[i0, i1] : i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 };
            Scattering :=
                { Stmt_4[i0, i1] -> scattering[0, i0, 0, i1, 0, 0, 0] };
-           WriteAccess := 
+           WriteAccess :=
                { Stmt_4[i0, i1] -> MemRef_C[1067i0 + i1] };
    	Stmt_6
            Domain :=
                { Stmt_6[i0, i1, i2] : i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1023 };
            Scattering :=
                { Stmt_6[i0, i1, i2] -> scattering[0, i0, 0, i1, 1, i2, 0] };
-           ReadAccess := 
+           ReadAccess :=
                { Stmt_6[i0, i1, i2] -> MemRef_C[1067i0 + i1] };
-           ReadAccess := 
+           ReadAccess :=
                { Stmt_6[i0, i1, i2] -> MemRef_A[1037i0 + i2] };
-           ReadAccess := 
+           ReadAccess :=
                { Stmt_6[i0, i1, i2] -> MemRef_B[i1 + 1047i2] };
-           WriteAccess := 
+           WriteAccess :=
                { Stmt_6[i0, i1, i2] -> MemRef_C[1067i0 + i1] };
    	FinalRead
            Domain :=
                { FinalRead[0] };
            Scattering :=
                { FinalRead[i0] -> scattering[200000000, o1, o2, o3, o4, o5, o6] };
-           ReadAccess := 
+           ReadAccess :=
                { FinalRead[i0] -> MemRef_C[o0] };
-           ReadAccess := 
+           ReadAccess :=
                { FinalRead[i0] -> MemRef_A[o0] };
-           ReadAccess := 
+           ReadAccess :=
                { FinalRead[i0] -> MemRef_B[o0] };
    }
 [...]
@@ -192,19 +192,19 @@ Printing analysis 'Polly - Calculate dep
        {  Stmt_4[i0, i1] -> Stmt_6[i0, i1, 0] :
               i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023;
           Stmt_6[i0, i1, i2] -> Stmt_6[i0, i1, 1 + i2] :
-              i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1022; 
+              i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1022;
           Stmt_6[i0, i1, 1023] -> FinalRead[0] :
               i1 <= 1091540 - 1067i0 and i1 >= -1067i0 and i1 >= 0 and i1 <= 1023;
           Stmt_6[1023, i1, 1023] -> FinalRead[0] :
-              i1 >= 0 and i1 <= 1023 
+              i1 >= 0 and i1 <= 1023
        }
    May dependences:
        {  }
    Must no source:
        {  Stmt_6[i0, i1, i2] -> MemRef_A[1037i0 + i2] :
-              i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1023; 
+              i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1023;
           Stmt_6[i0, i1, i2] -> MemRef_B[i1 + 1047i2] :
-              i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1023; 
+              i0 >= 0 and i0 <= 1023 and i1 >= 0 and i1 <= 1023 and i2 >= 0 and i2 <= 1023;
           FinalRead[0] -> MemRef_A[o0];
           FinalRead[0] -> MemRef_B[o0]
           FinalRead[0] -> MemRef_C[o0] :
@@ -242,7 +242,7 @@ normal -O3 optimizations.</p>
 <pre class="code">
 opt matmul.preopt.ll -basicaa \
     -polly-import-jscop \
-    -polly-cloog -analyze
+    -polly-ast -analyze
 </pre>
 <pre>
 [...]
@@ -263,7 +263,7 @@ enumerate Stmt_6.</p>
 <pre class="code">
 opt matmul.preopt.ll -basicaa \
     -polly-import-jscop -polly-import-jscop-postfix=interchanged \
-    -polly-cloog -analyze
+    -polly-ast -analyze
 </pre>
 <pre>
 [...]
@@ -290,7 +290,7 @@ for (c2=0;c2<=1535;c2++) {
 <pre class="code">
 opt matmul.preopt.ll -basicaa \
     -polly-import-jscop -polly-import-jscop-postfix=interchanged+tiled \
-    -polly-cloog -analyze
+    -polly-ast -analyze
 </pre>
 <pre>
 [...]
@@ -324,7 +324,7 @@ replaced by 4-element SIMD instructions.
 <pre class="code">
 opt matmul.preopt.ll -basicaa \
     -polly-import-jscop -polly-import-jscop-postfix=interchanged+tiled+vector \
-    -polly-cloog -analyze </pre>
+    -polly-ast -analyze </pre>
 
 <pre>
 [...]

Modified: polly/trunk/www/experiments/matmul/runall.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/experiments/matmul/runall.sh?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/www/experiments/matmul/runall.sh (original)
+++ polly/trunk/www/experiments/matmul/runall.sh Tue Dec  2 13:26:58 2014
@@ -11,7 +11,7 @@ echo "--> 3. Prepare the LLVM-IR for Pol
 opt -S -polly-canonicalize matmul.s > matmul.preopt.ll
 
 echo "--> 4. Show the SCoPs detected by Polly"
-opt -basicaa -polly-cloog -analyze -q matmul.preopt.ll
+opt -basicaa -polly-ast -analyze -q matmul.preopt.ll
 
 echo "--> 5.1 Highlight the detected SCoPs in the CFGs of the program"
 # We only create .dot files, as directly -view-scops directly calls graphviz
@@ -39,12 +39,12 @@ echo "--> 8. Export jscop files"
 opt -basicaa -polly-export-jscop matmul.preopt.ll
 
 echo "--> 9. Import the updated jscop files and print the new SCoPs. (optional)"
-opt -basicaa -polly-import-jscop -polly-cloog -analyze matmul.preopt.ll
-opt -basicaa -polly-import-jscop -polly-cloog -analyze matmul.preopt.ll \
+opt -basicaa -polly-import-jscop -polly-ast -analyze matmul.preopt.ll
+opt -basicaa -polly-import-jscop -polly-ast -analyze matmul.preopt.ll \
     -polly-import-jscop-postfix=interchanged
-opt -basicaa -polly-import-jscop -polly-cloog -analyze matmul.preopt.ll \
+opt -basicaa -polly-import-jscop -polly-ast -analyze matmul.preopt.ll \
     -polly-import-jscop-postfix=interchanged+tiled
-opt -basicaa -polly-import-jscop -polly-cloog -analyze matmul.preopt.ll \
+opt -basicaa -polly-import-jscop -polly-ast -analyze matmul.preopt.ll \
     -polly-import-jscop-postfix=interchanged+tiled+vector
 
 echo "--> 10. Codegenerate the SCoPs"

Modified: polly/trunk/www/get_started.html
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/get_started.html?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/www/get_started.html (original)
+++ polly/trunk/www/get_started.html Tue Dec  2 13:26:58 2014
@@ -67,30 +67,29 @@ git clone http://llvm.org/git/clang.git
 <h3 id="prerequisites"> Prerequisites </h3>
 <ul>
 <li>libgmp</li>
-<li>CLooG/isl</li>
+<li>isl</li>
 </ul>
 
 <h4> libgmp </h4>
 Install libgmp (library + developer package) through the package management
 system of your operating system.
 
-<h4> CLooG/isl</h4>
+<h4> isl</h4>
 
-Polly is tested with a fixed version of <a href="http://www.cloog.org">CLooG</a>
-and isl. To obtain the source code of CLooG (including isl) use
-checkout_cloog.sh as available in ${POLLY_SRC}/utils/checkout_cloog.sh.
+Polly is tested with a fixed version of isl. To obtain the source code of isl
+use checkout_isl.sh as available in ${POLLY_SRC}/utils/checkout_isl.sh.
 
 <h4>Set the directory layout:</h4>
 <pre>
-export CLOOG_SRC=${BASE}/cloog_src
-export CLOOG_INSTALL=${BASE}/cloog_install
+export ISL_SRC=${BASE}/isl_src
+export ISL_INSTALL=${BASE}/isl_install
 </pre>
 
 <h4> First installation</h4>
 <pre>
-${POLLY_SRC}/utils/checkout_cloog.sh ${CLOOG_SRC}
-cd ${CLOOG_SRC}
-./configure --prefix=${CLOOG_INSTALL}
+${POLLY_SRC}/utils/checkout_isl.sh ${ISL_SRC}
+cd ${ISL_SRC}
+./configure --prefix=${ISL_INSTALL}
 make
 make install
 cd ${BASE}
@@ -98,11 +97,11 @@ cd ${BASE}
 
 <h4> Update the installation</h4>
 
-Updating CLooG may become necessary, if Polly uses a feature
-only available in a recent version of CLooG.
+Updating isl may become necessary, if Polly uses a feature
+only available in a recent version of isl.
 <pre>
-${POLLY_SRC}/utils/checkout_cloog.sh ${CLOOG_SRC}
-cd ${CLOOG_SRC}
+${POLLY_SRC}/utils/checkout_isl.sh ${ISL_SRC}
+cd ${ISL_SRC}
 make
 make install
 cd ${BASE}
@@ -124,14 +123,14 @@ cd ${LLVM_BUILD}
 <h4>CMake</h4>
 
 <pre>
-cmake -DCMAKE_PREFIX_PATH=${CLOOG_INSTALL} ${LLVM_SRC}
+cmake -DCMAKE_PREFIX_PATH=${ISL_INSTALL} ${LLVM_SRC}
 make
 </pre>
 
 <h4> Autoconf </h4>
 
 <pre>
-${LLVM_SRC}/configure --with-cloog=${CLOOG_INSTALL} --with-isl=${CLOOG_INSTALL}
+${LLVM_SRC}/configure --with-isl=${ISL_INSTALL}
 make
 </pre>
 
@@ -142,11 +141,11 @@ cmake build or <em>make check-polly -C t
 build.
 
 <p>If you get something like <em>"... libisl.so.9: cannot open shared object file .."</em>,
-it is because you installed cloog to a non-standard path, and libisl/libcloog
+it is because you installed isl to a non-standard path, and libisl
 could not be found. To solve this issue, you need to append the path of parent
-directory of libisl/libcloog, i.e. ${CLOOG_INSTALL}/lib, to LD_LIBRARY_PATH by:
+directory of libisl, i.e. ${ISL_INSTALL}/lib, to LD_LIBRARY_PATH by:
 
-<pre>export LD_LIBRARY_PATH=${CLOOG_INSTALL}/lib:$LD_LIBRARY_PATH</pre>
+<pre>export LD_LIBRARY_PATH=${ISL_INSTALL}/lib:$LD_LIBRARY_PATH</pre>
 
 <p>Also try the above command if you get errors such as:
 <code>undefined symbol: isl_ctx_get_max_operations</code>
@@ -157,7 +156,7 @@ To solve this issue, run <code>cmake</co
 <code>-DPYTHON_EXECUTABLE=/usr/bin/python2</code> (replace <code>/usr/bin/python2</code>
 with the location of the python2 interpreter under your system).
 
-<pre>cmake -DCMAKE_PREFIX_PATH=${CLOOG_INSTALL} -DPYTHON_EXECUTABLE=/usr/bin/python2 ${LLVM_SRC}</pre>
+<pre>cmake -DCMAKE_PREFIX_PATH=${ISL_INSTALL} -DPYTHON_EXECUTABLE=/usr/bin/python2 ${LLVM_SRC}</pre>
 
 <h2> Optional Features </h2>
 

Modified: polly/trunk/www/polly.sh
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/www/polly.sh?rev=223141&r1=223140&r2=223141&view=diff
==============================================================================
--- polly/trunk/www/polly.sh (original)
+++ polly/trunk/www/polly.sh Tue Dec  2 13:26:58 2014
@@ -4,8 +4,8 @@ export BASE=`pwd`
 export LLVM_SRC=${BASE}/llvm
 export POLLY_SRC=${LLVM_SRC}/tools/polly
 export CLANG_SRC=${LLVM_SRC}/tools/clang
-export CLOOG_SRC=${BASE}/cloog_src
-export CLOOG_INSTALL=${BASE}/cloog_install
+export ISL_SRC=${BASE}/isl_src
+export ISL_INSTALL=${BASE}/isl_install
 export LLVM_BUILD=${BASE}/llvm_build
 
 if [ -e /proc/cpuinfo ]; then
@@ -26,11 +26,11 @@ if ! test -d ${CLANG_SRC}; then
     git clone http://llvm.org/git/clang.git ${CLANG_SRC}
 fi
 
-${POLLY_SRC}/utils/checkout_cloog.sh ${CLOOG_SRC}
-cd ${CLOOG_SRC}
+${POLLY_SRC}/utils/checkout_isl.sh ${ISL_SRC}
+cd ${ISL_SRC}
 
-if ! test -e ${CLOOG_SRC}/config.log; then
-    ./configure --prefix=${CLOOG_INSTALL}
+if ! test -e ${ISL_SRC}/config.log; then
+    ./configure --prefix=${ISL_INSTALL}
 fi
 make
 make install
@@ -40,11 +40,11 @@ mkdir -p ${LLVM_BUILD}
 cd ${LLVM_BUILD}
 
 if which cmake ; then
-    cmake -DCMAKE_PREFIX_PATH=${CLOOG_INSTALL} ${LLVM_SRC}
+    cmake -DCMAKE_PREFIX_PATH=${ISL_INSTALL} ${LLVM_SRC}
     make -j$procs -l$procs
     make check-polly
 else
-    ${LLVM_SRC}/configure --with-cloog=${CLOOG_INSTALL} --with-isl=${CLOOG_INSTALL}
+    ${LLVM_SRC}/configure --with-isl=${ISL_INSTALL}
     make -j$procs -l$procs
     make check-polly -C tools/polly/test/
 fi





More information about the llvm-commits mailing list