[polly] r201925 - GMP is only required for CLooG

Sebastian Pop spop at codeaurora.org
Fri Feb 21 18:15:39 PST 2014


Author: spop
Date: Fri Feb 21 20:15:39 2014
New Revision: 201925

URL: http://llvm.org/viewvc/llvm-project?rev=201925&view=rev
Log:
GMP is only required for CLooG

Modified:
    polly/trunk/CMakeLists.txt
    polly/trunk/autoconf/configure.ac
    polly/trunk/cmake/polly_macros.cmake
    polly/trunk/configure
    polly/trunk/include/polly/Support/GICHelper.h
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/lib/Support/GICHelper.cpp

Modified: polly/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/CMakeLists.txt?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/CMakeLists.txt (original)
+++ polly/trunk/CMakeLists.txt Fri Feb 21 20:15:39 2014
@@ -80,13 +80,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${POLLY_SOURCE_DIR}/cmake")
 
 FIND_PACKAGE(Isl REQUIRED)
-FIND_PACKAGE(Gmp REQUIRED)
 FIND_PACKAGE(Pluto)
 
 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)
 endif(POLLY_USE_CLOOG)
 
 option(POLLY_ENABLE_GPGPU_CODEGEN "Enable GPGPU code generation feature" OFF)
@@ -114,7 +114,9 @@ if (PLUTO_FOUND)
   INCLUDE_DIRECTORIES( ${PLUTO_INCLUDE_DIR} )
 endif(PLUTO_FOUND)
 INCLUDE_DIRECTORIES( ${ISL_INCLUDE_DIR} )
-INCLUDE_DIRECTORIES( ${GMP_INCLUDE_DIR} )
+if (GMP_FOUND)
+  INCLUDE_DIRECTORIES( ${GMP_INCLUDE_DIR} )
+endif(GMP_FOUND)
 
 # Support GPGPU code generation if the library is available.
 if (CUDALIB_FOUND)

Modified: polly/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/autoconf/configure.ac?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/autoconf/configure.ac (original)
+++ polly/trunk/autoconf/configure.ac Fri Feb 21 20:15:39 2014
@@ -75,11 +75,11 @@ dnl ************************************
 dnl * Set the location of various third-party software packages
 dnl **************************************************************************
 dnl Find Gmp
-find_lib_and_headers([gmp], [gmp.h], [gmp], [required])
+find_lib_and_headers([gmp], [gmp.h], [gmp])
 
 dnl Find Isl
 saved_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="$CXXFLAGS $gmp_inc"
+CXXFLAGS="$CXXFLAGS"
 find_lib_and_headers([isl], [isl/val.h], [isl], [required])
 CXXFLAGS=$saved_CXXFLAGS
 

Modified: polly/trunk/cmake/polly_macros.cmake
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/cmake/polly_macros.cmake?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/cmake/polly_macros.cmake (original)
+++ polly/trunk/cmake/polly_macros.cmake Fri Feb 21 20:15:39 2014
@@ -27,10 +27,10 @@ macro(add_polly_library name)
     endforeach(lib)
   endif( LLVM_USED_LIBS )
 
-  target_link_libraries( ${name} ${ISL_LIBRARY} ${GMP_LIBRARY})
+  target_link_libraries( ${name} ${ISL_LIBRARY})
 
   if (CLOOG_FOUND)
-    target_link_libraries( ${name} ${CLOOG_LIBRARY})
+    target_link_libraries( ${name} ${CLOOG_LIBRARY} ${GMP_LIBRARY})
   endif(CLOOG_FOUND)
 
   if (OPENSCOP_FOUND)

Modified: polly/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/configure?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/configure (original)
+++ polly/trunk/configure Fri Feb 21 20:15:39 2014
@@ -2453,7 +2453,7 @@ fi
 
 fi
 else
-  if test "xrequired" = "xrequired"; then :
+  if test "x" = "xrequired"; then :
   as_fn_error "gmp required but not found" "$LINENO" 5
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
@@ -2477,7 +2477,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 saved_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="$CXXFLAGS $gmp_inc"
+CXXFLAGS="$CXXFLAGS"
 
   ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
@@ -2504,8 +2504,8 @@ else
 fi
 
   # Check for library and headers works
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl: isl/val.in $given_inc_path, and libisl in $given_lib_path" >&5
-$as_echo_n "checking for isl: isl/val.in $given_inc_path, and libisl in $given_lib_path... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for isl: isl/val.h in $given_inc_path, and libisl in $given_lib_path" >&5
+$as_echo_n "checking for isl: isl/val.h in $given_inc_path, and libisl in $given_lib_path... " >&6; }
 
   # try to compile a file that includes a header of the library
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext

Modified: polly/trunk/include/polly/Support/GICHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/GICHelper.h?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/GICHelper.h (original)
+++ polly/trunk/include/polly/Support/GICHelper.h Fri Feb 21 20:15:39 2014
@@ -1,4 +1,4 @@
-//===- Support/GICHelper.h -- Helper functions for GMP, ISL, and Cloog -----===/
+//===- Support/GICHelper.h -- Helper functions for ISL --------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// Helper functions for gmp, isl and Cloog objects.
+// Helper functions for isl objects.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -15,10 +15,7 @@
 #define POLLY_SUPPORT_GIC_HELPER_H
 
 #include "llvm/ADT/APInt.h"
-#include <gmp.h>
-
 #include "isl/ctx.h"
-
 #include "llvm/Support/raw_ostream.h"
 
 struct isl_map;
@@ -33,18 +30,6 @@ struct isl_pw_aff;
 struct isl_val;
 
 namespace polly {
-
-/// @brief Convert APInt to mpz.
-///
-/// @param v      The mpz_t object your want to hold the result.
-/// @param apint  The APInt you want to convert.
-void MPZ_from_APInt(mpz_t v, const llvm::APInt apint, bool is_signed = true);
-
-/// @brief Convert mpz to APInt.
-///
-/// @param mpz    The mpz_t you want to convert.
-llvm::APInt APInt_from_MPZ(const mpz_t mpz);
-
 __isl_give isl_val *isl_valFromAPInt(isl_ctx *Ctx, const llvm::APInt Int,
                                      bool IsSigned);
 llvm::APInt APIntFromVal(__isl_take isl_val *Val);

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Fri Feb 21 20:15:39 2014
@@ -115,6 +115,27 @@ Value *ClastExpCodeGen::codegen(const cl
   return Builder.CreateSExtOrBitCast(I->second, Ty);
 }
 
+static APInt APInt_from_MPZ(const mpz_t mpz) {
+  uint64_t *p = NULL;
+  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);
 

Modified: polly/trunk/lib/Support/GICHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/GICHelper.cpp?rev=201925&r1=201924&r2=201925&view=diff
==============================================================================
--- polly/trunk/lib/Support/GICHelper.cpp (original)
+++ polly/trunk/lib/Support/GICHelper.cpp Fri Feb 21 20:15:39 2014
@@ -21,25 +21,6 @@
 
 using namespace llvm;
 
-void polly::MPZ_from_APInt(mpz_t v, const APInt apint, bool is_signed) {
-  // There is no sign taken from the data, rop will simply be a positive
-  // integer. An application can handle any sign itself, and apply it for
-  // instance with mpz_neg.
-  APInt abs;
-  if (is_signed)
-    abs = apint.abs();
-  else
-    abs = apint;
-
-  const uint64_t *rawdata = abs.getRawData();
-  unsigned numWords = abs.getNumWords();
-
-  mpz_import(v, numWords, -1, sizeof(uint64_t), 0, 0, rawdata);
-
-  if (is_signed && apint.isNegative())
-    mpz_neg(v, v);
-}
-
 __isl_give isl_val *polly::isl_valFromAPInt(isl_ctx *Ctx, const APInt Int,
                                             bool IsSigned) {
   APInt Abs;
@@ -61,27 +42,6 @@ __isl_give isl_val *polly::isl_valFromAP
   return v;
 }
 
-APInt polly::APInt_from_MPZ(const mpz_t mpz) {
-  uint64_t *p = NULL;
-  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);
-  }
-}
-
 APInt polly::APIntFromVal(__isl_take isl_val *Val) {
   uint64_t *Data;
   int NumChunks;





More information about the llvm-commits mailing list