This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support official CLooG.org versions.


On 11/12/2010 12:06 PM, Paolo Bonzini wrote:
On 11/12/2010 05:14 PM, Tobias Grosser wrote:
CLooG isl will in some cases generate different code. This is why we
currently have support for both CLooG versions. Our first tests did not
show any new SPEC suite failures, but we still want to run more tests
with different optimization flags and on even more platforms. We push
that patch upstream, such that people like Jack can test CLooG with
CLooG-isl on their platform. (Even if it was not intended they hit such
a simple configure bug)

Yes, the bug that Jack found is not a major problem.


The main problem is the different generated code; in particular, it's
not about failures, _any_ assembly code difference resulting from the
same configure options is problematic. Can you make a patch to ensure
that only one backend is sought for, depending on the user's choice
between --enable-cloog-backend=ppl and --enable-cloog-backend=isl (you
choose the default)?

To some extent, this is unavoidable when we are delegating optimization
choices to an external library, but we should minimize the differences.
It is probably necessary to have the version of cloog (and its
dependencies whenever applicable) printed as part of the output of "gcc
--version".

Still, the patch is okay. :)

Thanks Paolo,


I committed this patch and propose two more.

* Use a CLooG header macro to check for the PPL Legacy backend

Without that patch the PPL Legacy backend may be detected, even if only includes of CLooG ORG are in the path, but the cloog-ppl library is still in the system library directory.

* Addition of --enable-cloog-backend

Implemented as you suggested. Now by default we use
--enable-cloog-backend=ppl-legacy
All other CLooG backends will fail configure. To use another backend this has to be defined explicitly by setting --enable-cloog-backend=isl or --enable-cloog-backend=ppl


Could you have a look?

Thanks for your help
Tobi
>From 1d5413fd2ee94d8030bb3e2388c808a7b0dcbfa3 Mon Sep 17 00:00:00 2001
From: Tobias Grosser <grosser@fim.uni-passau.de>
Date: Fri, 12 Nov 2010 13:16:56 -0500
Subject: [PATCH 1/3] * config/cloog.m4: Use CLooG predefined macro to check for CLooG PPL. * configure: regenerate

---
 config/cloog.m4 |   13 +++++++------
 configure       |   15 ++++++++-------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/config/cloog.m4 b/config/cloog.m4
index a44aac4..6ed0f1b 100644
--- a/config/cloog.m4
+++ b/config/cloog.m4
@@ -91,15 +91,17 @@ AC_DEFUN([CLOOG_REQUESTED],
 # ------------------
 # Helper for detecting CLooG.org's backend.
 m4_define([_CLOOG_ORG_PROG],[AC_LANG_PROGRAM(
-  [#include <cloog/cloog.h>],
+  [#include "cloog/cloog.h"],
   [cloog_version ()])])
 
 # _CLOOG_PPL_LEGACY_PROG ()
 # -------------------------
 # Helper for detecting CLooG-Legacy (CLooG-PPL).
 m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM(
-  [#include <cloog/cloog.h>],
-  [ppl_version_major ()])])
+  [#include "cloog/cloog.h"],
+  [#ifndef CLOOG_PPL_BACKEND
+    choke me
+   #endif ])])
 
 # CLOOG_FIND_FLAGS ()
 # ------------------
@@ -114,12 +116,11 @@ AC_DEFUN([CLOOG_FIND_FLAGS],
   _cloog_saved_LDFLAGS=$LDFLAGS
   _cloog_saved_LIBS=$LIBS
 
-  _clooglegacyinc="-DCLOOG_PPL_BACKEND"
   _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
  
   dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS.
   CFLAGS="${CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
-  CPPFLAGS="${CPPFLAGS} ${_clooglegacyinc} ${_cloogorginc}"
+  CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
   LDFLAGS="${LDFLAGS} ${clooglibs} ${ppllibs}"
 
   AC_CACHE_CHECK([for installed CLooG],
@@ -137,7 +138,7 @@ AC_DEFUN([CLOOG_FIND_FLAGS],
 
   case $gcc_cv_cloog_type in
     "PPL Legacy")
-      clooginc="${clooginc} ${_clooglegacyinc}"
+      clooginc="${clooginc}"
       clooglibs="${clooglibs} -lcloog"
       cloog_org=no
       ;;
diff --git a/configure b/configure
index dcb582f..0e4f1ed 100755
--- a/configure
+++ b/configure
@@ -5725,11 +5725,10 @@ if test "x$with_cloog" != "xno"; then
   _cloog_saved_LDFLAGS=$LDFLAGS
   _cloog_saved_LIBS=$LIBS
 
-  _clooglegacyinc="-DCLOOG_PPL_BACKEND"
   _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
 
     CFLAGS="${CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
-  CPPFLAGS="${CPPFLAGS} ${_clooglegacyinc} ${_cloogorginc}"
+  CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
   LDFLAGS="${LDFLAGS} ${clooglibs} ${ppllibs}"
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG" >&5
@@ -5740,11 +5739,13 @@ else
   LIBS="-lcloog ${_cloog_saved_LIBS}"
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <cloog/cloog.h>
+#include "cloog/cloog.h"
 int
 main ()
 {
-ppl_version_major ()
+#ifndef CLOOG_PPL_BACKEND
+    choke me
+   #endif
   ;
   return 0;
 }
@@ -5755,7 +5756,7 @@ else
   LIBS="-lcloog-isl -lisl ${_cloog_saved_LIBS}"
        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <cloog/cloog.h>
+#include "cloog/cloog.h"
 int
 main ()
 {
@@ -5770,7 +5771,7 @@ else
   LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <cloog/cloog.h>
+#include "cloog/cloog.h"
 int
 main ()
 {
@@ -5798,7 +5799,7 @@ $as_echo "$gcc_cv_cloog_type" >&6; }
 
   case $gcc_cv_cloog_type in
     "PPL Legacy")
-      clooginc="${clooginc} ${_clooglegacyinc}"
+      clooginc="${clooginc}"
       clooglibs="${clooglibs} -lcloog"
       cloog_org=no
       ;;
-- 
1.7.1

>From 8b8b33ade1658dc2e0dc660cccd66f6f0aa18e72 Mon Sep 17 00:00:00 2001
From: Tobias Grosser <grosser@fim.uni-passau.de>
Date: Fri, 12 Nov 2010 13:08:54 -0500
Subject: [PATCH 3/3] Add -enable-cloog-backend.

	* config/cloog.m4: Add -enable-cloog-backend=(isl|ppl|ppl-legacy) to
	define the cloog backend to use. Furthermore, only pass the ppllibs
	to the configure checks, if necessary.
	*configure: Regenerate.
---
 config/cloog.m4 |   74 +++++++++++++++++++++++++++++++++++-------------
 configure       |   85 ++++++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 122 insertions(+), 37 deletions(-)

diff --git a/config/cloog.m4 b/config/cloog.m4
index 6ed0f1b..4936e8a 100644
--- a/config/cloog.m4
+++ b/config/cloog.m4
@@ -36,7 +36,19 @@ AC_DEFUN([CLOOG_INIT_FLAGS],
     [AS_HELP_STRING(
       [--with-cloog-lib=PATH],
       [Specify the directory for the installed CLooG library])])
-  
+
+  AC_ARG_ENABLE(cloog-backend,
+    [  --enable-cloog-backend[=backend]
+				isl: The cloog.org isl backend
+				ppl-legacy: The legacy ppl backend - default
+				ppl: The cloog.org ppl backend],
+    [ if   test "x${enableval}" = "xisl"; then
+	cloog_backend=isl
+      elif test "x${enableval}" = "xppl"; then
+	cloog_backend=ppl
+      else
+	cloog_backend=ppl-legacy
+      fi], cloog_backend=ppl-legacy)
   AC_ARG_ENABLE(cloog-version-check,
     [AS_HELP_STRING(
       [--disable-cloog-version-check],
@@ -87,11 +99,19 @@ AC_DEFUN([CLOOG_REQUESTED],
 ]
 )
 
-# _CLOOG_ORG_PROG ()
+# _CLOOG_ORG_PROG_ISL ()
 # ------------------
-# Helper for detecting CLooG.org's backend.
-m4_define([_CLOOG_ORG_PROG],[AC_LANG_PROGRAM(
-  [#include "cloog/cloog.h"],
+# Helper for detecting CLooG.org's ISL backend.
+m4_define([_CLOOG_ORG_PROG_ISL],[AC_LANG_PROGRAM(
+  [#include "cloog/cloog.h" ],
+  [cloog_version ()])])
+
+# _CLOOG_ORG_PROG_PPL ()
+# ------------------
+# Helper for detecting CLooG.org's PPL backend.
+m4_define([_CLOOG_ORG_PROG_PPL],[AC_LANG_PROGRAM(
+  [#include "cloog/cloog.h"
+   #include "cloog/ppl/cloog.h"],
   [cloog_version ()])])
 
 # _CLOOG_PPL_LEGACY_PROG ()
@@ -106,7 +126,7 @@ m4_define([_CLOOG_PPL_LEGACY_PROG], [AC_LANG_PROGRAM(
 # CLOOG_FIND_FLAGS ()
 # ------------------
 # Detect the used CLooG-backend and set clooginc/clooglibs/cloog_org.
-# Preference: CLooG-PPL (Legacy) > CLooG-ISL > CLooG-PPL
+# Only look for the CLooG backend type specified in --enable-cloog-backend
 AC_DEFUN([CLOOG_FIND_FLAGS],
 [
   AC_REQUIRE([CLOOG_INIT_FLAGS])
@@ -119,22 +139,36 @@ AC_DEFUN([CLOOG_FIND_FLAGS],
   _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
  
   dnl clooglibs & clooginc may have been initialized by CLOOG_INIT_FLAGS.
-  CFLAGS="${CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
+  CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}"
   CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
-  LDFLAGS="${LDFLAGS} ${clooglibs} ${ppllibs}"
-
-  AC_CACHE_CHECK([for installed CLooG],
-                 [gcc_cv_cloog_type],
-    [LIBS="-lcloog ${_cloog_saved_LIBS}"
-     AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG],
-      [gcc_cv_cloog_type="PPL Legacy"],
-      [LIBS="-lcloog-isl -lisl ${_cloog_saved_LIBS}"
-       AC_LINK_IFELSE([_CLOOG_ORG_PROG],
-        [gcc_cv_cloog_type=ISL],
-        [LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
-         AC_LINK_IFELSE([_CLOOG_ORG_PROG],
-          [gcc_cv_cloog_type=PPL],
-          [gcc_cv_cloog_type=no])])])])
+  LDFLAGS="${LDFLAGS} ${clooglibs}"
+
+  case $cloog_backend in
+    "ppl-legacy")
+    CFLAGS="${CFLAGS} ${pplinc}"
+    LDFLAGS="${LDFLAGS} ${ppllibs}"
+    AC_CACHE_CHECK([for installed CLooG PPL Legacy], [gcc_cv_cloog_type],
+      [LIBS="-lcloog ${_cloog_saved_LIBS}"
+      AC_LINK_IFELSE([_CLOOG_PPL_LEGACY_PROG], [gcc_cv_cloog_type="PPL Legacy"],
+		     [gcc_cv_cloog_type=no])])
+    ;;
+    "isl")
+    AC_CACHE_CHECK([for installed CLooG ISL], [gcc_cv_cloog_type],
+      [LIBS="-lcloog-isl ${_cloog_saved_LIBS}"
+      AC_LINK_IFELSE([_CLOOG_ORG_PROG_ISL], [gcc_cv_cloog_type="ISL"],
+		     [gcc_cv_cloog_type=no])])
+    ;;
+    "ppl")
+    CFLAGS="${CFLAGS} ${pplinc}"
+    LDFLAGS="${LDFLAGS} ${ppllibs}"
+    AC_CACHE_CHECK([for installed CLooG PPL], [gcc_cv_cloog_type],
+      [LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
+      AC_LINK_IFELSE([_CLOOG_ORG_PROG_PPL], [gcc_cv_cloog_type="PPL"],
+		     [gcc_cv_cloog_type=no])])
+    ;;
+    *)
+      gcc_cv_cloog_type=""
+  esac
 
   case $gcc_cv_cloog_type in
     "PPL Legacy")
diff --git a/configure b/configure
index 0e4f1ed..bcc087b 100755
--- a/configure
+++ b/configure
@@ -765,6 +765,7 @@ enable_ppl_version_check
 with_cloog
 with_cloog_include
 with_cloog_lib
+enable_cloog_backend
 enable_cloog_version_check
 enable_lto
 enable_stage1_languages
@@ -1451,6 +1452,10 @@ Optional Features:
   --enable-libssp         build libssp directory
   --enable-build-with-cxx build with C++ compiler instead of C compiler
   --disable-ppl-version-check    disable check for PPL version
+  --enable-cloog-backend=backend
+				isl: The cloog.org isl backend
+				ppl-legacy: The legacy ppl backend - default
+				ppl: The cloog.org ppl backend
   --disable-cloog-version-check
                           disable check for CLooG version
   --enable-lto            enable link time optimization support
@@ -5676,6 +5681,19 @@ if test "${with_cloog_lib+set}" = set; then :
 fi
 
 
+  # Check whether --enable-cloog-backend was given.
+if test "${enable_cloog_backend+set}" = set; then :
+  enableval=$enable_cloog_backend;  if   test "x${enableval}" = "xisl"; then
+	cloog_backend=isl
+      elif test "x${enableval}" = "xppl"; then
+	cloog_backend=ppl
+      else
+	cloog_backend=ppl-legacy
+      fi
+else
+  cloog_backend=ppl-legacy
+fi
+
   # Check whether --enable-cloog-version-check was given.
 if test "${enable_cloog_version_check+set}" = set; then :
   enableval=$enable_cloog_version_check; ENABLE_CLOOG_CHECK=$enableval
@@ -5727,17 +5745,21 @@ if test "x$with_cloog" != "xno"; then
 
   _cloogorginc="-DCLOOG_INT_GMP -DCLOOG_ORG"
 
-    CFLAGS="${CFLAGS} ${clooginc} ${pplinc} ${gmpinc}"
+    CFLAGS="${CFLAGS} ${clooginc} ${gmpinc}"
   CPPFLAGS="${CPPFLAGS} ${_cloogorginc}"
-  LDFLAGS="${LDFLAGS} ${clooglibs} ${ppllibs}"
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG" >&5
-$as_echo_n "checking for installed CLooG... " >&6; }
+  LDFLAGS="${LDFLAGS} ${clooglibs}"
+
+  case $cloog_backend in
+    "ppl-legacy")
+    CFLAGS="${CFLAGS} ${pplinc}"
+    LDFLAGS="${LDFLAGS} ${ppllibs}"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG PPL Legacy" >&5
+$as_echo_n "checking for installed CLooG PPL Legacy... " >&6; }
 if test "${gcc_cv_cloog_type+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   LIBS="-lcloog ${_cloog_saved_LIBS}"
-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include "cloog/cloog.h"
 int
@@ -5753,8 +5775,22 @@ _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
   gcc_cv_cloog_type="PPL Legacy"
 else
-  LIBS="-lcloog-isl -lisl ${_cloog_saved_LIBS}"
-       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  gcc_cv_cloog_type=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5
+$as_echo "$gcc_cv_cloog_type" >&6; }
+    ;;
+    "isl")
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG ISL" >&5
+$as_echo_n "checking for installed CLooG ISL... " >&6; }
+if test "${gcc_cv_cloog_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  LIBS="-lcloog-isl ${_cloog_saved_LIBS}"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include "cloog/cloog.h"
 int
@@ -5766,12 +5802,29 @@ cloog_version ()
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gcc_cv_cloog_type=ISL
+  gcc_cv_cloog_type="ISL"
+else
+  gcc_cv_cloog_type=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5
+$as_echo "$gcc_cv_cloog_type" >&6; }
+    ;;
+    "ppl")
+    CFLAGS="${CFLAGS} ${pplinc}"
+    LDFLAGS="${LDFLAGS} ${ppllibs}"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for installed CLooG PPL" >&5
+$as_echo_n "checking for installed CLooG PPL... " >&6; }
+if test "${gcc_cv_cloog_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   LIBS="-lcloog-ppl ${_cloog_saved_LIBS}"
-         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include "cloog/cloog.h"
+   #include "cloog/ppl/cloog.h"
 int
 main ()
 {
@@ -5781,21 +5834,19 @@ cloog_version ()
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gcc_cv_cloog_type=PPL
+  gcc_cv_cloog_type="PPL"
 else
   gcc_cv_cloog_type=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_cloog_type" >&5
 $as_echo "$gcc_cv_cloog_type" >&6; }
+    ;;
+    *)
+      gcc_cv_cloog_type=""
+  esac
 
   case $gcc_cv_cloog_type in
     "PPL Legacy")
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]