[polly] r297452 - Introduce isl C++ bindings, Part 1: value_ptr style interface

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 10 03:41:03 PST 2017


Author: grosser
Date: Fri Mar 10 05:41:03 2017
New Revision: 297452

URL: http://llvm.org/viewvc/llvm-project?rev=297452&view=rev
Log:
Introduce isl C++ bindings, Part 1: value_ptr style interface

Over the last couple of months several authors of independent isl C++ bindings
worked together to jointly design an official set of isl C++ bindings which
combines their experience in developing isl C++ bindings. The new bindings have
been designed around a value pointer style interface and remove the need for
explicit pointer managenent and instead use C++ language features to manage isl
objects.

This commit introduces the smart-pointer part of the isl C++ bindings and
replaces the current IslPtr<T> classes, which served the very same purpose, but
had to be manually maintained. Instead, we now rely on automatically generated
classes for each isl object, which provide value_ptr semantics.

An isl object has the following smart pointer interface:

    inline set manage(__isl_take isl_set *ptr);

    class set {
      friend inline set manage(__isl_take isl_set *ptr);
      isl_set *ptr = nullptr;
      inline explicit set(__isl_take isl_set *ptr);

    public:
      inline set();
      inline set(const set &obj);
      inline set &operator=(set obj);
      inline ~set();
      inline __isl_give isl_set *copy() const &;
      inline __isl_give isl_set *copy() && = delete;
      inline __isl_keep isl_set *get() const;
      inline __isl_give isl_set *release();
      inline bool is_null() const;
    }

The interface and behavior of the new value pointer style classes is inspired
by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3339.pdf, which
proposes a std::value_ptr, a smart pointer that applies value semantics to its
pointee.

We currently only provide a limited set of public constructors and instead
require provide a global overloaded type constructor method "isl::obj
isl::manage(isl_obj *)", which allows to convert an isl_set* to an isl::set by
calling 'S = isl::manage(s)'. This pattern models the make_unique() constructor
for unique pointers.

The next two functions isl::obj::get() and isl::obj::release() are taken
directly from the std::value_ptr proposal:

S.get() extracts the raw pointer of the object managed by S.
S.release() extracts the raw pointer of the object managed by S and sets the
object in S to null.

We additionally add std::obj::copy(). S.copy() returns a raw pointer refering
to a copy of S, which is a shortcut for "isl::obj(oldobj).release()", a
functionality commonly needed when interacting directly with the isl C
interface where all methods marked with __isl_take require consumable raw
pointers.

S.is_null() checks if S manages a pointer or if the managed object is currently
null. We add this function to provide a more explicit way to check if the
pointer is empty compared to a direct conversion to bool.

This commit also introduces a couple of polly-specific extensions that cover
features currently not handled by the official isl C++ bindings draft, but
which have been provided by IslPtr<T> and are consequently added to avoid code
churn. These extensions include:

	- operator bool() : Conversion from objects to bool
	- construction from nullptr_t
	- get_ctx() method
	- take/keep/give methods, which match the currently used naming
	  convention of IslPtr<T> in Polly. They just forward to
	  (release/get/manage).
	- raw_ostream printers

We expect that these extensions are over time either removed or upstreamed to
the official isl bindings.

We also export a couple of classes that have not yet been exported in isl (e.g.,
isl::space)

As part of the code review, the following two questions were asked:

- Why do we not use a standard smart pointer?

std::value_ptr was a proposal that has not been accepted. It is consequently
not available in the standard library. Even if it would be available, we want
to expand this interface with a complete method interface that is conveniently
available from each managed pointer. The most direct way to achieve this is to
generate a specialiced value style pointer class for each isl object type and
add any additional methods to this class. The relevant changes follow in
subsequent commits.

- Why do we not use templates or macros to avoid code duplication?

It is certainly possible to use templates or macros, but as this code is
auto-generated there is no need to make writing this code more efficient. Also,
most of these classes will be specialized with individual member functions in
subsequent commits, such that there will be little code reuse to exploit. Hence,
we decided to do so at the moment.

These bindings are not yet officially part of isl, but the draft is already very
stable. The smart pointer interface itself did not change since serveral months.
Adding this code to Polly is against our normal policy of only importing
official isl code. In this case however, we make an exception to showcase a
non-trivial use case of these bindings which should increase confidence in these
bindings and will help upstreaming them to isl.

Tags: #polly

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D30325

Added:
    polly/trunk/lib/External/isl/include/isl-noexceptions.h
Modified:
    polly/trunk/include/polly/DeLICM.h
    polly/trunk/include/polly/FlattenAlgo.h
    polly/trunk/include/polly/Support/GICHelper.h
    polly/trunk/include/polly/Support/ISLTools.h
    polly/trunk/lib/Support/GICHelper.cpp
    polly/trunk/lib/Support/ISLTools.cpp
    polly/trunk/lib/Transform/DeLICM.cpp
    polly/trunk/lib/Transform/FlattenAlgo.cpp
    polly/trunk/lib/Transform/FlattenSchedule.cpp
    polly/trunk/unittests/DeLICM/DeLICMTest.cpp
    polly/trunk/unittests/Isl/IslTest.cpp

Modified: polly/trunk/include/polly/DeLICM.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/DeLICM.h?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/include/polly/DeLICM.h (original)
+++ polly/trunk/include/polly/DeLICM.h Fri Mar 10 05:41:03 2017
@@ -32,12 +32,10 @@ llvm::Pass *createDeLICMPass();
 /// Determine whether two lifetimes are conflicting.
 ///
 /// Used by unittesting.
-bool isConflicting(IslPtr<isl_union_set> ExistingOccupied,
-                   IslPtr<isl_union_set> ExistingUnused,
-                   IslPtr<isl_union_set> ExistingWrites,
-                   IslPtr<isl_union_set> ProposedOccupied,
-                   IslPtr<isl_union_set> ProposedUnused,
-                   IslPtr<isl_union_set> ProposedWrites,
+bool isConflicting(isl::union_set ExistingOccupied,
+                   isl::union_set ExistingUnused, isl::union_set ExistingWrites,
+                   isl::union_set ProposedOccupied,
+                   isl::union_set ProposedUnused, isl::union_set ProposedWrites,
                    llvm::raw_ostream *OS = nullptr, unsigned Indent = 0);
 } // namespace polly
 

Modified: polly/trunk/include/polly/FlattenAlgo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/FlattenAlgo.h?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/include/polly/FlattenAlgo.h (original)
+++ polly/trunk/include/polly/FlattenAlgo.h Fri Mar 10 05:41:03 2017
@@ -32,7 +32,7 @@ namespace polly {
 /// @param Schedule The input schedule.
 ///
 /// @return The flattened schedule.
-IslPtr<isl_union_map> flattenSchedule(IslPtr<isl_union_map> Schedule);
+isl::union_map flattenSchedule(isl::union_map Schedule);
 } // namespace polly
 
 #endif /* POLLY_FLATTENALGO_H */

Modified: polly/trunk/include/polly/Support/GICHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/GICHelper.h?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/GICHelper.h (original)
+++ polly/trunk/include/polly/Support/GICHelper.h Fri Mar 10 05:41:03 2017
@@ -24,6 +24,9 @@
 #include "isl/set.h"
 #include "isl/union_map.h"
 #include "isl/union_set.h"
+
+#include "isl-noexceptions.h"
+
 #include <functional>
 #include <string>
 
@@ -176,151 +179,15 @@ std::string getIslCompatibleName(const s
                                  const std::string &Middle,
                                  const std::string &Suffix);
 
-/// IslObjTraits<isl_*> is a static class to invoke common functions that all
-/// ISL objects have: isl_*_copy, isl_*_free, isl_*_get_ctx and isl_*_to_str.
-/// These functions follow a common naming scheme, but not a base class
-/// hierarchy (as ISL is written in C). As such, the functions are accessible
-/// only by constructing the function name using the preprocessor. This class
-/// serves to make these names accessible to a C++ template scheme.
-///
-/// There is an isl_obj polymorphism layer, but its implementation is
-/// incomplete.
-template <typename T> class IslObjTraits;
-
-#define DECLARE_TRAITS(TYPE)                                                   \
-  template <> class IslObjTraits<isl_##TYPE> {                                 \
-  public:                                                                      \
-    static __isl_give isl_##TYPE *copy(__isl_keep isl_##TYPE *Obj) {           \
-      return isl_##TYPE##_copy(Obj);                                           \
-    }                                                                          \
-    static void free(__isl_take isl_##TYPE *Obj) { isl_##TYPE##_free(Obj); }   \
-    static isl_ctx *get_ctx(__isl_keep isl_##TYPE *Obj) {                      \
-      return isl_##TYPE##_get_ctx(Obj);                                        \
-    }                                                                          \
-    static std::string to_str(__isl_keep isl_##TYPE *Obj) {                    \
-      if (!Obj)                                                                \
-        return "null";                                                         \
-      char *cstr = isl_##TYPE##_to_str(Obj);                                   \
-      if (!cstr)                                                               \
-        return "null";                                                         \
-      std::string Result{cstr};                                                \
-      ::free(cstr);                                                            \
-      return Result;                                                           \
-    }                                                                          \
-  };
-
-DECLARE_TRAITS(id)
-DECLARE_TRAITS(val)
-DECLARE_TRAITS(space)
-DECLARE_TRAITS(basic_map)
-DECLARE_TRAITS(map)
-DECLARE_TRAITS(union_map)
-DECLARE_TRAITS(basic_set)
-DECLARE_TRAITS(set)
-DECLARE_TRAITS(union_set)
-DECLARE_TRAITS(aff)
-DECLARE_TRAITS(multi_aff)
-DECLARE_TRAITS(pw_aff)
-DECLARE_TRAITS(pw_multi_aff)
-DECLARE_TRAITS(multi_pw_aff)
-DECLARE_TRAITS(union_pw_aff)
-DECLARE_TRAITS(multi_union_pw_aff)
-DECLARE_TRAITS(union_pw_multi_aff)
-
-/// Smart pointer to an ISL object.
-///
-/// An object of this class owns an reference of an ISL object, meaning if will
-/// free it when destroyed. Most ISL objects are reference counted such that we
-/// gain an automatic memory management.
-///
-/// Function parameters in the ISL API are annotated using either __isl_keep
-/// __isl_take. Return values that are objects are annotated using __is_give,
-/// meaning the caller is responsible for releasing the object. When annotated
-/// with __isl_keep, use the keep() function to pass a plain pointer to the ISL
-/// object. For __isl_take-annotated parameters, use either copy() to increase
-/// the reference counter by one, or take() to pass the ownership to the called
-/// function. When IslPtr loses ownership, it cannot be used anymore and won't
-/// free the object when destroyed. Use the give() function to wrap the
-/// ownership of a returned isl_* object into an IstPtr<isl_*>.
-///
-/// There is purposefully no implicit conversion from/to plain isl_* pointers to
-/// avoid difficult to find bugs because keep/copy/take would have been
-/// required.
-template <typename T> class IslPtr {
-  typedef IslPtr<T> ThisTy;
-  typedef IslObjTraits<T> Traits;
-
-private:
-  T *Obj;
-
-  explicit IslPtr(__isl_take T *Obj) : Obj(Obj) {}
-
-public:
-  IslPtr() : Obj(nullptr) {}
-  /* implicit */ IslPtr(std::nullptr_t That) : IslPtr() {}
-
-  /* implicit */ IslPtr(const ThisTy &That)
-      : IslPtr(IslObjTraits<T>::copy(That.Obj)) {}
-  /* implicit */ IslPtr(ThisTy &&That) : IslPtr(That.Obj) {
-    That.Obj = nullptr;
-  }
-  ~IslPtr() {
-    if (Obj)
-      Traits::free(Obj);
-  }
-
-  ThisTy &operator=(const ThisTy &That) {
-    if (Obj)
-      Traits::free(Obj);
-    this->Obj = Traits::copy(That.Obj);
-    return *this;
-  }
-  ThisTy &operator=(ThisTy &&That) {
-    swap(*this, That);
-    return *this;
-  }
-
-  explicit operator bool() const { return Obj; }
-
-  static void swap(ThisTy &LHS, ThisTy &RHS) { std::swap(LHS.Obj, RHS.Obj); }
-
-  static ThisTy give(__isl_take T *Obj) { return ThisTy(Obj); }
-  T *keep() const { return Obj; }
-  __isl_give T *take() {
-    auto *Result = Obj;
-    Obj = nullptr;
-    return Result;
-  }
-  __isl_give T *copy() const { return Traits::copy(Obj); }
-
-  isl_ctx *getCtx() const { return Traits::get_ctx(Obj); }
-  std::string toStr() const { return Traits::to_str(Obj); }
-
-  /// Print a string representation of this ISL object to stderr.
-  ///
-  /// This function is meant to be called from a debugger and therefore must
-  /// not be declared inline: The debugger needs a valid function pointer to
-  /// call, even if the method is not used.
-  ///
-  /// Note that the string representation of isl_*_dump is different than the
-  /// one for isl_printer/isl_*_to_str().
-  void dump() const;
-};
-
-template <typename T> static IslPtr<T> give(__isl_take T *Obj) {
-  return IslPtr<T>::give(Obj);
-}
-
-template <typename T>
-llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const IslPtr<T> &Obj) {
-  OS << IslObjTraits<T>::to_str(Obj.keep());
-  return OS;
-}
-
-template <typename T>
-llvm::DiagnosticInfoOptimizationBase &
-operator<<(llvm::DiagnosticInfoOptimizationBase &OS, const IslPtr<T> &Obj) {
-  OS << IslObjTraits<T>::to_str(Obj.keep());
+// Make isl::give available in polly namespace. We do this as there was
+// previously a function polly::give() which did the very same thing and we
+// did not want yet to introduce the isl:: prefix to each call of give.
+using isl::give;
+
+inline llvm::DiagnosticInfoOptimizationBase &
+operator<<(llvm::DiagnosticInfoOptimizationBase &OS,
+           const isl::union_map &Obj) {
+  OS << Obj.to_str();
   return OS;
 }
 
@@ -328,36 +195,36 @@ operator<<(llvm::DiagnosticInfoOptimizat
 ///
 /// This basically wraps isl_map_foreach_basic_map() and allows to call back
 /// C++11 closures.
-void foreachElt(const IslPtr<isl_map> &Map,
-                const std::function<void(IslPtr<isl_basic_map>)> &F);
+void foreachElt(const isl::map &Map,
+                const std::function<void(isl::basic_map)> &F);
 
 /// Enumerate all isl_basic_sets of an isl_set.
 ///
 /// This basically wraps isl_set_foreach_basic_set() and allows to call back
 /// C++11 closures.
-void foreachElt(const IslPtr<isl_set> &Set,
-                const std::function<void(IslPtr<isl_basic_set>)> &F);
+void foreachElt(const isl::set &Set,
+                const std::function<void(isl::basic_set)> &F);
 
 /// Enumerate all isl_maps of an isl_union_map.
 ///
 /// This basically wraps isl_union_map_foreach_map() and allows to call back
 /// C++11 closures.
-void foreachElt(const IslPtr<isl_union_map> &UMap,
-                const std::function<void(IslPtr<isl_map> Map)> &F);
+void foreachElt(const isl::union_map &UMap,
+                const std::function<void(isl::map Map)> &F);
 
 /// Enumerate all isl_sets of an isl_union_set.
 ///
 /// This basically wraps isl_union_set_foreach_set() and allows to call back
 /// C++11 closures.
-void foreachElt(const IslPtr<isl_union_set> &USet,
-                const std::function<void(IslPtr<isl_set> Set)> &F);
+void foreachElt(const isl::union_set &USet,
+                const std::function<void(isl::set Set)> &F);
 
 /// Enumerate all isl_pw_aff of an isl_union_pw_aff.
 ///
 /// This basically wraps isl_union_pw_aff(), but also allows to call back C++11
 /// closures.
-void foreachElt(const IslPtr<isl_union_pw_aff> &UPwAff,
-                const std::function<void(IslPtr<isl_pw_aff>)> &F);
+void foreachElt(const isl::union_pw_aff &UPwAff,
+                const std::function<void(isl::pw_aff)> &F);
 
 /// Enumerate all polyhedra of an isl_map.
 ///
@@ -371,9 +238,8 @@ void foreachElt(const IslPtr<isl_union_p
 ///
 /// @return The isl_stat returned by the last callback invocation; isl_stat_ok
 ///         if the collection was empty.
-isl_stat
-foreachEltWithBreak(const IslPtr<isl_map> &Map,
-                    const std::function<isl_stat(IslPtr<isl_basic_map>)> &F);
+isl_stat foreachEltWithBreak(const isl::map &Map,
+                             const std::function<isl_stat(isl::basic_map)> &F);
 
 /// Enumerate all isl_maps of an isl_union_map.
 ///
@@ -388,9 +254,8 @@ foreachEltWithBreak(const IslPtr<isl_map
 ///
 /// @return The isl_stat returned by the last callback invocation; isl_stat_ok
 ///         if the collection was initially empty.
-isl_stat
-foreachEltWithBreak(const IslPtr<isl_union_map> &UMap,
-                    const std::function<isl_stat(IslPtr<isl_map> Map)> &F);
+isl_stat foreachEltWithBreak(const isl::union_map &UMap,
+                             const std::function<isl_stat(isl::map Map)> &F);
 
 /// Enumerate all pieces of an isl_pw_aff.
 ///
@@ -404,9 +269,9 @@ foreachEltWithBreak(const IslPtr<isl_uni
 ///
 /// @return The isl_stat returned by the last callback invocation; isl_stat_ok
 ///         if the collection was initially empty.
-isl_stat foreachPieceWithBreak(
-    const IslPtr<isl_pw_aff> &PwAff,
-    const std::function<isl_stat(IslPtr<isl_set>, IslPtr<isl_aff>)> &F);
+isl_stat
+foreachPieceWithBreak(const isl::pw_aff &PwAff,
+                      const std::function<isl_stat(isl::set, isl::aff)> &F);
 
 /// Scoped limit of ISL operations.
 ///

Modified: polly/trunk/include/polly/Support/ISLTools.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/ISLTools.h?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/ISLTools.h (original)
+++ polly/trunk/include/polly/Support/ISLTools.h Fri Mar 10 05:41:03 2017
@@ -28,10 +28,10 @@ namespace polly {
 /// @return { Space[] -> Scatter[] }
 ///         A map to all timepoints that happen before the timepoints the input
 ///         mapped to.
-IslPtr<isl_map> beforeScatter(IslPtr<isl_map> Map, bool Strict);
+isl::map beforeScatter(isl::map Map, bool Strict);
 
-/// Piecewise beforeScatter(IslPtr<isl_map>,bool).
-IslPtr<isl_union_map> beforeScatter(IslPtr<isl_union_map> UMap, bool Strict);
+/// Piecewise beforeScatter(isl::map,bool).
+isl::union_map beforeScatter(isl::union_map UMap, bool Strict);
 
 /// Return the range elements that are lexicographically larger.
 ///
@@ -42,11 +42,10 @@ IslPtr<isl_union_map> beforeScatter(IslP
 /// @return { Space[] -> Scatter[] }
 ///         A map to all timepoints that happen after the timepoints the input
 ///         map originally mapped to.
-IslPtr<isl_map> afterScatter(IslPtr<isl_map> Map, bool Strict);
+isl::map afterScatter(isl::map Map, bool Strict);
 
-/// Piecewise afterScatter(IslPtr<isl_map>,bool).
-IslPtr<isl_union_map> afterScatter(const IslPtr<isl_union_map> &UMap,
-                                   bool Strict);
+/// Piecewise afterScatter(isl::map,bool).
+isl::union_map afterScatter(const isl::union_map &UMap, bool Strict);
 
 /// Construct a range of timepoints between two timepoints.
 ///
@@ -74,13 +73,11 @@ IslPtr<isl_union_map> afterScatter(const
 ///         A map for each domain element of timepoints between two extreme
 ///         points, or nullptr if @p From or @p To is nullptr, or the isl max
 ///         operations is exceeded.
-IslPtr<isl_map> betweenScatter(IslPtr<isl_map> From, IslPtr<isl_map> To,
-                               bool InclFrom, bool InclTo);
+isl::map betweenScatter(isl::map From, isl::map To, bool InclFrom, bool InclTo);
 
-/// Piecewise betweenScatter(IslPtr<isl_map>,IslPtr<isl_map>,bool,bool).
-IslPtr<isl_union_map> betweenScatter(IslPtr<isl_union_map> From,
-                                     IslPtr<isl_union_map> To, bool InclFrom,
-                                     bool InclTo);
+/// Piecewise betweenScatter(isl::map,isl::map,bool,bool).
+isl::union_map betweenScatter(isl::union_map From, isl::union_map To,
+                              bool InclFrom, bool InclTo);
 
 /// If by construction a union map is known to contain only a single map, return
 /// it.
@@ -91,8 +88,7 @@ IslPtr<isl_union_map> betweenScatter(Isl
 /// isl_union_map_extract_map() on the other hand does not check whether there
 /// is (at most) one isl_map in the union, i.e. how it has been constructed is
 /// probably wrong.
-IslPtr<isl_map> singleton(IslPtr<isl_union_map> UMap,
-                          IslPtr<isl_space> ExpectedSpace);
+isl::map singleton(isl::union_map UMap, isl::space ExpectedSpace);
 
 /// If by construction an isl_union_set is known to contain only a single
 /// isl_set, return it.
@@ -103,8 +99,7 @@ IslPtr<isl_map> singleton(IslPtr<isl_uni
 /// isl_union_set_extract_set() on the other hand does not check whether there
 /// is (at most) one isl_set in the union, i.e. how it has been constructed is
 /// probably wrong.
-IslPtr<isl_set> singleton(IslPtr<isl_union_set> USet,
-                          IslPtr<isl_space> ExpectedSpace);
+isl::set singleton(isl::union_set USet, isl::space ExpectedSpace);
 
 /// Determine how many dimensions the scatter space of @p Schedule has.
 ///
@@ -114,13 +109,13 @@ IslPtr<isl_set> singleton(IslPtr<isl_uni
 /// The implementation currently returns the maximum number of dimensions it
 /// encounters, if different, and 0 if none is encountered. However, most other
 /// code will most likely fail if one of these happen.
-unsigned getNumScatterDims(const IslPtr<isl_union_map> &Schedule);
+unsigned getNumScatterDims(const isl::union_map &Schedule);
 
 /// Return the scatter space of a @p Schedule.
 ///
 /// This is basically the range space of the schedule map, but harder to
 /// determine because it is an isl_union_map.
-IslPtr<isl_space> getScatterSpace(const IslPtr<isl_union_map> &Schedule);
+isl::space getScatterSpace(const isl::union_map &Schedule);
 
 /// Construct an identity map for the given domain values.
 ///
@@ -136,18 +131,17 @@ IslPtr<isl_space> getScatterSpace(const
 ///
 /// @return { Space[] -> Space[] }
 ///         A map that maps each value of @p USet to itself.
-IslPtr<isl_union_map> makeIdentityMap(const IslPtr<isl_union_set> &USet,
-                                      bool RestrictDomain);
+isl::union_map makeIdentityMap(const isl::union_set &USet, bool RestrictDomain);
 
 /// Reverse the nested map tuple in @p Map's domain.
 ///
 /// @param Map { [Space1[] -> Space2[]] -> Space3[] }
 ///
 /// @return { [Space2[] -> Space1[]] -> Space3[] }
-IslPtr<isl_map> reverseDomain(IslPtr<isl_map> Map);
+isl::map reverseDomain(isl::map Map);
 
-/// Piecewise reverseDomain(IslPtr<isl_map>).
-IslPtr<isl_union_map> reverseDomain(const IslPtr<isl_union_map> &UMap);
+/// Piecewise reverseDomain(isl::map).
+isl::union_map reverseDomain(const isl::union_map &UMap);
 
 /// Add a constant to one dimension of a set.
 ///
@@ -158,22 +152,22 @@ IslPtr<isl_union_map> reverseDomain(cons
 /// @param Amount The offset to add to the specified dimension.
 ///
 /// @return The modified set.
-IslPtr<isl_set> shiftDim(IslPtr<isl_set> Set, int Pos, int Amount);
+isl::set shiftDim(isl::set Set, int Pos, int Amount);
 
-/// Piecewise shiftDim(IslPtr<isl_set>,int,int).
-IslPtr<isl_union_set> shiftDim(IslPtr<isl_union_set> USet, int Pos, int Amount);
+/// Piecewise shiftDim(isl::set,int,int).
+isl::union_set shiftDim(isl::union_set USet, int Pos, int Amount);
 
 /// Simplify a set inplace.
-void simplify(IslPtr<isl_set> &Set);
+void simplify(isl::set &Set);
 
 /// Simplify a union set inplace.
-void simplify(IslPtr<isl_union_set> &USet);
+void simplify(isl::union_set &USet);
 
 /// Simplify a map inplace.
-void simplify(IslPtr<isl_map> &Map);
+void simplify(isl::map &Map);
 
 /// Simplify a union map inplace.
-void simplify(IslPtr<isl_union_map> &UMap);
+void simplify(isl::union_map &UMap);
 
 /// Compute the reaching definition statement or the next overwrite for each
 /// definition of an array element.
@@ -228,10 +222,9 @@ void simplify(IslPtr<isl_union_map> &UMa
 ///         The reaching definitions or future overwrite as described above, or
 ///         nullptr if either @p Schedule or @p Writes is nullptr, or the isl
 ///         max operations count has exceeded.
-IslPtr<isl_union_map> computeReachingWrite(IslPtr<isl_union_map> Schedule,
-                                           IslPtr<isl_union_map> Writes,
-                                           bool Reverse, bool InclPrevDef,
-                                           bool InclNextDef);
+isl::union_map computeReachingWrite(isl::union_map Schedule,
+                                    isl::union_map Writes, bool Reverse,
+                                    bool InclPrevDef, bool InclNextDef);
 
 /// Compute the timepoints where the contents of an array element are not used.
 ///
@@ -293,11 +286,10 @@ IslPtr<isl_union_map> computeReachingWri
 ///         The unused timepoints as defined above, or nullptr if either @p
 ///         Schedule, @p Writes are @p Reads is nullptr, or the ISL max
 ///         operations count is exceeded.
-IslPtr<isl_union_map> computeArrayUnused(IslPtr<isl_union_map> Schedule,
-                                         IslPtr<isl_union_map> Writes,
-                                         IslPtr<isl_union_map> Reads,
-                                         bool ReadEltInSameInst,
-                                         bool InclLastRead, bool InclWrite);
+isl::union_map computeArrayUnused(isl::union_map Schedule,
+                                  isl::union_map Writes, isl::union_map Reads,
+                                  bool ReadEltInSameInst, bool InclLastRead,
+                                  bool InclWrite);
 
 /// Convert a zone (range between timepoints) to timepoints.
 ///
@@ -344,8 +336,8 @@ IslPtr<isl_union_map> computeArrayUnused
 /// @param InclEnd   Include timepoints adjacent to the ending of a zone.
 ///
 /// @return { Scatter[] }
-IslPtr<isl_union_set> convertZoneToTimepoints(IslPtr<isl_union_set> Zone,
-                                              bool InclStart, bool InclEnd);
+isl::union_set convertZoneToTimepoints(isl::union_set Zone, bool InclStart,
+                                       bool InclEnd);
 } // namespace polly
 
 #endif /* POLLY_ISLTOOLS_H */

Added: polly/trunk/lib/External/isl/include/isl-noexceptions.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/isl/include/isl-noexceptions.h?rev=297452&view=auto
==============================================================================
--- polly/trunk/lib/External/isl/include/isl-noexceptions.h (added)
+++ polly/trunk/lib/External/isl/include/isl-noexceptions.h Fri Mar 10 05:41:03 2017
@@ -0,0 +1,3137 @@
+/// These are automatically generated C++ bindings for isl.
+///
+///
+/// isl is a library for computing with integer sets and maps described by
+/// Presburger formula. On top of this, isl provides various tools for
+/// Polyhedral compilation ranging from dependence analysis over scheduling
+/// to AST generation.
+///
+///
+/// WARNING: Even though these bindings have been throughly tested and the
+///          design has been reviewed by various members of the isl community,
+///          we do not yet provide any stability guarantees for this interface.
+///          We do not expect any larger changes to the interface, but want to
+///          reserve the freedom to improve the bindings based on insights that
+///          only become visible after shipping these bindings with isl itself.
+
+#ifndef ISL_CPP_NOEXCEPTIONS
+#define ISL_CPP_NOEXCEPTIONS
+
+#include <isl/aff.h>
+#include <isl/ast_build.h>
+#include <isl/flow.h>
+#include <isl/id.h>
+#include <isl/ilp.h>
+#include <isl/map.h>
+#include <isl/schedule.h>
+#include <isl/schedule_node.h>
+#include <isl/set.h>
+#include <isl/union_map.h>
+#include <isl/union_set.h>
+#include <isl/val.h>
+
+#include <functional>
+#include <string>
+
+namespace isl {
+
+inline namespace noexceptions {
+
+// forward declarations
+class aff;
+class ast_build;
+class ast_expr;
+class ast_node;
+class basic_map;
+class basic_set;
+class id;
+class local_space;
+class map;
+class multi_aff;
+class multi_pw_aff;
+class multi_union_pw_aff;
+class multi_val;
+class point;
+class pw_aff;
+class pw_multi_aff;
+class schedule;
+class schedule_constraints;
+class schedule_node;
+class set;
+class space;
+class union_access_info;
+class union_flow;
+class union_map;
+class union_pw_aff;
+class union_pw_multi_aff;
+class union_set;
+class val;
+
+class ctx {
+  isl_ctx *ptr;
+
+public:
+  ctx(isl_ctx *ctx)
+      : ptr(ctx) {}
+  isl_ctx *release() {
+    auto tmp = ptr;
+    ptr = nullptr;
+    return tmp;
+  }
+  isl_ctx *get() {
+    return ptr;
+  }
+};
+
+// declarations for isl::aff
+inline aff manage(__isl_take isl_aff *ptr);
+
+inline aff give(__isl_take isl_aff *ptr);
+
+class aff {
+  friend inline aff manage(__isl_take isl_aff *ptr);
+
+  isl_aff *ptr = nullptr;
+
+  inline explicit aff(__isl_take isl_aff *ptr);
+
+public:
+  inline /* implicit */ aff();
+  inline /* implicit */ aff(const aff &obj);
+  inline /* implicit */ aff(std::nullptr_t);
+  inline aff &operator=(aff obj);
+  inline ~aff();
+  inline __isl_give isl_aff *copy() const &;
+  inline __isl_give isl_aff *copy() && = delete;
+  inline __isl_keep isl_aff *get() const;
+  inline __isl_give isl_aff *release();
+  inline __isl_keep isl_aff *keep() const;
+  inline __isl_give isl_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::ast_build
+inline ast_build manage(__isl_take isl_ast_build *ptr);
+
+inline ast_build give(__isl_take isl_ast_build *ptr);
+
+class ast_build {
+  friend inline ast_build manage(__isl_take isl_ast_build *ptr);
+
+  isl_ast_build *ptr = nullptr;
+
+  inline explicit ast_build(__isl_take isl_ast_build *ptr);
+
+public:
+  inline /* implicit */ ast_build();
+  inline /* implicit */ ast_build(const ast_build &obj);
+  inline /* implicit */ ast_build(std::nullptr_t);
+  inline ast_build &operator=(ast_build obj);
+  inline ~ast_build();
+  inline __isl_give isl_ast_build *copy() const &;
+  inline __isl_give isl_ast_build *copy() && = delete;
+  inline __isl_keep isl_ast_build *get() const;
+  inline __isl_give isl_ast_build *release();
+  inline __isl_keep isl_ast_build *keep() const;
+  inline __isl_give isl_ast_build *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+};
+
+// declarations for isl::ast_expr
+inline ast_expr manage(__isl_take isl_ast_expr *ptr);
+
+inline ast_expr give(__isl_take isl_ast_expr *ptr);
+
+class ast_expr {
+  friend inline ast_expr manage(__isl_take isl_ast_expr *ptr);
+
+  isl_ast_expr *ptr = nullptr;
+
+  inline explicit ast_expr(__isl_take isl_ast_expr *ptr);
+
+public:
+  inline /* implicit */ ast_expr();
+  inline /* implicit */ ast_expr(const ast_expr &obj);
+  inline /* implicit */ ast_expr(std::nullptr_t);
+  inline ast_expr &operator=(ast_expr obj);
+  inline ~ast_expr();
+  inline __isl_give isl_ast_expr *copy() const &;
+  inline __isl_give isl_ast_expr *copy() && = delete;
+  inline __isl_keep isl_ast_expr *get() const;
+  inline __isl_give isl_ast_expr *release();
+  inline __isl_keep isl_ast_expr *keep() const;
+  inline __isl_give isl_ast_expr *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::ast_node
+inline ast_node manage(__isl_take isl_ast_node *ptr);
+
+inline ast_node give(__isl_take isl_ast_node *ptr);
+
+class ast_node {
+  friend inline ast_node manage(__isl_take isl_ast_node *ptr);
+
+  isl_ast_node *ptr = nullptr;
+
+  inline explicit ast_node(__isl_take isl_ast_node *ptr);
+
+public:
+  inline /* implicit */ ast_node();
+  inline /* implicit */ ast_node(const ast_node &obj);
+  inline /* implicit */ ast_node(std::nullptr_t);
+  inline ast_node &operator=(ast_node obj);
+  inline ~ast_node();
+  inline __isl_give isl_ast_node *copy() const &;
+  inline __isl_give isl_ast_node *copy() && = delete;
+  inline __isl_keep isl_ast_node *get() const;
+  inline __isl_give isl_ast_node *release();
+  inline __isl_keep isl_ast_node *keep() const;
+  inline __isl_give isl_ast_node *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::basic_map
+inline basic_map manage(__isl_take isl_basic_map *ptr);
+
+inline basic_map give(__isl_take isl_basic_map *ptr);
+
+class basic_map {
+  friend inline basic_map manage(__isl_take isl_basic_map *ptr);
+
+  isl_basic_map *ptr = nullptr;
+
+  inline explicit basic_map(__isl_take isl_basic_map *ptr);
+
+public:
+  inline /* implicit */ basic_map();
+  inline /* implicit */ basic_map(const basic_map &obj);
+  inline /* implicit */ basic_map(std::nullptr_t);
+  inline basic_map &operator=(basic_map obj);
+  inline ~basic_map();
+  inline __isl_give isl_basic_map *copy() const &;
+  inline __isl_give isl_basic_map *copy() && = delete;
+  inline __isl_keep isl_basic_map *get() const;
+  inline __isl_give isl_basic_map *release();
+  inline __isl_keep isl_basic_map *keep() const;
+  inline __isl_give isl_basic_map *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::basic_set
+inline basic_set manage(__isl_take isl_basic_set *ptr);
+
+inline basic_set give(__isl_take isl_basic_set *ptr);
+
+class basic_set {
+  friend inline basic_set manage(__isl_take isl_basic_set *ptr);
+
+  isl_basic_set *ptr = nullptr;
+
+  inline explicit basic_set(__isl_take isl_basic_set *ptr);
+
+public:
+  inline /* implicit */ basic_set();
+  inline /* implicit */ basic_set(const basic_set &obj);
+  inline /* implicit */ basic_set(std::nullptr_t);
+  inline basic_set &operator=(basic_set obj);
+  inline ~basic_set();
+  inline __isl_give isl_basic_set *copy() const &;
+  inline __isl_give isl_basic_set *copy() && = delete;
+  inline __isl_keep isl_basic_set *get() const;
+  inline __isl_give isl_basic_set *release();
+  inline __isl_keep isl_basic_set *keep() const;
+  inline __isl_give isl_basic_set *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::id
+inline id manage(__isl_take isl_id *ptr);
+
+inline id give(__isl_take isl_id *ptr);
+
+class id {
+  friend inline id manage(__isl_take isl_id *ptr);
+
+  isl_id *ptr = nullptr;
+
+  inline explicit id(__isl_take isl_id *ptr);
+
+public:
+  inline /* implicit */ id();
+  inline /* implicit */ id(const id &obj);
+  inline /* implicit */ id(std::nullptr_t);
+  inline id &operator=(id obj);
+  inline ~id();
+  inline __isl_give isl_id *copy() const &;
+  inline __isl_give isl_id *copy() && = delete;
+  inline __isl_keep isl_id *get() const;
+  inline __isl_give isl_id *release();
+  inline __isl_keep isl_id *keep() const;
+  inline __isl_give isl_id *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::local_space
+inline local_space manage(__isl_take isl_local_space *ptr);
+
+inline local_space give(__isl_take isl_local_space *ptr);
+
+class local_space {
+  friend inline local_space manage(__isl_take isl_local_space *ptr);
+
+  isl_local_space *ptr = nullptr;
+
+  inline explicit local_space(__isl_take isl_local_space *ptr);
+
+public:
+  inline /* implicit */ local_space();
+  inline /* implicit */ local_space(const local_space &obj);
+  inline /* implicit */ local_space(std::nullptr_t);
+  inline local_space &operator=(local_space obj);
+  inline ~local_space();
+  inline __isl_give isl_local_space *copy() const &;
+  inline __isl_give isl_local_space *copy() && = delete;
+  inline __isl_keep isl_local_space *get() const;
+  inline __isl_give isl_local_space *release();
+  inline __isl_keep isl_local_space *keep() const;
+  inline __isl_give isl_local_space *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+};
+
+// declarations for isl::map
+inline map manage(__isl_take isl_map *ptr);
+
+inline map give(__isl_take isl_map *ptr);
+
+class map {
+  friend inline map manage(__isl_take isl_map *ptr);
+
+  isl_map *ptr = nullptr;
+
+  inline explicit map(__isl_take isl_map *ptr);
+
+public:
+  inline /* implicit */ map();
+  inline /* implicit */ map(const map &obj);
+  inline /* implicit */ map(std::nullptr_t);
+  inline map &operator=(map obj);
+  inline ~map();
+  inline __isl_give isl_map *copy() const &;
+  inline __isl_give isl_map *copy() && = delete;
+  inline __isl_keep isl_map *get() const;
+  inline __isl_give isl_map *release();
+  inline __isl_keep isl_map *keep() const;
+  inline __isl_give isl_map *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::multi_aff
+inline multi_aff manage(__isl_take isl_multi_aff *ptr);
+
+inline multi_aff give(__isl_take isl_multi_aff *ptr);
+
+class multi_aff {
+  friend inline multi_aff manage(__isl_take isl_multi_aff *ptr);
+
+  isl_multi_aff *ptr = nullptr;
+
+  inline explicit multi_aff(__isl_take isl_multi_aff *ptr);
+
+public:
+  inline /* implicit */ multi_aff();
+  inline /* implicit */ multi_aff(const multi_aff &obj);
+  inline /* implicit */ multi_aff(std::nullptr_t);
+  inline multi_aff &operator=(multi_aff obj);
+  inline ~multi_aff();
+  inline __isl_give isl_multi_aff *copy() const &;
+  inline __isl_give isl_multi_aff *copy() && = delete;
+  inline __isl_keep isl_multi_aff *get() const;
+  inline __isl_give isl_multi_aff *release();
+  inline __isl_keep isl_multi_aff *keep() const;
+  inline __isl_give isl_multi_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::multi_pw_aff
+inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
+
+inline multi_pw_aff give(__isl_take isl_multi_pw_aff *ptr);
+
+class multi_pw_aff {
+  friend inline multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr);
+
+  isl_multi_pw_aff *ptr = nullptr;
+
+  inline explicit multi_pw_aff(__isl_take isl_multi_pw_aff *ptr);
+
+public:
+  inline /* implicit */ multi_pw_aff();
+  inline /* implicit */ multi_pw_aff(const multi_pw_aff &obj);
+  inline /* implicit */ multi_pw_aff(std::nullptr_t);
+  inline multi_pw_aff &operator=(multi_pw_aff obj);
+  inline ~multi_pw_aff();
+  inline __isl_give isl_multi_pw_aff *copy() const &;
+  inline __isl_give isl_multi_pw_aff *copy() && = delete;
+  inline __isl_keep isl_multi_pw_aff *get() const;
+  inline __isl_give isl_multi_pw_aff *release();
+  inline __isl_keep isl_multi_pw_aff *keep() const;
+  inline __isl_give isl_multi_pw_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::multi_union_pw_aff
+inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
+
+inline multi_union_pw_aff give(__isl_take isl_multi_union_pw_aff *ptr);
+
+class multi_union_pw_aff {
+  friend inline multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr);
+
+  isl_multi_union_pw_aff *ptr = nullptr;
+
+  inline explicit multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr);
+
+public:
+  inline /* implicit */ multi_union_pw_aff();
+  inline /* implicit */ multi_union_pw_aff(const multi_union_pw_aff &obj);
+  inline /* implicit */ multi_union_pw_aff(std::nullptr_t);
+  inline multi_union_pw_aff &operator=(multi_union_pw_aff obj);
+  inline ~multi_union_pw_aff();
+  inline __isl_give isl_multi_union_pw_aff *copy() const &;
+  inline __isl_give isl_multi_union_pw_aff *copy() && = delete;
+  inline __isl_keep isl_multi_union_pw_aff *get() const;
+  inline __isl_give isl_multi_union_pw_aff *release();
+  inline __isl_keep isl_multi_union_pw_aff *keep() const;
+  inline __isl_give isl_multi_union_pw_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::multi_val
+inline multi_val manage(__isl_take isl_multi_val *ptr);
+
+inline multi_val give(__isl_take isl_multi_val *ptr);
+
+class multi_val {
+  friend inline multi_val manage(__isl_take isl_multi_val *ptr);
+
+  isl_multi_val *ptr = nullptr;
+
+  inline explicit multi_val(__isl_take isl_multi_val *ptr);
+
+public:
+  inline /* implicit */ multi_val();
+  inline /* implicit */ multi_val(const multi_val &obj);
+  inline /* implicit */ multi_val(std::nullptr_t);
+  inline multi_val &operator=(multi_val obj);
+  inline ~multi_val();
+  inline __isl_give isl_multi_val *copy() const &;
+  inline __isl_give isl_multi_val *copy() && = delete;
+  inline __isl_keep isl_multi_val *get() const;
+  inline __isl_give isl_multi_val *release();
+  inline __isl_keep isl_multi_val *keep() const;
+  inline __isl_give isl_multi_val *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::point
+inline point manage(__isl_take isl_point *ptr);
+
+inline point give(__isl_take isl_point *ptr);
+
+class point {
+  friend inline point manage(__isl_take isl_point *ptr);
+
+  isl_point *ptr = nullptr;
+
+  inline explicit point(__isl_take isl_point *ptr);
+
+public:
+  inline /* implicit */ point();
+  inline /* implicit */ point(const point &obj);
+  inline /* implicit */ point(std::nullptr_t);
+  inline point &operator=(point obj);
+  inline ~point();
+  inline __isl_give isl_point *copy() const &;
+  inline __isl_give isl_point *copy() && = delete;
+  inline __isl_keep isl_point *get() const;
+  inline __isl_give isl_point *release();
+  inline __isl_keep isl_point *keep() const;
+  inline __isl_give isl_point *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::pw_aff
+inline pw_aff manage(__isl_take isl_pw_aff *ptr);
+
+inline pw_aff give(__isl_take isl_pw_aff *ptr);
+
+class pw_aff {
+  friend inline pw_aff manage(__isl_take isl_pw_aff *ptr);
+
+  isl_pw_aff *ptr = nullptr;
+
+  inline explicit pw_aff(__isl_take isl_pw_aff *ptr);
+
+public:
+  inline /* implicit */ pw_aff();
+  inline /* implicit */ pw_aff(const pw_aff &obj);
+  inline /* implicit */ pw_aff(std::nullptr_t);
+  inline pw_aff &operator=(pw_aff obj);
+  inline ~pw_aff();
+  inline __isl_give isl_pw_aff *copy() const &;
+  inline __isl_give isl_pw_aff *copy() && = delete;
+  inline __isl_keep isl_pw_aff *get() const;
+  inline __isl_give isl_pw_aff *release();
+  inline __isl_keep isl_pw_aff *keep() const;
+  inline __isl_give isl_pw_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::pw_multi_aff
+inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
+
+inline pw_multi_aff give(__isl_take isl_pw_multi_aff *ptr);
+
+class pw_multi_aff {
+  friend inline pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr);
+
+  isl_pw_multi_aff *ptr = nullptr;
+
+  inline explicit pw_multi_aff(__isl_take isl_pw_multi_aff *ptr);
+
+public:
+  inline /* implicit */ pw_multi_aff();
+  inline /* implicit */ pw_multi_aff(const pw_multi_aff &obj);
+  inline /* implicit */ pw_multi_aff(std::nullptr_t);
+  inline pw_multi_aff &operator=(pw_multi_aff obj);
+  inline ~pw_multi_aff();
+  inline __isl_give isl_pw_multi_aff *copy() const &;
+  inline __isl_give isl_pw_multi_aff *copy() && = delete;
+  inline __isl_keep isl_pw_multi_aff *get() const;
+  inline __isl_give isl_pw_multi_aff *release();
+  inline __isl_keep isl_pw_multi_aff *keep() const;
+  inline __isl_give isl_pw_multi_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::schedule
+inline schedule manage(__isl_take isl_schedule *ptr);
+
+inline schedule give(__isl_take isl_schedule *ptr);
+
+class schedule {
+  friend inline schedule manage(__isl_take isl_schedule *ptr);
+
+  isl_schedule *ptr = nullptr;
+
+  inline explicit schedule(__isl_take isl_schedule *ptr);
+
+public:
+  inline /* implicit */ schedule();
+  inline /* implicit */ schedule(const schedule &obj);
+  inline /* implicit */ schedule(std::nullptr_t);
+  inline schedule &operator=(schedule obj);
+  inline ~schedule();
+  inline __isl_give isl_schedule *copy() const &;
+  inline __isl_give isl_schedule *copy() && = delete;
+  inline __isl_keep isl_schedule *get() const;
+  inline __isl_give isl_schedule *release();
+  inline __isl_keep isl_schedule *keep() const;
+  inline __isl_give isl_schedule *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::schedule_constraints
+inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
+
+inline schedule_constraints give(__isl_take isl_schedule_constraints *ptr);
+
+class schedule_constraints {
+  friend inline schedule_constraints manage(__isl_take isl_schedule_constraints *ptr);
+
+  isl_schedule_constraints *ptr = nullptr;
+
+  inline explicit schedule_constraints(__isl_take isl_schedule_constraints *ptr);
+
+public:
+  inline /* implicit */ schedule_constraints();
+  inline /* implicit */ schedule_constraints(const schedule_constraints &obj);
+  inline /* implicit */ schedule_constraints(std::nullptr_t);
+  inline schedule_constraints &operator=(schedule_constraints obj);
+  inline ~schedule_constraints();
+  inline __isl_give isl_schedule_constraints *copy() const &;
+  inline __isl_give isl_schedule_constraints *copy() && = delete;
+  inline __isl_keep isl_schedule_constraints *get() const;
+  inline __isl_give isl_schedule_constraints *release();
+  inline __isl_keep isl_schedule_constraints *keep() const;
+  inline __isl_give isl_schedule_constraints *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::schedule_node
+inline schedule_node manage(__isl_take isl_schedule_node *ptr);
+
+inline schedule_node give(__isl_take isl_schedule_node *ptr);
+
+class schedule_node {
+  friend inline schedule_node manage(__isl_take isl_schedule_node *ptr);
+
+  isl_schedule_node *ptr = nullptr;
+
+  inline explicit schedule_node(__isl_take isl_schedule_node *ptr);
+
+public:
+  inline /* implicit */ schedule_node();
+  inline /* implicit */ schedule_node(const schedule_node &obj);
+  inline /* implicit */ schedule_node(std::nullptr_t);
+  inline schedule_node &operator=(schedule_node obj);
+  inline ~schedule_node();
+  inline __isl_give isl_schedule_node *copy() const &;
+  inline __isl_give isl_schedule_node *copy() && = delete;
+  inline __isl_keep isl_schedule_node *get() const;
+  inline __isl_give isl_schedule_node *release();
+  inline __isl_keep isl_schedule_node *keep() const;
+  inline __isl_give isl_schedule_node *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::set
+inline set manage(__isl_take isl_set *ptr);
+
+inline set give(__isl_take isl_set *ptr);
+
+class set {
+  friend inline set manage(__isl_take isl_set *ptr);
+
+  isl_set *ptr = nullptr;
+
+  inline explicit set(__isl_take isl_set *ptr);
+
+public:
+  inline /* implicit */ set();
+  inline /* implicit */ set(const set &obj);
+  inline /* implicit */ set(std::nullptr_t);
+  inline set &operator=(set obj);
+  inline ~set();
+  inline __isl_give isl_set *copy() const &;
+  inline __isl_give isl_set *copy() && = delete;
+  inline __isl_keep isl_set *get() const;
+  inline __isl_give isl_set *release();
+  inline __isl_keep isl_set *keep() const;
+  inline __isl_give isl_set *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::space
+inline space manage(__isl_take isl_space *ptr);
+
+inline space give(__isl_take isl_space *ptr);
+
+class space {
+  friend inline space manage(__isl_take isl_space *ptr);
+
+  isl_space *ptr = nullptr;
+
+  inline explicit space(__isl_take isl_space *ptr);
+
+public:
+  inline /* implicit */ space();
+  inline /* implicit */ space(const space &obj);
+  inline /* implicit */ space(std::nullptr_t);
+  inline space &operator=(space obj);
+  inline ~space();
+  inline __isl_give isl_space *copy() const &;
+  inline __isl_give isl_space *copy() && = delete;
+  inline __isl_keep isl_space *get() const;
+  inline __isl_give isl_space *release();
+  inline __isl_keep isl_space *keep() const;
+  inline __isl_give isl_space *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::union_access_info
+inline union_access_info manage(__isl_take isl_union_access_info *ptr);
+
+inline union_access_info give(__isl_take isl_union_access_info *ptr);
+
+class union_access_info {
+  friend inline union_access_info manage(__isl_take isl_union_access_info *ptr);
+
+  isl_union_access_info *ptr = nullptr;
+
+  inline explicit union_access_info(__isl_take isl_union_access_info *ptr);
+
+public:
+  inline /* implicit */ union_access_info();
+  inline /* implicit */ union_access_info(const union_access_info &obj);
+  inline /* implicit */ union_access_info(std::nullptr_t);
+  inline union_access_info &operator=(union_access_info obj);
+  inline ~union_access_info();
+  inline __isl_give isl_union_access_info *copy() const &;
+  inline __isl_give isl_union_access_info *copy() && = delete;
+  inline __isl_keep isl_union_access_info *get() const;
+  inline __isl_give isl_union_access_info *release();
+  inline __isl_keep isl_union_access_info *keep() const;
+  inline __isl_give isl_union_access_info *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::union_flow
+inline union_flow manage(__isl_take isl_union_flow *ptr);
+
+inline union_flow give(__isl_take isl_union_flow *ptr);
+
+class union_flow {
+  friend inline union_flow manage(__isl_take isl_union_flow *ptr);
+
+  isl_union_flow *ptr = nullptr;
+
+  inline explicit union_flow(__isl_take isl_union_flow *ptr);
+
+public:
+  inline /* implicit */ union_flow();
+  inline /* implicit */ union_flow(const union_flow &obj);
+  inline /* implicit */ union_flow(std::nullptr_t);
+  inline union_flow &operator=(union_flow obj);
+  inline ~union_flow();
+  inline __isl_give isl_union_flow *copy() const &;
+  inline __isl_give isl_union_flow *copy() && = delete;
+  inline __isl_keep isl_union_flow *get() const;
+  inline __isl_give isl_union_flow *release();
+  inline __isl_keep isl_union_flow *keep() const;
+  inline __isl_give isl_union_flow *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::union_map
+inline union_map manage(__isl_take isl_union_map *ptr);
+
+inline union_map give(__isl_take isl_union_map *ptr);
+
+class union_map {
+  friend inline union_map manage(__isl_take isl_union_map *ptr);
+
+  isl_union_map *ptr = nullptr;
+
+  inline explicit union_map(__isl_take isl_union_map *ptr);
+
+public:
+  inline /* implicit */ union_map();
+  inline /* implicit */ union_map(const union_map &obj);
+  inline /* implicit */ union_map(std::nullptr_t);
+  inline union_map &operator=(union_map obj);
+  inline ~union_map();
+  inline __isl_give isl_union_map *copy() const &;
+  inline __isl_give isl_union_map *copy() && = delete;
+  inline __isl_keep isl_union_map *get() const;
+  inline __isl_give isl_union_map *release();
+  inline __isl_keep isl_union_map *keep() const;
+  inline __isl_give isl_union_map *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::union_pw_aff
+inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
+
+inline union_pw_aff give(__isl_take isl_union_pw_aff *ptr);
+
+class union_pw_aff {
+  friend inline union_pw_aff manage(__isl_take isl_union_pw_aff *ptr);
+
+  isl_union_pw_aff *ptr = nullptr;
+
+  inline explicit union_pw_aff(__isl_take isl_union_pw_aff *ptr);
+
+public:
+  inline /* implicit */ union_pw_aff();
+  inline /* implicit */ union_pw_aff(const union_pw_aff &obj);
+  inline /* implicit */ union_pw_aff(std::nullptr_t);
+  inline union_pw_aff &operator=(union_pw_aff obj);
+  inline ~union_pw_aff();
+  inline __isl_give isl_union_pw_aff *copy() const &;
+  inline __isl_give isl_union_pw_aff *copy() && = delete;
+  inline __isl_keep isl_union_pw_aff *get() const;
+  inline __isl_give isl_union_pw_aff *release();
+  inline __isl_keep isl_union_pw_aff *keep() const;
+  inline __isl_give isl_union_pw_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::union_pw_multi_aff
+inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
+
+inline union_pw_multi_aff give(__isl_take isl_union_pw_multi_aff *ptr);
+
+class union_pw_multi_aff {
+  friend inline union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr);
+
+  isl_union_pw_multi_aff *ptr = nullptr;
+
+  inline explicit union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr);
+
+public:
+  inline /* implicit */ union_pw_multi_aff();
+  inline /* implicit */ union_pw_multi_aff(const union_pw_multi_aff &obj);
+  inline /* implicit */ union_pw_multi_aff(std::nullptr_t);
+  inline union_pw_multi_aff &operator=(union_pw_multi_aff obj);
+  inline ~union_pw_multi_aff();
+  inline __isl_give isl_union_pw_multi_aff *copy() const &;
+  inline __isl_give isl_union_pw_multi_aff *copy() && = delete;
+  inline __isl_keep isl_union_pw_multi_aff *get() const;
+  inline __isl_give isl_union_pw_multi_aff *release();
+  inline __isl_keep isl_union_pw_multi_aff *keep() const;
+  inline __isl_give isl_union_pw_multi_aff *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::union_set
+inline union_set manage(__isl_take isl_union_set *ptr);
+
+inline union_set give(__isl_take isl_union_set *ptr);
+
+class union_set {
+  friend inline union_set manage(__isl_take isl_union_set *ptr);
+
+  isl_union_set *ptr = nullptr;
+
+  inline explicit union_set(__isl_take isl_union_set *ptr);
+
+public:
+  inline /* implicit */ union_set();
+  inline /* implicit */ union_set(const union_set &obj);
+  inline /* implicit */ union_set(std::nullptr_t);
+  inline union_set &operator=(union_set obj);
+  inline ~union_set();
+  inline __isl_give isl_union_set *copy() const &;
+  inline __isl_give isl_union_set *copy() && = delete;
+  inline __isl_keep isl_union_set *get() const;
+  inline __isl_give isl_union_set *release();
+  inline __isl_keep isl_union_set *keep() const;
+  inline __isl_give isl_union_set *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// declarations for isl::val
+inline val manage(__isl_take isl_val *ptr);
+
+inline val give(__isl_take isl_val *ptr);
+
+class val {
+  friend inline val manage(__isl_take isl_val *ptr);
+
+  isl_val *ptr = nullptr;
+
+  inline explicit val(__isl_take isl_val *ptr);
+
+public:
+  inline /* implicit */ val();
+  inline /* implicit */ val(const val &obj);
+  inline /* implicit */ val(std::nullptr_t);
+  inline val &operator=(val obj);
+  inline ~val();
+  inline __isl_give isl_val *copy() const &;
+  inline __isl_give isl_val *copy() && = delete;
+  inline __isl_keep isl_val *get() const;
+  inline __isl_give isl_val *release();
+  inline __isl_keep isl_val *keep() const;
+  inline __isl_give isl_val *take();
+  inline explicit operator bool() const;
+  inline ctx get_ctx() const;
+  inline bool is_null() const;
+  inline std::string to_str() const;
+};
+
+// implementations for isl::aff
+aff manage(__isl_take isl_aff *ptr) {
+  return aff(ptr);
+}
+
+aff give(__isl_take isl_aff *ptr) {
+  return manage(ptr);
+}
+
+aff::aff()
+    : ptr(nullptr) {}
+
+aff::aff(const aff &obj)
+    : ptr(obj.copy()) {}
+
+aff::aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+aff::aff(__isl_take isl_aff *ptr)
+    : ptr(ptr) {}
+
+aff &aff::operator=(aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+aff::~aff() {
+  if (ptr)
+    isl_aff_free(ptr);
+}
+
+__isl_give isl_aff *aff::copy() const & {
+  return isl_aff_copy(ptr);
+}
+
+__isl_keep isl_aff *aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_aff *aff::release() {
+  isl_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_aff *aff::keep() const {
+  return get();
+}
+
+__isl_give isl_aff *aff::take() {
+  return release();
+}
+
+aff::operator bool() const {
+  return !is_null();
+}
+
+ctx aff::get_ctx() const {
+  return ctx(isl_aff_get_ctx(ptr));
+}
+
+bool aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string aff::to_str() const {
+  char *Tmp = isl_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::ast_build
+ast_build manage(__isl_take isl_ast_build *ptr) {
+  return ast_build(ptr);
+}
+
+ast_build give(__isl_take isl_ast_build *ptr) {
+  return manage(ptr);
+}
+
+ast_build::ast_build()
+    : ptr(nullptr) {}
+
+ast_build::ast_build(const ast_build &obj)
+    : ptr(obj.copy()) {}
+
+ast_build::ast_build(std::nullptr_t)
+    : ptr(nullptr) {}
+
+ast_build::ast_build(__isl_take isl_ast_build *ptr)
+    : ptr(ptr) {}
+
+ast_build &ast_build::operator=(ast_build obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+ast_build::~ast_build() {
+  if (ptr)
+    isl_ast_build_free(ptr);
+}
+
+__isl_give isl_ast_build *ast_build::copy() const & {
+  return isl_ast_build_copy(ptr);
+}
+
+__isl_keep isl_ast_build *ast_build::get() const {
+  return ptr;
+}
+
+__isl_give isl_ast_build *ast_build::release() {
+  isl_ast_build *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_ast_build *ast_build::keep() const {
+  return get();
+}
+
+__isl_give isl_ast_build *ast_build::take() {
+  return release();
+}
+
+ast_build::operator bool() const {
+  return !is_null();
+}
+
+ctx ast_build::get_ctx() const {
+  return ctx(isl_ast_build_get_ctx(ptr));
+}
+
+bool ast_build::is_null() const {
+  return ptr == nullptr;
+}
+
+// implementations for isl::ast_expr
+ast_expr manage(__isl_take isl_ast_expr *ptr) {
+  return ast_expr(ptr);
+}
+
+ast_expr give(__isl_take isl_ast_expr *ptr) {
+  return manage(ptr);
+}
+
+ast_expr::ast_expr()
+    : ptr(nullptr) {}
+
+ast_expr::ast_expr(const ast_expr &obj)
+    : ptr(obj.copy()) {}
+
+ast_expr::ast_expr(std::nullptr_t)
+    : ptr(nullptr) {}
+
+ast_expr::ast_expr(__isl_take isl_ast_expr *ptr)
+    : ptr(ptr) {}
+
+ast_expr &ast_expr::operator=(ast_expr obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+ast_expr::~ast_expr() {
+  if (ptr)
+    isl_ast_expr_free(ptr);
+}
+
+__isl_give isl_ast_expr *ast_expr::copy() const & {
+  return isl_ast_expr_copy(ptr);
+}
+
+__isl_keep isl_ast_expr *ast_expr::get() const {
+  return ptr;
+}
+
+__isl_give isl_ast_expr *ast_expr::release() {
+  isl_ast_expr *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_ast_expr *ast_expr::keep() const {
+  return get();
+}
+
+__isl_give isl_ast_expr *ast_expr::take() {
+  return release();
+}
+
+ast_expr::operator bool() const {
+  return !is_null();
+}
+
+ctx ast_expr::get_ctx() const {
+  return ctx(isl_ast_expr_get_ctx(ptr));
+}
+
+bool ast_expr::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string ast_expr::to_str() const {
+  char *Tmp = isl_ast_expr_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const ast_expr &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::ast_node
+ast_node manage(__isl_take isl_ast_node *ptr) {
+  return ast_node(ptr);
+}
+
+ast_node give(__isl_take isl_ast_node *ptr) {
+  return manage(ptr);
+}
+
+ast_node::ast_node()
+    : ptr(nullptr) {}
+
+ast_node::ast_node(const ast_node &obj)
+    : ptr(obj.copy()) {}
+
+ast_node::ast_node(std::nullptr_t)
+    : ptr(nullptr) {}
+
+ast_node::ast_node(__isl_take isl_ast_node *ptr)
+    : ptr(ptr) {}
+
+ast_node &ast_node::operator=(ast_node obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+ast_node::~ast_node() {
+  if (ptr)
+    isl_ast_node_free(ptr);
+}
+
+__isl_give isl_ast_node *ast_node::copy() const & {
+  return isl_ast_node_copy(ptr);
+}
+
+__isl_keep isl_ast_node *ast_node::get() const {
+  return ptr;
+}
+
+__isl_give isl_ast_node *ast_node::release() {
+  isl_ast_node *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_ast_node *ast_node::keep() const {
+  return get();
+}
+
+__isl_give isl_ast_node *ast_node::take() {
+  return release();
+}
+
+ast_node::operator bool() const {
+  return !is_null();
+}
+
+ctx ast_node::get_ctx() const {
+  return ctx(isl_ast_node_get_ctx(ptr));
+}
+
+bool ast_node::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string ast_node::to_str() const {
+  char *Tmp = isl_ast_node_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const ast_node &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::basic_map
+basic_map manage(__isl_take isl_basic_map *ptr) {
+  return basic_map(ptr);
+}
+
+basic_map give(__isl_take isl_basic_map *ptr) {
+  return manage(ptr);
+}
+
+basic_map::basic_map()
+    : ptr(nullptr) {}
+
+basic_map::basic_map(const basic_map &obj)
+    : ptr(obj.copy()) {}
+
+basic_map::basic_map(std::nullptr_t)
+    : ptr(nullptr) {}
+
+basic_map::basic_map(__isl_take isl_basic_map *ptr)
+    : ptr(ptr) {}
+
+basic_map &basic_map::operator=(basic_map obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+basic_map::~basic_map() {
+  if (ptr)
+    isl_basic_map_free(ptr);
+}
+
+__isl_give isl_basic_map *basic_map::copy() const & {
+  return isl_basic_map_copy(ptr);
+}
+
+__isl_keep isl_basic_map *basic_map::get() const {
+  return ptr;
+}
+
+__isl_give isl_basic_map *basic_map::release() {
+  isl_basic_map *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_basic_map *basic_map::keep() const {
+  return get();
+}
+
+__isl_give isl_basic_map *basic_map::take() {
+  return release();
+}
+
+basic_map::operator bool() const {
+  return !is_null();
+}
+
+ctx basic_map::get_ctx() const {
+  return ctx(isl_basic_map_get_ctx(ptr));
+}
+
+bool basic_map::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string basic_map::to_str() const {
+  char *Tmp = isl_basic_map_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const basic_map &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::basic_set
+basic_set manage(__isl_take isl_basic_set *ptr) {
+  return basic_set(ptr);
+}
+
+basic_set give(__isl_take isl_basic_set *ptr) {
+  return manage(ptr);
+}
+
+basic_set::basic_set()
+    : ptr(nullptr) {}
+
+basic_set::basic_set(const basic_set &obj)
+    : ptr(obj.copy()) {}
+
+basic_set::basic_set(std::nullptr_t)
+    : ptr(nullptr) {}
+
+basic_set::basic_set(__isl_take isl_basic_set *ptr)
+    : ptr(ptr) {}
+
+basic_set &basic_set::operator=(basic_set obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+basic_set::~basic_set() {
+  if (ptr)
+    isl_basic_set_free(ptr);
+}
+
+__isl_give isl_basic_set *basic_set::copy() const & {
+  return isl_basic_set_copy(ptr);
+}
+
+__isl_keep isl_basic_set *basic_set::get() const {
+  return ptr;
+}
+
+__isl_give isl_basic_set *basic_set::release() {
+  isl_basic_set *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_basic_set *basic_set::keep() const {
+  return get();
+}
+
+__isl_give isl_basic_set *basic_set::take() {
+  return release();
+}
+
+basic_set::operator bool() const {
+  return !is_null();
+}
+
+ctx basic_set::get_ctx() const {
+  return ctx(isl_basic_set_get_ctx(ptr));
+}
+
+bool basic_set::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string basic_set::to_str() const {
+  char *Tmp = isl_basic_set_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const basic_set &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::id
+id manage(__isl_take isl_id *ptr) {
+  return id(ptr);
+}
+
+id give(__isl_take isl_id *ptr) {
+  return manage(ptr);
+}
+
+id::id()
+    : ptr(nullptr) {}
+
+id::id(const id &obj)
+    : ptr(obj.copy()) {}
+
+id::id(std::nullptr_t)
+    : ptr(nullptr) {}
+
+id::id(__isl_take isl_id *ptr)
+    : ptr(ptr) {}
+
+id &id::operator=(id obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+id::~id() {
+  if (ptr)
+    isl_id_free(ptr);
+}
+
+__isl_give isl_id *id::copy() const & {
+  return isl_id_copy(ptr);
+}
+
+__isl_keep isl_id *id::get() const {
+  return ptr;
+}
+
+__isl_give isl_id *id::release() {
+  isl_id *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_id *id::keep() const {
+  return get();
+}
+
+__isl_give isl_id *id::take() {
+  return release();
+}
+
+id::operator bool() const {
+  return !is_null();
+}
+
+ctx id::get_ctx() const {
+  return ctx(isl_id_get_ctx(ptr));
+}
+
+bool id::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string id::to_str() const {
+  char *Tmp = isl_id_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const id &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::local_space
+local_space manage(__isl_take isl_local_space *ptr) {
+  return local_space(ptr);
+}
+
+local_space give(__isl_take isl_local_space *ptr) {
+  return manage(ptr);
+}
+
+local_space::local_space()
+    : ptr(nullptr) {}
+
+local_space::local_space(const local_space &obj)
+    : ptr(obj.copy()) {}
+
+local_space::local_space(std::nullptr_t)
+    : ptr(nullptr) {}
+
+local_space::local_space(__isl_take isl_local_space *ptr)
+    : ptr(ptr) {}
+
+local_space &local_space::operator=(local_space obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+local_space::~local_space() {
+  if (ptr)
+    isl_local_space_free(ptr);
+}
+
+__isl_give isl_local_space *local_space::copy() const & {
+  return isl_local_space_copy(ptr);
+}
+
+__isl_keep isl_local_space *local_space::get() const {
+  return ptr;
+}
+
+__isl_give isl_local_space *local_space::release() {
+  isl_local_space *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_local_space *local_space::keep() const {
+  return get();
+}
+
+__isl_give isl_local_space *local_space::take() {
+  return release();
+}
+
+local_space::operator bool() const {
+  return !is_null();
+}
+
+ctx local_space::get_ctx() const {
+  return ctx(isl_local_space_get_ctx(ptr));
+}
+
+bool local_space::is_null() const {
+  return ptr == nullptr;
+}
+
+// implementations for isl::map
+map manage(__isl_take isl_map *ptr) {
+  return map(ptr);
+}
+
+map give(__isl_take isl_map *ptr) {
+  return manage(ptr);
+}
+
+map::map()
+    : ptr(nullptr) {}
+
+map::map(const map &obj)
+    : ptr(obj.copy()) {}
+
+map::map(std::nullptr_t)
+    : ptr(nullptr) {}
+
+map::map(__isl_take isl_map *ptr)
+    : ptr(ptr) {}
+
+map &map::operator=(map obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+map::~map() {
+  if (ptr)
+    isl_map_free(ptr);
+}
+
+__isl_give isl_map *map::copy() const & {
+  return isl_map_copy(ptr);
+}
+
+__isl_keep isl_map *map::get() const {
+  return ptr;
+}
+
+__isl_give isl_map *map::release() {
+  isl_map *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_map *map::keep() const {
+  return get();
+}
+
+__isl_give isl_map *map::take() {
+  return release();
+}
+
+map::operator bool() const {
+  return !is_null();
+}
+
+ctx map::get_ctx() const {
+  return ctx(isl_map_get_ctx(ptr));
+}
+
+bool map::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string map::to_str() const {
+  char *Tmp = isl_map_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const map &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::multi_aff
+multi_aff manage(__isl_take isl_multi_aff *ptr) {
+  return multi_aff(ptr);
+}
+
+multi_aff give(__isl_take isl_multi_aff *ptr) {
+  return manage(ptr);
+}
+
+multi_aff::multi_aff()
+    : ptr(nullptr) {}
+
+multi_aff::multi_aff(const multi_aff &obj)
+    : ptr(obj.copy()) {}
+
+multi_aff::multi_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+multi_aff::multi_aff(__isl_take isl_multi_aff *ptr)
+    : ptr(ptr) {}
+
+multi_aff &multi_aff::operator=(multi_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+multi_aff::~multi_aff() {
+  if (ptr)
+    isl_multi_aff_free(ptr);
+}
+
+__isl_give isl_multi_aff *multi_aff::copy() const & {
+  return isl_multi_aff_copy(ptr);
+}
+
+__isl_keep isl_multi_aff *multi_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_multi_aff *multi_aff::release() {
+  isl_multi_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_multi_aff *multi_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_multi_aff *multi_aff::take() {
+  return release();
+}
+
+multi_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx multi_aff::get_ctx() const {
+  return ctx(isl_multi_aff_get_ctx(ptr));
+}
+
+bool multi_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string multi_aff::to_str() const {
+  char *Tmp = isl_multi_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const multi_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::multi_pw_aff
+multi_pw_aff manage(__isl_take isl_multi_pw_aff *ptr) {
+  return multi_pw_aff(ptr);
+}
+
+multi_pw_aff give(__isl_take isl_multi_pw_aff *ptr) {
+  return manage(ptr);
+}
+
+multi_pw_aff::multi_pw_aff()
+    : ptr(nullptr) {}
+
+multi_pw_aff::multi_pw_aff(const multi_pw_aff &obj)
+    : ptr(obj.copy()) {}
+
+multi_pw_aff::multi_pw_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+multi_pw_aff::multi_pw_aff(__isl_take isl_multi_pw_aff *ptr)
+    : ptr(ptr) {}
+
+multi_pw_aff &multi_pw_aff::operator=(multi_pw_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+multi_pw_aff::~multi_pw_aff() {
+  if (ptr)
+    isl_multi_pw_aff_free(ptr);
+}
+
+__isl_give isl_multi_pw_aff *multi_pw_aff::copy() const & {
+  return isl_multi_pw_aff_copy(ptr);
+}
+
+__isl_keep isl_multi_pw_aff *multi_pw_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_multi_pw_aff *multi_pw_aff::release() {
+  isl_multi_pw_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_multi_pw_aff *multi_pw_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_multi_pw_aff *multi_pw_aff::take() {
+  return release();
+}
+
+multi_pw_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx multi_pw_aff::get_ctx() const {
+  return ctx(isl_multi_pw_aff_get_ctx(ptr));
+}
+
+bool multi_pw_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string multi_pw_aff::to_str() const {
+  char *Tmp = isl_multi_pw_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const multi_pw_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::multi_union_pw_aff
+multi_union_pw_aff manage(__isl_take isl_multi_union_pw_aff *ptr) {
+  return multi_union_pw_aff(ptr);
+}
+
+multi_union_pw_aff give(__isl_take isl_multi_union_pw_aff *ptr) {
+  return manage(ptr);
+}
+
+multi_union_pw_aff::multi_union_pw_aff()
+    : ptr(nullptr) {}
+
+multi_union_pw_aff::multi_union_pw_aff(const multi_union_pw_aff &obj)
+    : ptr(obj.copy()) {}
+
+multi_union_pw_aff::multi_union_pw_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+multi_union_pw_aff::multi_union_pw_aff(__isl_take isl_multi_union_pw_aff *ptr)
+    : ptr(ptr) {}
+
+multi_union_pw_aff &multi_union_pw_aff::operator=(multi_union_pw_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+multi_union_pw_aff::~multi_union_pw_aff() {
+  if (ptr)
+    isl_multi_union_pw_aff_free(ptr);
+}
+
+__isl_give isl_multi_union_pw_aff *multi_union_pw_aff::copy() const & {
+  return isl_multi_union_pw_aff_copy(ptr);
+}
+
+__isl_keep isl_multi_union_pw_aff *multi_union_pw_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_multi_union_pw_aff *multi_union_pw_aff::release() {
+  isl_multi_union_pw_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_multi_union_pw_aff *multi_union_pw_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_multi_union_pw_aff *multi_union_pw_aff::take() {
+  return release();
+}
+
+multi_union_pw_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx multi_union_pw_aff::get_ctx() const {
+  return ctx(isl_multi_union_pw_aff_get_ctx(ptr));
+}
+
+bool multi_union_pw_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string multi_union_pw_aff::to_str() const {
+  char *Tmp = isl_multi_union_pw_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const multi_union_pw_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::multi_val
+multi_val manage(__isl_take isl_multi_val *ptr) {
+  return multi_val(ptr);
+}
+
+multi_val give(__isl_take isl_multi_val *ptr) {
+  return manage(ptr);
+}
+
+multi_val::multi_val()
+    : ptr(nullptr) {}
+
+multi_val::multi_val(const multi_val &obj)
+    : ptr(obj.copy()) {}
+
+multi_val::multi_val(std::nullptr_t)
+    : ptr(nullptr) {}
+
+multi_val::multi_val(__isl_take isl_multi_val *ptr)
+    : ptr(ptr) {}
+
+multi_val &multi_val::operator=(multi_val obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+multi_val::~multi_val() {
+  if (ptr)
+    isl_multi_val_free(ptr);
+}
+
+__isl_give isl_multi_val *multi_val::copy() const & {
+  return isl_multi_val_copy(ptr);
+}
+
+__isl_keep isl_multi_val *multi_val::get() const {
+  return ptr;
+}
+
+__isl_give isl_multi_val *multi_val::release() {
+  isl_multi_val *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_multi_val *multi_val::keep() const {
+  return get();
+}
+
+__isl_give isl_multi_val *multi_val::take() {
+  return release();
+}
+
+multi_val::operator bool() const {
+  return !is_null();
+}
+
+ctx multi_val::get_ctx() const {
+  return ctx(isl_multi_val_get_ctx(ptr));
+}
+
+bool multi_val::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string multi_val::to_str() const {
+  char *Tmp = isl_multi_val_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const multi_val &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::point
+point manage(__isl_take isl_point *ptr) {
+  return point(ptr);
+}
+
+point give(__isl_take isl_point *ptr) {
+  return manage(ptr);
+}
+
+point::point()
+    : ptr(nullptr) {}
+
+point::point(const point &obj)
+    : ptr(obj.copy()) {}
+
+point::point(std::nullptr_t)
+    : ptr(nullptr) {}
+
+point::point(__isl_take isl_point *ptr)
+    : ptr(ptr) {}
+
+point &point::operator=(point obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+point::~point() {
+  if (ptr)
+    isl_point_free(ptr);
+}
+
+__isl_give isl_point *point::copy() const & {
+  return isl_point_copy(ptr);
+}
+
+__isl_keep isl_point *point::get() const {
+  return ptr;
+}
+
+__isl_give isl_point *point::release() {
+  isl_point *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_point *point::keep() const {
+  return get();
+}
+
+__isl_give isl_point *point::take() {
+  return release();
+}
+
+point::operator bool() const {
+  return !is_null();
+}
+
+ctx point::get_ctx() const {
+  return ctx(isl_point_get_ctx(ptr));
+}
+
+bool point::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string point::to_str() const {
+  char *Tmp = isl_point_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const point &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::pw_aff
+pw_aff manage(__isl_take isl_pw_aff *ptr) {
+  return pw_aff(ptr);
+}
+
+pw_aff give(__isl_take isl_pw_aff *ptr) {
+  return manage(ptr);
+}
+
+pw_aff::pw_aff()
+    : ptr(nullptr) {}
+
+pw_aff::pw_aff(const pw_aff &obj)
+    : ptr(obj.copy()) {}
+
+pw_aff::pw_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+pw_aff::pw_aff(__isl_take isl_pw_aff *ptr)
+    : ptr(ptr) {}
+
+pw_aff &pw_aff::operator=(pw_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+pw_aff::~pw_aff() {
+  if (ptr)
+    isl_pw_aff_free(ptr);
+}
+
+__isl_give isl_pw_aff *pw_aff::copy() const & {
+  return isl_pw_aff_copy(ptr);
+}
+
+__isl_keep isl_pw_aff *pw_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_pw_aff *pw_aff::release() {
+  isl_pw_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_pw_aff *pw_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_pw_aff *pw_aff::take() {
+  return release();
+}
+
+pw_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx pw_aff::get_ctx() const {
+  return ctx(isl_pw_aff_get_ctx(ptr));
+}
+
+bool pw_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string pw_aff::to_str() const {
+  char *Tmp = isl_pw_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const pw_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::pw_multi_aff
+pw_multi_aff manage(__isl_take isl_pw_multi_aff *ptr) {
+  return pw_multi_aff(ptr);
+}
+
+pw_multi_aff give(__isl_take isl_pw_multi_aff *ptr) {
+  return manage(ptr);
+}
+
+pw_multi_aff::pw_multi_aff()
+    : ptr(nullptr) {}
+
+pw_multi_aff::pw_multi_aff(const pw_multi_aff &obj)
+    : ptr(obj.copy()) {}
+
+pw_multi_aff::pw_multi_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+pw_multi_aff::pw_multi_aff(__isl_take isl_pw_multi_aff *ptr)
+    : ptr(ptr) {}
+
+pw_multi_aff &pw_multi_aff::operator=(pw_multi_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+pw_multi_aff::~pw_multi_aff() {
+  if (ptr)
+    isl_pw_multi_aff_free(ptr);
+}
+
+__isl_give isl_pw_multi_aff *pw_multi_aff::copy() const & {
+  return isl_pw_multi_aff_copy(ptr);
+}
+
+__isl_keep isl_pw_multi_aff *pw_multi_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_pw_multi_aff *pw_multi_aff::release() {
+  isl_pw_multi_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_pw_multi_aff *pw_multi_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_pw_multi_aff *pw_multi_aff::take() {
+  return release();
+}
+
+pw_multi_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx pw_multi_aff::get_ctx() const {
+  return ctx(isl_pw_multi_aff_get_ctx(ptr));
+}
+
+bool pw_multi_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string pw_multi_aff::to_str() const {
+  char *Tmp = isl_pw_multi_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const pw_multi_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::schedule
+schedule manage(__isl_take isl_schedule *ptr) {
+  return schedule(ptr);
+}
+
+schedule give(__isl_take isl_schedule *ptr) {
+  return manage(ptr);
+}
+
+schedule::schedule()
+    : ptr(nullptr) {}
+
+schedule::schedule(const schedule &obj)
+    : ptr(obj.copy()) {}
+
+schedule::schedule(std::nullptr_t)
+    : ptr(nullptr) {}
+
+schedule::schedule(__isl_take isl_schedule *ptr)
+    : ptr(ptr) {}
+
+schedule &schedule::operator=(schedule obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+schedule::~schedule() {
+  if (ptr)
+    isl_schedule_free(ptr);
+}
+
+__isl_give isl_schedule *schedule::copy() const & {
+  return isl_schedule_copy(ptr);
+}
+
+__isl_keep isl_schedule *schedule::get() const {
+  return ptr;
+}
+
+__isl_give isl_schedule *schedule::release() {
+  isl_schedule *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_schedule *schedule::keep() const {
+  return get();
+}
+
+__isl_give isl_schedule *schedule::take() {
+  return release();
+}
+
+schedule::operator bool() const {
+  return !is_null();
+}
+
+ctx schedule::get_ctx() const {
+  return ctx(isl_schedule_get_ctx(ptr));
+}
+
+bool schedule::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string schedule::to_str() const {
+  char *Tmp = isl_schedule_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const schedule &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::schedule_constraints
+schedule_constraints manage(__isl_take isl_schedule_constraints *ptr) {
+  return schedule_constraints(ptr);
+}
+
+schedule_constraints give(__isl_take isl_schedule_constraints *ptr) {
+  return manage(ptr);
+}
+
+schedule_constraints::schedule_constraints()
+    : ptr(nullptr) {}
+
+schedule_constraints::schedule_constraints(const schedule_constraints &obj)
+    : ptr(obj.copy()) {}
+
+schedule_constraints::schedule_constraints(std::nullptr_t)
+    : ptr(nullptr) {}
+
+schedule_constraints::schedule_constraints(__isl_take isl_schedule_constraints *ptr)
+    : ptr(ptr) {}
+
+schedule_constraints &schedule_constraints::operator=(schedule_constraints obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+schedule_constraints::~schedule_constraints() {
+  if (ptr)
+    isl_schedule_constraints_free(ptr);
+}
+
+__isl_give isl_schedule_constraints *schedule_constraints::copy() const & {
+  return isl_schedule_constraints_copy(ptr);
+}
+
+__isl_keep isl_schedule_constraints *schedule_constraints::get() const {
+  return ptr;
+}
+
+__isl_give isl_schedule_constraints *schedule_constraints::release() {
+  isl_schedule_constraints *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_schedule_constraints *schedule_constraints::keep() const {
+  return get();
+}
+
+__isl_give isl_schedule_constraints *schedule_constraints::take() {
+  return release();
+}
+
+schedule_constraints::operator bool() const {
+  return !is_null();
+}
+
+ctx schedule_constraints::get_ctx() const {
+  return ctx(isl_schedule_constraints_get_ctx(ptr));
+}
+
+bool schedule_constraints::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string schedule_constraints::to_str() const {
+  char *Tmp = isl_schedule_constraints_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const schedule_constraints &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::schedule_node
+schedule_node manage(__isl_take isl_schedule_node *ptr) {
+  return schedule_node(ptr);
+}
+
+schedule_node give(__isl_take isl_schedule_node *ptr) {
+  return manage(ptr);
+}
+
+schedule_node::schedule_node()
+    : ptr(nullptr) {}
+
+schedule_node::schedule_node(const schedule_node &obj)
+    : ptr(obj.copy()) {}
+
+schedule_node::schedule_node(std::nullptr_t)
+    : ptr(nullptr) {}
+
+schedule_node::schedule_node(__isl_take isl_schedule_node *ptr)
+    : ptr(ptr) {}
+
+schedule_node &schedule_node::operator=(schedule_node obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+schedule_node::~schedule_node() {
+  if (ptr)
+    isl_schedule_node_free(ptr);
+}
+
+__isl_give isl_schedule_node *schedule_node::copy() const & {
+  return isl_schedule_node_copy(ptr);
+}
+
+__isl_keep isl_schedule_node *schedule_node::get() const {
+  return ptr;
+}
+
+__isl_give isl_schedule_node *schedule_node::release() {
+  isl_schedule_node *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_schedule_node *schedule_node::keep() const {
+  return get();
+}
+
+__isl_give isl_schedule_node *schedule_node::take() {
+  return release();
+}
+
+schedule_node::operator bool() const {
+  return !is_null();
+}
+
+ctx schedule_node::get_ctx() const {
+  return ctx(isl_schedule_node_get_ctx(ptr));
+}
+
+bool schedule_node::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string schedule_node::to_str() const {
+  char *Tmp = isl_schedule_node_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const schedule_node &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::set
+set manage(__isl_take isl_set *ptr) {
+  return set(ptr);
+}
+
+set give(__isl_take isl_set *ptr) {
+  return manage(ptr);
+}
+
+set::set()
+    : ptr(nullptr) {}
+
+set::set(const set &obj)
+    : ptr(obj.copy()) {}
+
+set::set(std::nullptr_t)
+    : ptr(nullptr) {}
+
+set::set(__isl_take isl_set *ptr)
+    : ptr(ptr) {}
+
+set &set::operator=(set obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+set::~set() {
+  if (ptr)
+    isl_set_free(ptr);
+}
+
+__isl_give isl_set *set::copy() const & {
+  return isl_set_copy(ptr);
+}
+
+__isl_keep isl_set *set::get() const {
+  return ptr;
+}
+
+__isl_give isl_set *set::release() {
+  isl_set *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_set *set::keep() const {
+  return get();
+}
+
+__isl_give isl_set *set::take() {
+  return release();
+}
+
+set::operator bool() const {
+  return !is_null();
+}
+
+ctx set::get_ctx() const {
+  return ctx(isl_set_get_ctx(ptr));
+}
+
+bool set::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string set::to_str() const {
+  char *Tmp = isl_set_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const set &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::space
+space manage(__isl_take isl_space *ptr) {
+  return space(ptr);
+}
+
+space give(__isl_take isl_space *ptr) {
+  return manage(ptr);
+}
+
+space::space()
+    : ptr(nullptr) {}
+
+space::space(const space &obj)
+    : ptr(obj.copy()) {}
+
+space::space(std::nullptr_t)
+    : ptr(nullptr) {}
+
+space::space(__isl_take isl_space *ptr)
+    : ptr(ptr) {}
+
+space &space::operator=(space obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+space::~space() {
+  if (ptr)
+    isl_space_free(ptr);
+}
+
+__isl_give isl_space *space::copy() const & {
+  return isl_space_copy(ptr);
+}
+
+__isl_keep isl_space *space::get() const {
+  return ptr;
+}
+
+__isl_give isl_space *space::release() {
+  isl_space *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_space *space::keep() const {
+  return get();
+}
+
+__isl_give isl_space *space::take() {
+  return release();
+}
+
+space::operator bool() const {
+  return !is_null();
+}
+
+ctx space::get_ctx() const {
+  return ctx(isl_space_get_ctx(ptr));
+}
+
+bool space::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string space::to_str() const {
+  char *Tmp = isl_space_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const space &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::union_access_info
+union_access_info manage(__isl_take isl_union_access_info *ptr) {
+  return union_access_info(ptr);
+}
+
+union_access_info give(__isl_take isl_union_access_info *ptr) {
+  return manage(ptr);
+}
+
+union_access_info::union_access_info()
+    : ptr(nullptr) {}
+
+union_access_info::union_access_info(const union_access_info &obj)
+    : ptr(obj.copy()) {}
+
+union_access_info::union_access_info(std::nullptr_t)
+    : ptr(nullptr) {}
+
+union_access_info::union_access_info(__isl_take isl_union_access_info *ptr)
+    : ptr(ptr) {}
+
+union_access_info &union_access_info::operator=(union_access_info obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+union_access_info::~union_access_info() {
+  if (ptr)
+    isl_union_access_info_free(ptr);
+}
+
+__isl_give isl_union_access_info *union_access_info::copy() const & {
+  return isl_union_access_info_copy(ptr);
+}
+
+__isl_keep isl_union_access_info *union_access_info::get() const {
+  return ptr;
+}
+
+__isl_give isl_union_access_info *union_access_info::release() {
+  isl_union_access_info *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_union_access_info *union_access_info::keep() const {
+  return get();
+}
+
+__isl_give isl_union_access_info *union_access_info::take() {
+  return release();
+}
+
+union_access_info::operator bool() const {
+  return !is_null();
+}
+
+ctx union_access_info::get_ctx() const {
+  return ctx(isl_union_access_info_get_ctx(ptr));
+}
+
+bool union_access_info::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string union_access_info::to_str() const {
+  char *Tmp = isl_union_access_info_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const union_access_info &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::union_flow
+union_flow manage(__isl_take isl_union_flow *ptr) {
+  return union_flow(ptr);
+}
+
+union_flow give(__isl_take isl_union_flow *ptr) {
+  return manage(ptr);
+}
+
+union_flow::union_flow()
+    : ptr(nullptr) {}
+
+union_flow::union_flow(const union_flow &obj)
+    : ptr(obj.copy()) {}
+
+union_flow::union_flow(std::nullptr_t)
+    : ptr(nullptr) {}
+
+union_flow::union_flow(__isl_take isl_union_flow *ptr)
+    : ptr(ptr) {}
+
+union_flow &union_flow::operator=(union_flow obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+union_flow::~union_flow() {
+  if (ptr)
+    isl_union_flow_free(ptr);
+}
+
+__isl_give isl_union_flow *union_flow::copy() const & {
+  return isl_union_flow_copy(ptr);
+}
+
+__isl_keep isl_union_flow *union_flow::get() const {
+  return ptr;
+}
+
+__isl_give isl_union_flow *union_flow::release() {
+  isl_union_flow *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_union_flow *union_flow::keep() const {
+  return get();
+}
+
+__isl_give isl_union_flow *union_flow::take() {
+  return release();
+}
+
+union_flow::operator bool() const {
+  return !is_null();
+}
+
+ctx union_flow::get_ctx() const {
+  return ctx(isl_union_flow_get_ctx(ptr));
+}
+
+bool union_flow::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string union_flow::to_str() const {
+  char *Tmp = isl_union_flow_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const union_flow &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::union_map
+union_map manage(__isl_take isl_union_map *ptr) {
+  return union_map(ptr);
+}
+
+union_map give(__isl_take isl_union_map *ptr) {
+  return manage(ptr);
+}
+
+union_map::union_map()
+    : ptr(nullptr) {}
+
+union_map::union_map(const union_map &obj)
+    : ptr(obj.copy()) {}
+
+union_map::union_map(std::nullptr_t)
+    : ptr(nullptr) {}
+
+union_map::union_map(__isl_take isl_union_map *ptr)
+    : ptr(ptr) {}
+
+union_map &union_map::operator=(union_map obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+union_map::~union_map() {
+  if (ptr)
+    isl_union_map_free(ptr);
+}
+
+__isl_give isl_union_map *union_map::copy() const & {
+  return isl_union_map_copy(ptr);
+}
+
+__isl_keep isl_union_map *union_map::get() const {
+  return ptr;
+}
+
+__isl_give isl_union_map *union_map::release() {
+  isl_union_map *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_union_map *union_map::keep() const {
+  return get();
+}
+
+__isl_give isl_union_map *union_map::take() {
+  return release();
+}
+
+union_map::operator bool() const {
+  return !is_null();
+}
+
+ctx union_map::get_ctx() const {
+  return ctx(isl_union_map_get_ctx(ptr));
+}
+
+bool union_map::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string union_map::to_str() const {
+  char *Tmp = isl_union_map_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const union_map &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::union_pw_aff
+union_pw_aff manage(__isl_take isl_union_pw_aff *ptr) {
+  return union_pw_aff(ptr);
+}
+
+union_pw_aff give(__isl_take isl_union_pw_aff *ptr) {
+  return manage(ptr);
+}
+
+union_pw_aff::union_pw_aff()
+    : ptr(nullptr) {}
+
+union_pw_aff::union_pw_aff(const union_pw_aff &obj)
+    : ptr(obj.copy()) {}
+
+union_pw_aff::union_pw_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+union_pw_aff::union_pw_aff(__isl_take isl_union_pw_aff *ptr)
+    : ptr(ptr) {}
+
+union_pw_aff &union_pw_aff::operator=(union_pw_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+union_pw_aff::~union_pw_aff() {
+  if (ptr)
+    isl_union_pw_aff_free(ptr);
+}
+
+__isl_give isl_union_pw_aff *union_pw_aff::copy() const & {
+  return isl_union_pw_aff_copy(ptr);
+}
+
+__isl_keep isl_union_pw_aff *union_pw_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_union_pw_aff *union_pw_aff::release() {
+  isl_union_pw_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_union_pw_aff *union_pw_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_union_pw_aff *union_pw_aff::take() {
+  return release();
+}
+
+union_pw_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx union_pw_aff::get_ctx() const {
+  return ctx(isl_union_pw_aff_get_ctx(ptr));
+}
+
+bool union_pw_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string union_pw_aff::to_str() const {
+  char *Tmp = isl_union_pw_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const union_pw_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::union_pw_multi_aff
+union_pw_multi_aff manage(__isl_take isl_union_pw_multi_aff *ptr) {
+  return union_pw_multi_aff(ptr);
+}
+
+union_pw_multi_aff give(__isl_take isl_union_pw_multi_aff *ptr) {
+  return manage(ptr);
+}
+
+union_pw_multi_aff::union_pw_multi_aff()
+    : ptr(nullptr) {}
+
+union_pw_multi_aff::union_pw_multi_aff(const union_pw_multi_aff &obj)
+    : ptr(obj.copy()) {}
+
+union_pw_multi_aff::union_pw_multi_aff(std::nullptr_t)
+    : ptr(nullptr) {}
+
+union_pw_multi_aff::union_pw_multi_aff(__isl_take isl_union_pw_multi_aff *ptr)
+    : ptr(ptr) {}
+
+union_pw_multi_aff &union_pw_multi_aff::operator=(union_pw_multi_aff obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+union_pw_multi_aff::~union_pw_multi_aff() {
+  if (ptr)
+    isl_union_pw_multi_aff_free(ptr);
+}
+
+__isl_give isl_union_pw_multi_aff *union_pw_multi_aff::copy() const & {
+  return isl_union_pw_multi_aff_copy(ptr);
+}
+
+__isl_keep isl_union_pw_multi_aff *union_pw_multi_aff::get() const {
+  return ptr;
+}
+
+__isl_give isl_union_pw_multi_aff *union_pw_multi_aff::release() {
+  isl_union_pw_multi_aff *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_union_pw_multi_aff *union_pw_multi_aff::keep() const {
+  return get();
+}
+
+__isl_give isl_union_pw_multi_aff *union_pw_multi_aff::take() {
+  return release();
+}
+
+union_pw_multi_aff::operator bool() const {
+  return !is_null();
+}
+
+ctx union_pw_multi_aff::get_ctx() const {
+  return ctx(isl_union_pw_multi_aff_get_ctx(ptr));
+}
+
+bool union_pw_multi_aff::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string union_pw_multi_aff::to_str() const {
+  char *Tmp = isl_union_pw_multi_aff_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const union_pw_multi_aff &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::union_set
+union_set manage(__isl_take isl_union_set *ptr) {
+  return union_set(ptr);
+}
+
+union_set give(__isl_take isl_union_set *ptr) {
+  return manage(ptr);
+}
+
+union_set::union_set()
+    : ptr(nullptr) {}
+
+union_set::union_set(const union_set &obj)
+    : ptr(obj.copy()) {}
+
+union_set::union_set(std::nullptr_t)
+    : ptr(nullptr) {}
+
+union_set::union_set(__isl_take isl_union_set *ptr)
+    : ptr(ptr) {}
+
+union_set &union_set::operator=(union_set obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+union_set::~union_set() {
+  if (ptr)
+    isl_union_set_free(ptr);
+}
+
+__isl_give isl_union_set *union_set::copy() const & {
+  return isl_union_set_copy(ptr);
+}
+
+__isl_keep isl_union_set *union_set::get() const {
+  return ptr;
+}
+
+__isl_give isl_union_set *union_set::release() {
+  isl_union_set *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_union_set *union_set::keep() const {
+  return get();
+}
+
+__isl_give isl_union_set *union_set::take() {
+  return release();
+}
+
+union_set::operator bool() const {
+  return !is_null();
+}
+
+ctx union_set::get_ctx() const {
+  return ctx(isl_union_set_get_ctx(ptr));
+}
+
+bool union_set::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string union_set::to_str() const {
+  char *Tmp = isl_union_set_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const union_set &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+// implementations for isl::val
+val manage(__isl_take isl_val *ptr) {
+  return val(ptr);
+}
+
+val give(__isl_take isl_val *ptr) {
+  return manage(ptr);
+}
+
+val::val()
+    : ptr(nullptr) {}
+
+val::val(const val &obj)
+    : ptr(obj.copy()) {}
+
+val::val(std::nullptr_t)
+    : ptr(nullptr) {}
+
+val::val(__isl_take isl_val *ptr)
+    : ptr(ptr) {}
+
+val &val::operator=(val obj) {
+  std::swap(this->ptr, obj.ptr);
+  return *this;
+}
+
+val::~val() {
+  if (ptr)
+    isl_val_free(ptr);
+}
+
+__isl_give isl_val *val::copy() const & {
+  return isl_val_copy(ptr);
+}
+
+__isl_keep isl_val *val::get() const {
+  return ptr;
+}
+
+__isl_give isl_val *val::release() {
+  isl_val *tmp = ptr;
+  ptr = nullptr;
+  return tmp;
+}
+
+__isl_keep isl_val *val::keep() const {
+  return get();
+}
+
+__isl_give isl_val *val::take() {
+  return release();
+}
+
+val::operator bool() const {
+  return !is_null();
+}
+
+ctx val::get_ctx() const {
+  return ctx(isl_val_get_ctx(ptr));
+}
+
+bool val::is_null() const {
+  return ptr == nullptr;
+}
+
+std::string val::to_str() const {
+  char *Tmp = isl_val_to_str(get());
+  if (!Tmp)
+    return "";
+  std::string S(Tmp);
+  free(Tmp);
+  return S;
+}
+
+inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                                     const val &Obj) {
+  OS << Obj.to_str();
+  return OS;
+}
+
+} // namespace noexceptions
+} // namespace isl
+
+#endif /* ISL_CPP_NOEXCEPTIONS */

Modified: polly/trunk/lib/Support/GICHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/GICHelper.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/lib/Support/GICHelper.cpp (original)
+++ polly/trunk/lib/Support/GICHelper.cpp Fri Mar 10 05:41:03 2017
@@ -204,133 +204,104 @@ std::string polly::getIslCompatibleName(
   return getIslCompatibleName(Prefix, ValStr, Suffix);
 }
 
-#define DEFINE_ISLPTR(TYPE)                                                    \
-  template <> void IslPtr<isl_##TYPE>::dump() const { isl_##TYPE##_dump(Obj); }
-
-namespace polly {
-DEFINE_ISLPTR(id)
-DEFINE_ISLPTR(val)
-DEFINE_ISLPTR(space)
-DEFINE_ISLPTR(basic_map)
-DEFINE_ISLPTR(map)
-DEFINE_ISLPTR(union_map)
-DEFINE_ISLPTR(basic_set)
-DEFINE_ISLPTR(set)
-DEFINE_ISLPTR(union_set)
-DEFINE_ISLPTR(aff)
-DEFINE_ISLPTR(multi_aff)
-DEFINE_ISLPTR(pw_aff)
-DEFINE_ISLPTR(pw_multi_aff)
-DEFINE_ISLPTR(multi_pw_aff)
-DEFINE_ISLPTR(union_pw_aff)
-DEFINE_ISLPTR(multi_union_pw_aff)
-DEFINE_ISLPTR(union_pw_multi_aff)
-} // namespace polly
-
-void polly::foreachElt(const IslPtr<isl_map> &Map,
-                       const std::function<void(IslPtr<isl_basic_map>)> &F) {
+void polly::foreachElt(const isl::map &Map,
+                       const std::function<void(isl::basic_map)> &F) {
   isl_map_foreach_basic_map(
       Map.keep(),
       [](__isl_take isl_basic_map *BMap, void *User) -> isl_stat {
         auto &F =
-            *static_cast<const std::function<void(IslPtr<isl_basic_map>)> *>(
-                User);
+            *static_cast<const std::function<void(isl::basic_map)> *>(User);
         F(give(BMap));
         return isl_stat_ok;
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
-void polly::foreachElt(const IslPtr<isl_set> &Set,
-                       const std::function<void(IslPtr<isl_basic_set>)> &F) {
+void polly::foreachElt(const isl::set &Set,
+                       const std::function<void(isl::basic_set)> &F) {
   isl_set_foreach_basic_set(
       Set.keep(),
       [](__isl_take isl_basic_set *BSet, void *User) -> isl_stat {
         auto &F =
-            *static_cast<const std::function<void(IslPtr<isl_basic_set>)> *>(
-                User);
+            *static_cast<const std::function<void(isl::basic_set)> *>(User);
         F(give(BSet));
         return isl_stat_ok;
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
-void polly::foreachElt(const IslPtr<isl_union_map> &UMap,
-                       const std::function<void(IslPtr<isl_map> Map)> &F) {
+void polly::foreachElt(const isl::union_map &UMap,
+                       const std::function<void(isl::map Map)> &F) {
   isl_union_map_foreach_map(
       UMap.keep(),
       [](__isl_take isl_map *Map, void *User) -> isl_stat {
-        auto &F =
-            *static_cast<const std::function<void(IslPtr<isl_map>)> *>(User);
+        auto &F = *static_cast<const std::function<void(isl::map)> *>(User);
         F(give(Map));
         return isl_stat_ok;
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
-void polly::foreachElt(const IslPtr<isl_union_set> &USet,
-                       const std::function<void(IslPtr<isl_set> Set)> &F) {
+void polly::foreachElt(const isl::union_set &USet,
+                       const std::function<void(isl::set Set)> &F) {
   isl_union_set_foreach_set(
       USet.keep(),
       [](__isl_take isl_set *Set, void *User) -> isl_stat {
-        auto &F =
-            *static_cast<const std::function<void(IslPtr<isl_set>)> *>(User);
+        auto &F = *static_cast<const std::function<void(isl::set)> *>(User);
         F(give(Set));
         return isl_stat_ok;
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
-void polly::foreachElt(const IslPtr<isl_union_pw_aff> &UPwAff,
-                       const std::function<void(IslPtr<isl_pw_aff>)> &F) {
+void polly::foreachElt(const isl::union_pw_aff &UPwAff,
+                       const std::function<void(isl::pw_aff)> &F) {
   isl_union_pw_aff_foreach_pw_aff(
       UPwAff.keep(),
       [](__isl_take isl_pw_aff *PwAff, void *User) -> isl_stat {
-        auto &F =
-            *static_cast<const std::function<void(IslPtr<isl_pw_aff>)> *>(User);
+        auto &F = *static_cast<const std::function<void(isl::pw_aff)> *>(User);
         F(give(PwAff));
         return isl_stat_ok;
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
-isl_stat polly::foreachEltWithBreak(
-    const IslPtr<isl_map> &Map,
-    const std::function<isl_stat(IslPtr<isl_basic_map>)> &F) {
+isl_stat
+polly::foreachEltWithBreak(const isl::map &Map,
+                           const std::function<isl_stat(isl::basic_map)> &F) {
   return isl_map_foreach_basic_map(
       Map.keep(),
       [](__isl_take isl_basic_map *BMap, void *User) -> isl_stat {
-        auto &F = *static_cast<
-            const std::function<isl_stat(IslPtr<isl_basic_map>)> *>(User);
+        auto &F =
+            *static_cast<const std::function<isl_stat(isl::basic_map)> *>(User);
         return F(give(BMap));
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
-isl_stat polly::foreachEltWithBreak(
-    const IslPtr<isl_union_map> &UMap,
-    const std::function<isl_stat(IslPtr<isl_map> Map)> &F) {
+isl_stat
+polly::foreachEltWithBreak(const isl::union_map &UMap,
+                           const std::function<isl_stat(isl::map Map)> &F) {
   return isl_union_map_foreach_map(
       UMap.keep(),
       [](__isl_take isl_map *Map, void *User) -> isl_stat {
         auto &F =
-            *static_cast<const std::function<isl_stat(IslPtr<isl_map> Map)> *>(
-                User);
+            *static_cast<const std::function<isl_stat(isl::map Map)> *>(User);
         return F(give(Map));
       },
       const_cast<void *>(static_cast<const void *>(&F)));
 }
 
 isl_stat polly::foreachPieceWithBreak(
-    const IslPtr<isl_pw_aff> &PwAff,
-    const std::function<isl_stat(IslPtr<isl_set>, IslPtr<isl_aff>)> &F) {
+    const isl::pw_aff &PwAff,
+    const std::function<isl_stat(isl::set, isl::aff)> &F) {
   return isl_pw_aff_foreach_piece(
       PwAff.keep(),
       [](__isl_take isl_set *Domain, __isl_take isl_aff *Aff,
          void *User) -> isl_stat {
-        auto &F = *static_cast<
-            const std::function<isl_stat(IslPtr<isl_set>, IslPtr<isl_aff>)> *>(
-            User);
+        auto &F =
+            *static_cast<const std::function<isl_stat(isl::set, isl::aff)> *>(
+                User);
         return F(give(Domain), give(Aff));
       },
       const_cast<void *>(static_cast<const void *>(&F)));

Modified: polly/trunk/lib/Support/ISLTools.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ISLTools.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/lib/Support/ISLTools.cpp (original)
+++ polly/trunk/lib/Support/ISLTools.cpp Fri Mar 10 05:41:03 2017
@@ -29,8 +29,7 @@ namespace {
 /// @param Amount Value added to the shifted dimension.
 ///
 /// @return An isl_multi_aff for the map with this shifted dimension.
-IslPtr<isl_multi_aff> makeShiftDimAff(IslPtr<isl_space> Space, int Pos,
-                                      int Amount) {
+isl::multi_aff makeShiftDimAff(isl::space Space, int Pos, int Amount) {
   auto Identity = give(isl_multi_aff_identity(Space.take()));
   if (Amount == 0)
     return Identity;
@@ -45,8 +44,8 @@ IslPtr<isl_multi_aff> makeShiftDimAff(Is
 /// @param FromSpace2 { Space2[] }
 ///
 /// @return { [Space1[] -> Space2[]] -> [Space2[] -> Space1[]] }
-IslPtr<isl_basic_map> makeTupleSwapBasicMap(IslPtr<isl_space> FromSpace1,
-                                            IslPtr<isl_space> FromSpace2) {
+isl::basic_map makeTupleSwapBasicMap(isl::space FromSpace1,
+                                     isl::space FromSpace2) {
   assert(isl_space_is_set(FromSpace1.keep()) != isl_bool_false);
   assert(isl_space_is_set(FromSpace2.keep()) != isl_bool_false);
 
@@ -72,69 +71,64 @@ IslPtr<isl_basic_map> makeTupleSwapBasic
   return Result;
 }
 
-/// Like makeTupleSwapBasicMap(IslPtr<isl_space>,IslPtr<isl_space>), but returns
+/// Like makeTupleSwapBasicMap(isl::space,isl::space), but returns
 /// an isl_map.
-IslPtr<isl_map> makeTupleSwapMap(IslPtr<isl_space> FromSpace1,
-                                 IslPtr<isl_space> FromSpace2) {
+isl::map makeTupleSwapMap(isl::space FromSpace1, isl::space FromSpace2) {
   auto BMapResult =
       makeTupleSwapBasicMap(std::move(FromSpace1), std::move(FromSpace2));
   return give(isl_map_from_basic_map(BMapResult.take()));
 }
 } // anonymous namespace
 
-IslPtr<isl_map> polly::beforeScatter(IslPtr<isl_map> Map, bool Strict) {
+isl::map polly::beforeScatter(isl::map Map, bool Strict) {
   auto RangeSpace = give(isl_space_range(isl_map_get_space(Map.keep())));
   auto ScatterRel = give(Strict ? isl_map_lex_gt(RangeSpace.take())
                                 : isl_map_lex_ge(RangeSpace.take()));
   return give(isl_map_apply_range(Map.take(), ScatterRel.take()));
 }
 
-IslPtr<isl_union_map> polly::beforeScatter(IslPtr<isl_union_map> UMap,
-                                           bool Strict) {
+isl::union_map polly::beforeScatter(isl::union_map UMap, bool Strict) {
   auto Result = give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
-  foreachElt(UMap, [=, &Result](IslPtr<isl_map> Map) {
+  foreachElt(UMap, [=, &Result](isl::map Map) {
     auto After = beforeScatter(Map, Strict);
     Result = give(isl_union_map_add_map(Result.take(), After.take()));
   });
   return Result;
 }
 
-IslPtr<isl_map> polly::afterScatter(IslPtr<isl_map> Map, bool Strict) {
+isl::map polly::afterScatter(isl::map Map, bool Strict) {
   auto RangeSpace = give(isl_space_range(isl_map_get_space(Map.keep())));
   auto ScatterRel = give(Strict ? isl_map_lex_lt(RangeSpace.take())
                                 : isl_map_lex_le(RangeSpace.take()));
   return give(isl_map_apply_range(Map.take(), ScatterRel.take()));
 }
 
-IslPtr<isl_union_map> polly::afterScatter(const IslPtr<isl_union_map> &UMap,
-                                          bool Strict) {
+isl::union_map polly::afterScatter(const isl::union_map &UMap, bool Strict) {
   auto Result = give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
-  foreachElt(UMap, [=, &Result](IslPtr<isl_map> Map) {
+  foreachElt(UMap, [=, &Result](isl::map Map) {
     auto After = afterScatter(Map, Strict);
     Result = give(isl_union_map_add_map(Result.take(), After.take()));
   });
   return Result;
 }
 
-IslPtr<isl_map> polly::betweenScatter(IslPtr<isl_map> From, IslPtr<isl_map> To,
-                                      bool InclFrom, bool InclTo) {
+isl::map polly::betweenScatter(isl::map From, isl::map To, bool InclFrom,
+                               bool InclTo) {
   auto AfterFrom = afterScatter(From, !InclFrom);
   auto BeforeTo = beforeScatter(To, !InclTo);
 
   return give(isl_map_intersect(AfterFrom.take(), BeforeTo.take()));
 }
 
-IslPtr<isl_union_map> polly::betweenScatter(IslPtr<isl_union_map> From,
-                                            IslPtr<isl_union_map> To,
-                                            bool InclFrom, bool InclTo) {
+isl::union_map polly::betweenScatter(isl::union_map From, isl::union_map To,
+                                     bool InclFrom, bool InclTo) {
   auto AfterFrom = afterScatter(From, !InclFrom);
   auto BeforeTo = beforeScatter(To, !InclTo);
 
   return give(isl_union_map_intersect(AfterFrom.take(), BeforeTo.take()));
 }
 
-IslPtr<isl_map> polly::singleton(IslPtr<isl_union_map> UMap,
-                                 IslPtr<isl_space> ExpectedSpace) {
+isl::map polly::singleton(isl::union_map UMap, isl::space ExpectedSpace) {
   if (!UMap)
     return nullptr;
 
@@ -148,8 +142,7 @@ IslPtr<isl_map> polly::singleton(IslPtr<
   return Result;
 }
 
-IslPtr<isl_set> polly::singleton(IslPtr<isl_union_set> USet,
-                                 IslPtr<isl_space> ExpectedSpace) {
+isl::set polly::singleton(isl::union_set USet, isl::space ExpectedSpace) {
   if (!USet)
     return nullptr;
 
@@ -163,16 +156,15 @@ IslPtr<isl_set> polly::singleton(IslPtr<
   return Result;
 }
 
-unsigned polly::getNumScatterDims(const IslPtr<isl_union_map> &Schedule) {
+unsigned polly::getNumScatterDims(const isl::union_map &Schedule) {
   unsigned Dims = 0;
-  foreachElt(Schedule, [&Dims](IslPtr<isl_map> Map) {
+  foreachElt(Schedule, [&Dims](isl::map Map) {
     Dims = std::max(Dims, isl_map_dim(Map.keep(), isl_dim_out));
   });
   return Dims;
 }
 
-IslPtr<isl_space>
-polly::getScatterSpace(const IslPtr<isl_union_map> &Schedule) {
+isl::space polly::getScatterSpace(const isl::union_map &Schedule) {
   if (!Schedule)
     return nullptr;
   auto Dims = getNumScatterDims(Schedule);
@@ -181,10 +173,10 @@ polly::getScatterSpace(const IslPtr<isl_
   return give(isl_space_add_dims(ScatterSpace.take(), isl_dim_set, Dims));
 }
 
-IslPtr<isl_union_map> polly::makeIdentityMap(const IslPtr<isl_union_set> &USet,
-                                             bool RestrictDomain) {
+isl::union_map polly::makeIdentityMap(const isl::union_set &USet,
+                                      bool RestrictDomain) {
   auto Result = give(isl_union_map_empty(isl_union_set_get_space(USet.keep())));
-  foreachElt(USet, [=, &Result](IslPtr<isl_set> Set) {
+  foreachElt(USet, [=, &Result](isl::set Set) {
     auto IdentityMap = give(isl_map_identity(
         isl_space_map_from_set(isl_set_get_space(Set.keep()))));
     if (RestrictDomain)
@@ -195,7 +187,7 @@ IslPtr<isl_union_map> polly::makeIdentit
   return Result;
 }
 
-IslPtr<isl_map> polly::reverseDomain(IslPtr<isl_map> Map) {
+isl::map polly::reverseDomain(isl::map Map) {
   auto DomSpace =
       give(isl_space_unwrap(isl_space_domain(isl_map_get_space(Map.keep()))));
   auto Space1 = give(isl_space_domain(DomSpace.copy()));
@@ -204,16 +196,16 @@ IslPtr<isl_map> polly::reverseDomain(Isl
   return give(isl_map_apply_domain(Map.take(), Swap.take()));
 }
 
-IslPtr<isl_union_map> polly::reverseDomain(const IslPtr<isl_union_map> &UMap) {
+isl::union_map polly::reverseDomain(const isl::union_map &UMap) {
   auto Result = give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
-  foreachElt(UMap, [=, &Result](IslPtr<isl_map> Map) {
+  foreachElt(UMap, [=, &Result](isl::map Map) {
     auto Reversed = reverseDomain(std::move(Map));
     Result = give(isl_union_map_add_map(Result.take(), Reversed.take()));
   });
   return Result;
 }
 
-IslPtr<isl_set> polly::shiftDim(IslPtr<isl_set> Set, int Pos, int Amount) {
+isl::set polly::shiftDim(isl::set Set, int Pos, int Amount) {
   int NumDims = isl_set_dim(Set.keep(), isl_dim_set);
   if (Pos < 0)
     Pos = NumDims + Pos;
@@ -225,50 +217,48 @@ IslPtr<isl_set> polly::shiftDim(IslPtr<i
   return give(isl_set_apply(Set.take(), TranslatorMap.take()));
 }
 
-IslPtr<isl_union_set> polly::shiftDim(IslPtr<isl_union_set> USet, int Pos,
-                                      int Amount) {
+isl::union_set polly::shiftDim(isl::union_set USet, int Pos, int Amount) {
   auto Result = give(isl_union_set_empty(isl_union_set_get_space(USet.keep())));
-  foreachElt(USet, [=, &Result](IslPtr<isl_set> Set) {
+  foreachElt(USet, [=, &Result](isl::set Set) {
     auto Shifted = shiftDim(Set, Pos, Amount);
     Result = give(isl_union_set_add_set(Result.take(), Shifted.take()));
   });
   return Result;
 }
 
-void polly::simplify(IslPtr<isl_set> &Set) {
+void polly::simplify(isl::set &Set) {
   Set = give(isl_set_compute_divs(Set.take()));
   Set = give(isl_set_detect_equalities(Set.take()));
   Set = give(isl_set_coalesce(Set.take()));
 }
 
-void polly::simplify(IslPtr<isl_union_set> &USet) {
+void polly::simplify(isl::union_set &USet) {
   USet = give(isl_union_set_compute_divs(USet.take()));
   USet = give(isl_union_set_detect_equalities(USet.take()));
   USet = give(isl_union_set_coalesce(USet.take()));
 }
 
-void polly::simplify(IslPtr<isl_map> &Map) {
+void polly::simplify(isl::map &Map) {
   Map = give(isl_map_compute_divs(Map.take()));
   Map = give(isl_map_detect_equalities(Map.take()));
   Map = give(isl_map_coalesce(Map.take()));
 }
 
-void polly::simplify(IslPtr<isl_union_map> &UMap) {
+void polly::simplify(isl::union_map &UMap) {
   UMap = give(isl_union_map_compute_divs(UMap.take()));
   UMap = give(isl_union_map_detect_equalities(UMap.take()));
   UMap = give(isl_union_map_coalesce(UMap.take()));
 }
 
-IslPtr<isl_union_map>
-polly::computeReachingWrite(IslPtr<isl_union_map> Schedule,
-                            IslPtr<isl_union_map> Writes, bool Reverse,
-                            bool InclPrevDef, bool InclNextDef) {
+isl::union_map polly::computeReachingWrite(isl::union_map Schedule,
+                                           isl::union_map Writes, bool Reverse,
+                                           bool InclPrevDef, bool InclNextDef) {
 
   // { Scatter[] }
   auto ScatterSpace = getScatterSpace(Schedule);
 
   // { ScatterRead[] -> ScatterWrite[] }
-  IslPtr<isl_map> Relation;
+  isl::map Relation;
   if (Reverse)
     Relation = give(InclPrevDef ? isl_map_lex_lt(ScatterSpace.take())
                                 : isl_map_lex_le(ScatterSpace.take()));
@@ -319,12 +309,10 @@ polly::computeReachingWrite(IslPtr<isl_u
   return ReachableWriteDomain;
 }
 
-IslPtr<isl_union_map> polly::computeArrayUnused(IslPtr<isl_union_map> Schedule,
-                                                IslPtr<isl_union_map> Writes,
-                                                IslPtr<isl_union_map> Reads,
-                                                bool ReadEltInSameInst,
-                                                bool IncludeLastRead,
-                                                bool IncludeWrite) {
+isl::union_map
+polly::computeArrayUnused(isl::union_map Schedule, isl::union_map Writes,
+                          isl::union_map Reads, bool ReadEltInSameInst,
+                          bool IncludeLastRead, bool IncludeWrite) {
   // { Element[] -> Scatter[] }
   auto ReadActions =
       give(isl_union_map_apply_domain(Schedule.copy(), Reads.take()));
@@ -366,9 +354,8 @@ IslPtr<isl_union_map> polly::computeArra
       isl_union_map_domain_factor_domain(BetweenLastReadOverwrite.take())));
 }
 
-IslPtr<isl_union_set> polly::convertZoneToTimepoints(IslPtr<isl_union_set> Zone,
-                                                     bool InclStart,
-                                                     bool InclEnd) {
+isl::union_set polly::convertZoneToTimepoints(isl::union_set Zone,
+                                              bool InclStart, bool InclEnd) {
   if (!InclStart && InclEnd)
     return Zone;
 

Modified: polly/trunk/lib/Transform/DeLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeLICM.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeLICM.cpp (original)
+++ polly/trunk/lib/Transform/DeLICM.cpp Fri Mar 10 05:41:03 2017
@@ -254,16 +254,16 @@ public:
   }
 };
 
-IslPtr<isl_union_map> computeReachingDefinition(IslPtr<isl_union_map> Schedule,
-                                                IslPtr<isl_union_map> Writes,
-                                                bool InclDef, bool InclRedef) {
+isl::union_map computeReachingDefinition(isl::union_map Schedule,
+                                         isl::union_map Writes, bool InclDef,
+                                         bool InclRedef) {
   return computeReachingWrite(Schedule, Writes, false, InclDef, InclRedef);
 }
 
-IslPtr<isl_union_map> computeReachingOverwrite(IslPtr<isl_union_map> Schedule,
-                                               IslPtr<isl_union_map> Writes,
-                                               bool InclPrevWrite,
-                                               bool InclOverwrite) {
+isl::union_map computeReachingOverwrite(isl::union_map Schedule,
+                                        isl::union_map Writes,
+                                        bool InclPrevWrite,
+                                        bool InclOverwrite) {
   return computeReachingWrite(Schedule, Writes, true, InclPrevWrite,
                               InclOverwrite);
 }
@@ -281,10 +281,10 @@ IslPtr<isl_union_map> computeReachingOve
 ///                      of the overwrite itself.
 ///
 /// @return { Scatter[] -> DomainDef[] }
-IslPtr<isl_union_map>
-computeScalarReachingOverwrite(IslPtr<isl_union_map> Schedule,
-                               IslPtr<isl_union_set> Writes, bool InclPrevWrite,
-                               bool InclOverwrite) {
+isl::union_map computeScalarReachingOverwrite(isl::union_map Schedule,
+                                              isl::union_set Writes,
+                                              bool InclPrevWrite,
+                                              bool InclOverwrite) {
 
   // { DomainWrite[] }
   auto WritesMap = give(isl_union_map_from_domain(Writes.take()));
@@ -305,10 +305,9 @@ computeScalarReachingOverwrite(IslPtr<is
 /// @param InclOverwrite Include the overwrite to the result.
 ///
 /// @return { Scatter[] -> DomainWrite[] }
-IslPtr<isl_map> computeScalarReachingOverwrite(IslPtr<isl_union_map> Schedule,
-                                               IslPtr<isl_set> Writes,
-                                               bool InclPrevWrite,
-                                               bool InclOverwrite) {
+isl::map computeScalarReachingOverwrite(isl::union_map Schedule,
+                                        isl::set Writes, bool InclPrevWrite,
+                                        bool InclOverwrite) {
   auto ScatterSpace = getScatterSpace(Schedule);
   auto DomSpace = give(isl_set_get_space(Writes.keep()));
 
@@ -333,10 +332,9 @@ IslPtr<isl_map> computeScalarReachingOve
 /// @param InclRedef Include the timepoint of the overwrite into the result.
 ///
 /// @return { Scatter[] -> DomainWrite[] }
-IslPtr<isl_union_map>
-computeScalarReachingDefinition(IslPtr<isl_union_map> Schedule,
-                                IslPtr<isl_union_set> Writes, bool InclDef,
-                                bool InclRedef) {
+isl::union_map computeScalarReachingDefinition(isl::union_map Schedule,
+                                               isl::union_set Writes,
+                                               bool InclDef, bool InclRedef) {
 
   // { DomainWrite[] -> Element[] }
   auto Defs = give(isl_union_map_from_domain(Writes.take()));
@@ -361,9 +359,8 @@ computeScalarReachingDefinition(IslPtr<i
 /// @param InclRedef Include the timepoint of the overwrite into the result.
 ///
 /// @return { Scatter[] -> DomainWrite[] }
-IslPtr<isl_map> computeScalarReachingDefinition( // { Domain[] -> Zone[] }
-    IslPtr<isl_union_map> Schedule, IslPtr<isl_set> Writes, bool InclDef,
-    bool InclRedef) {
+isl::map computeScalarReachingDefinition( // { Domain[] -> Zone[] }
+    isl::union_map Schedule, isl::set Writes, bool InclDef, bool InclRedef) {
   auto DomainSpace = give(isl_set_get_space(Writes.keep()));
   auto ScatterSpace = getScatterSpace(Schedule);
 
@@ -403,8 +400,7 @@ MemoryAccess *getInputAccessOf(Value *In
 /// @return A map with that associates the domain elements of @p Relevant to the
 ///         same elements and in addition the elements of @p Universe to some
 ///         undefined elements. The function prefers to return simple maps.
-IslPtr<isl_union_map> expandMapping(IslPtr<isl_union_map> Relevant,
-                                    IslPtr<isl_union_set> Universe) {
+isl::union_map expandMapping(isl::union_map Relevant, isl::union_set Universe) {
   Relevant = give(isl_union_map_coalesce(Relevant.take()));
   auto RelevantDomain = give(isl_union_map_domain(Relevant.copy()));
   auto Simplified =
@@ -465,18 +461,18 @@ private:
   /// interval and can be converted to sets of timepoints when needed (e.g., in
   /// isConflicting when comparing to the write sets).
   /// @see convertZoneToTimepoints and this file's comment for more details.
-  IslPtr<isl_union_set> Occupied;
+  isl::union_set Occupied;
 
   /// { [Element[] -> Zone[]] }
   /// Set of array elements when they are not alive, i.e. their memory can be
   /// used for other purposed. Can contain a nullptr; in this case the set is
   /// implicitly defined as the complement of #Occupied.
-  IslPtr<isl_union_set> Unused;
+  isl::union_set Unused;
 
   /// { [Element[] -> Scatter[]] }
   /// The write actions currently in the scop or that would be added when
   /// mapping a scalar.
-  IslPtr<isl_union_set> Written;
+  isl::union_set Written;
 
   /// Check whether this Knowledge object is well-formed.
   void checkConsistency() const {
@@ -506,16 +502,15 @@ public:
   Knowledge() {}
 
   /// Create a new object with the given members.
-  Knowledge(IslPtr<isl_union_set> Occupied, IslPtr<isl_union_set> Unused,
-            IslPtr<isl_union_set> Written)
+  Knowledge(isl::union_set Occupied, isl::union_set Unused,
+            isl::union_set Written)
       : Occupied(std::move(Occupied)), Unused(std::move(Unused)),
         Written(std::move(Written)) {
     checkConsistency();
   }
 
   /// Alternative constructor taking isl_sets instead isl_union_sets.
-  Knowledge(IslPtr<isl_set> Occupied, IslPtr<isl_set> Unused,
-            IslPtr<isl_set> Written)
+  Knowledge(isl::set Occupied, isl::set Unused, isl::set Written)
       : Knowledge(give(isl_union_set_from_set(Occupied.take())),
                   give(isl_union_set_from_set(Unused.take())),
                   give(isl_union_set_from_set(Written.take()))) {}
@@ -692,35 +687,35 @@ protected:
   /// Cached reaching definitions for each ScopStmt.
   ///
   /// Use getScalarReachingDefinition() to get its contents.
-  DenseMap<ScopStmt *, IslPtr<isl_map>> ScalarReachDefZone;
+  DenseMap<ScopStmt *, isl::map> ScalarReachDefZone;
 
   /// The analyzed Scop.
   Scop *S;
 
   /// Parameter space that does not need realignment.
-  IslPtr<isl_space> ParamSpace;
+  isl::space ParamSpace;
 
   /// Space the schedule maps to.
-  IslPtr<isl_space> ScatterSpace;
+  isl::space ScatterSpace;
 
   /// Cached version of the schedule and domains.
-  IslPtr<isl_union_map> Schedule;
+  isl::union_map Schedule;
 
   /// Set of all referenced elements.
   /// { Element[] -> Element[] }
-  IslPtr<isl_union_set> AllElements;
+  isl::union_set AllElements;
 
   /// Combined access relations of all MemoryKind::Array READ accesses.
   /// { DomainRead[] -> Element[] }
-  IslPtr<isl_union_map> AllReads;
+  isl::union_map AllReads;
 
   /// Combined access relations of all MemoryKind::Array, MAY_WRITE accesses.
   /// { DomainMayWrite[] -> Element[] }
-  IslPtr<isl_union_map> AllMayWrites;
+  isl::union_map AllMayWrites;
 
   /// Combined access relations of all MemoryKind::Array, MUST_WRITE accesses.
   /// { DomainMustWrite[] -> Element[] }
-  IslPtr<isl_union_map> AllMustWrites;
+  isl::union_map AllMustWrites;
 
   /// Prepare the object before computing the zones of @p S.
   ZoneAlgorithm(Scop *S)
@@ -840,11 +835,11 @@ private:
   }
 
 protected:
-  IslPtr<isl_union_set> makeEmptyUnionSet() {
+  isl::union_set makeEmptyUnionSet() {
     return give(isl_union_set_empty(ParamSpace.copy()));
   }
 
-  IslPtr<isl_union_map> makeEmptyUnionMap() {
+  isl::union_map makeEmptyUnionMap() {
     return give(isl_union_map_empty(ParamSpace.copy()));
   }
 
@@ -860,24 +855,24 @@ protected:
   /// Get the schedule for @p Stmt.
   ///
   /// The domain of the result is as narrow as possible.
-  IslPtr<isl_map> getScatterFor(ScopStmt *Stmt) const {
+  isl::map getScatterFor(ScopStmt *Stmt) const {
     auto ResultSpace = give(isl_space_map_from_domain_and_range(
         Stmt->getDomainSpace(), ScatterSpace.copy()));
     return give(isl_union_map_extract_map(Schedule.keep(), ResultSpace.take()));
   }
 
   /// Get the schedule of @p MA's parent statement.
-  IslPtr<isl_map> getScatterFor(MemoryAccess *MA) const {
+  isl::map getScatterFor(MemoryAccess *MA) const {
     return getScatterFor(MA->getStatement());
   }
 
   /// Get the schedule for the statement instances of @p Domain.
-  IslPtr<isl_union_map> getScatterFor(IslPtr<isl_union_set> Domain) const {
+  isl::union_map getScatterFor(isl::union_set Domain) const {
     return give(isl_union_map_intersect_domain(Schedule.copy(), Domain.take()));
   }
 
   /// Get the schedule for the statement instances of @p Domain.
-  IslPtr<isl_map> getScatterFor(IslPtr<isl_set> Domain) const {
+  isl::map getScatterFor(isl::set Domain) const {
     auto ResultSpace = give(isl_space_map_from_domain_and_range(
         isl_set_get_space(Domain.keep()), ScatterSpace.copy()));
     auto UDomain = give(isl_union_set_from_set(Domain.copy()));
@@ -889,19 +884,19 @@ protected:
   }
 
   /// Get the domain of @p Stmt.
-  IslPtr<isl_set> getDomainFor(ScopStmt *Stmt) const {
+  isl::set getDomainFor(ScopStmt *Stmt) const {
     return give(Stmt->getDomain());
   }
 
   /// Get the domain @p MA's parent statement.
-  IslPtr<isl_set> getDomainFor(MemoryAccess *MA) const {
+  isl::set getDomainFor(MemoryAccess *MA) const {
     return getDomainFor(MA->getStatement());
   }
 
   /// Get the access relation of @p MA.
   ///
   /// The domain of the result is as narrow as possible.
-  IslPtr<isl_map> getAccessRelationFor(MemoryAccess *MA) const {
+  isl::map getAccessRelationFor(MemoryAccess *MA) const {
     auto Domain = getDomainFor(MA);
     auto AccRel = give(MA->getLatestAccessRelation());
     return give(isl_map_intersect_domain(AccRel.take(), Domain.take()));
@@ -915,7 +910,7 @@ protected:
   /// @param Stmt The statement in which a scalar is defined.
   ///
   /// @return { Scatter[] -> DomainDef[] }
-  IslPtr<isl_map> getScalarReachingDefinition(ScopStmt *Stmt) {
+  isl::map getScalarReachingDefinition(ScopStmt *Stmt) {
     auto &Result = ScalarReachDefZone[Stmt];
     if (Result)
       return Result;
@@ -953,7 +948,7 @@ protected:
 
     // { Element[] }
     AllElements = makeEmptyUnionSet();
-    foreachElt(AllWrites, [this](IslPtr<isl_map> Write) {
+    foreachElt(AllWrites, [this](isl::map Write) {
       auto Space = give(isl_map_get_space(Write.keep()));
       auto EltSpace = give(isl_space_range(Space.take()));
       auto EltUniv = give(isl_set_universe(EltSpace.take()));
@@ -1075,7 +1070,7 @@ private:
   /// @return { DomainDef[] -> DomainUse[] }, { DomainDef[] -> Zone[] }
   ///         First element is the set of uses for each definition.
   ///         The second is the lifetime of each definition.
-  std::tuple<IslPtr<isl_union_map>, IslPtr<isl_map>>
+  std::tuple<isl::union_map, isl::map>
   computeValueUses(const ScopArrayInfo *SAI) {
     assert(SAI->isValueKind());
 
@@ -1132,7 +1127,7 @@ private:
   /// @param SAI The ScopArrayInfo representing the PHI's storage.
   ///
   /// @return { DomainPHIRead[] -> DomainPHIWrite[] }
-  IslPtr<isl_union_map> computePerPHI(const ScopArrayInfo *SAI) {
+  isl::union_map computePerPHI(const ScopArrayInfo *SAI) {
     assert(SAI->isPHIKind());
 
     // { DomainPHIWrite[] -> Scatter[] }
@@ -1176,7 +1171,7 @@ private:
   ///                  Suggestion where to map a scalar to when at a timepoint.
   ///
   /// @return true if the scalar was successfully mapped.
-  bool tryMapValue(const ScopArrayInfo *SAI, IslPtr<isl_map> TargetElt) {
+  bool tryMapValue(const ScopArrayInfo *SAI, isl::map TargetElt) {
     assert(SAI->isValueKind());
 
     auto *DefMA = DefUse.getValueDef(SAI);
@@ -1206,10 +1201,10 @@ private:
     }
 
     // { DomainDef[] -> Zone[] }
-    IslPtr<isl_map> Lifetime;
+    isl::map Lifetime;
 
     // { DomainDef[] -> DomainUse[] }
-    IslPtr<isl_union_map> DefUses;
+    isl::union_map DefUses;
 
     std::tie(DefUses, Lifetime) = computeValueUses(SAI);
     DEBUG(dbgs() << "    Lifetime: " << Lifetime << '\n');
@@ -1257,8 +1252,8 @@ private:
   ///                  The lifetime of each llvm::Value definition for
   ///                  reporting.
   /// @param Proposed  Mapping constraints for reporting.
-  void mapValue(const ScopArrayInfo *SAI, IslPtr<isl_map> DefTarget,
-                IslPtr<isl_union_map> UseTarget, IslPtr<isl_map> Lifetime,
+  void mapValue(const ScopArrayInfo *SAI, isl::map DefTarget,
+                isl::union_map UseTarget, isl::map Lifetime,
                 Knowledge Proposed) {
     // Redirect the read accesses.
     for (auto *MA : DefUse.getValueUses(SAI)) {
@@ -1290,7 +1285,7 @@ private:
   ///                  timepoint.
   ///
   /// @return true if the PHI scalar has been mapped.
-  bool tryMapPHI(const ScopArrayInfo *SAI, IslPtr<isl_map> TargetElt) {
+  bool tryMapPHI(const ScopArrayInfo *SAI, isl::map TargetElt) {
     auto *PHIRead = DefUse.getPHIRead(SAI);
     assert(PHIRead->isPHIKind());
     assert(PHIRead->isRead());
@@ -1403,8 +1398,8 @@ private:
   /// @param Lifetime    { DomainRead[] -> Zone[] }
   ///                    The lifetime of each PHI for reporting.
   /// @param Proposed    Mapping constraints for reporting.
-  void mapPHI(const ScopArrayInfo *SAI, IslPtr<isl_map> ReadTarget,
-              IslPtr<isl_union_map> WriteTarget, IslPtr<isl_map> Lifetime,
+  void mapPHI(const ScopArrayInfo *SAI, isl::map ReadTarget,
+              isl::union_map WriteTarget, isl::map Lifetime,
               Knowledge Proposed) {
     // Redirect the PHI incoming writes.
     for (auto *MA : DefUse.getPHIIncomings(SAI)) {
@@ -1550,7 +1545,7 @@ private:
   /// Compute when an array element is unused.
   ///
   /// @return { [Element[] -> Zone[]] }
-  IslPtr<isl_union_set> computeLifetime() const {
+  isl::union_set computeLifetime() const {
     // { Element[] -> Zone[] }
     auto ArrayUnused = computeArrayUnused(Schedule, AllMustWrites, AllReads,
                                           false, false, true);
@@ -1564,7 +1559,7 @@ private:
   /// Determine when an array element is written to.
   ///
   /// @return { [Element[] -> Scatter[]] }
-  IslPtr<isl_union_set> computeWritten() const {
+  isl::union_set computeWritten() const {
     // { WriteDomain[] -> Element[] }
     auto AllWrites =
         give(isl_union_map_union(AllMustWrites.copy(), AllMayWrites.copy()));
@@ -1626,7 +1621,7 @@ public:
     }
 
     DefUse.compute(S);
-    IslPtr<isl_union_set> EltUnused, EltWritten;
+    isl::union_set EltUnused, EltWritten;
 
     {
       IslMaxOperationsGuard MaxOpGuard(IslCtx.get(), DelicmMaxOps);
@@ -1798,13 +1793,13 @@ INITIALIZE_PASS_DEPENDENCY(ScopInfoWrapp
 INITIALIZE_PASS_END(DeLICM, "polly-delicm", "Polly - DeLICM/DePRE", false,
                     false)
 
-bool polly::isConflicting(IslPtr<isl_union_set> ExistingOccupied,
-                          IslPtr<isl_union_set> ExistingUnused,
-                          IslPtr<isl_union_set> ExistingWrites,
-                          IslPtr<isl_union_set> ProposedOccupied,
-                          IslPtr<isl_union_set> ProposedUnused,
-                          IslPtr<isl_union_set> ProposedWrites,
-                          llvm::raw_ostream *OS, unsigned Indent) {
+bool polly::isConflicting(isl::union_set ExistingOccupied,
+                          isl::union_set ExistingUnused,
+                          isl::union_set ExistingWrites,
+                          isl::union_set ProposedOccupied,
+                          isl::union_set ProposedUnused,
+                          isl::union_set ProposedWrites, llvm::raw_ostream *OS,
+                          unsigned Indent) {
   Knowledge Existing(std::move(ExistingOccupied), std::move(ExistingUnused),
                      std::move(ExistingWrites));
   Knowledge Proposed(std::move(ProposedOccupied), std::move(ProposedUnused),

Modified: polly/trunk/lib/Transform/FlattenAlgo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/FlattenAlgo.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/lib/Transform/FlattenAlgo.cpp (original)
+++ polly/trunk/lib/Transform/FlattenAlgo.cpp Fri Mar 10 05:41:03 2017
@@ -24,7 +24,7 @@ namespace {
 /// Whether a dimension of a set is bounded (lower and upper) by a constant,
 /// i.e. there are two constants Min and Max, such that every value x of the
 /// chosen dimensions is Min <= x <= Max.
-bool isDimBoundedByConstant(IslPtr<isl_set> Set, unsigned dim) {
+bool isDimBoundedByConstant(isl::set Set, unsigned dim) {
   auto ParamDims = isl_set_dim(Set.keep(), isl_dim_param);
   Set = give(isl_set_project_out(Set.take(), isl_dim_param, 0, ParamDims));
   Set = give(isl_set_project_out(Set.take(), isl_dim_set, 0, dim));
@@ -37,7 +37,7 @@ bool isDimBoundedByConstant(IslPtr<isl_s
 /// parameters, i.e. there are two expressions Min_p and Max_p of the parameters
 /// p, such that every value x of the chosen dimensions is
 /// Min_p <= x <= Max_p.
-bool isDimBoundedByParameter(IslPtr<isl_set> Set, unsigned dim) {
+bool isDimBoundedByParameter(isl::set Set, unsigned dim) {
   Set = give(isl_set_project_out(Set.take(), isl_dim_set, 0, dim));
   auto SetDims = isl_set_dim(Set.keep(), isl_dim_set);
   Set = give(isl_set_project_out(Set.take(), isl_dim_set, 1, SetDims - 1));
@@ -45,15 +45,15 @@ bool isDimBoundedByParameter(IslPtr<isl_
 }
 
 /// Whether BMap's first out-dimension is not a constant.
-bool isVariableDim(const IslPtr<isl_basic_map> &BMap) {
+bool isVariableDim(const isl::basic_map &BMap) {
   auto FixedVal =
       give(isl_basic_map_plain_get_val_if_fixed(BMap.keep(), isl_dim_out, 0));
   return !FixedVal || isl_val_is_nan(FixedVal.keep());
 }
 
 /// Whether Map's first out dimension is no constant nor piecewise constant.
-bool isVariableDim(const IslPtr<isl_map> &Map) {
-  return foreachEltWithBreak(Map, [](IslPtr<isl_basic_map> BMap) -> isl_stat {
+bool isVariableDim(const isl::map &Map) {
+  return foreachEltWithBreak(Map, [](isl::basic_map BMap) -> isl_stat {
     if (isVariableDim(BMap))
       return isl_stat_error;
     return isl_stat_ok;
@@ -61,8 +61,8 @@ bool isVariableDim(const IslPtr<isl_map>
 }
 
 /// Whether UMap's first out dimension is no (piecewise) constant.
-bool isVariableDim(const IslPtr<isl_union_map> &UMap) {
-  return foreachEltWithBreak(UMap, [](IslPtr<isl_map> Map) -> isl_stat {
+bool isVariableDim(const isl::union_map &UMap) {
+  return foreachEltWithBreak(UMap, [](isl::map Map) -> isl_stat {
     if (isVariableDim(Map))
       return isl_stat_error;
     return isl_stat_ok;
@@ -72,56 +72,54 @@ bool isVariableDim(const IslPtr<isl_unio
 /// If @p PwAff maps to a constant, return said constant. If @p Max/@p Min, it
 /// can also be a piecewise constant and it would return the minimum/maximum
 /// value. Otherwise, return NaN.
-IslPtr<isl_val> getConstant(IslPtr<isl_pw_aff> PwAff, bool Max, bool Min) {
+isl::val getConstant(isl::pw_aff PwAff, bool Max, bool Min) {
   assert(!Max || !Min);
-  IslPtr<isl_val> Result;
-  foreachPieceWithBreak(
-      PwAff, [=, &Result](IslPtr<isl_set> Set, IslPtr<isl_aff> Aff) {
-        if (Result && isl_val_is_nan(Result.keep()))
-          return isl_stat_ok;
-
-        // TODO: If Min/Max, we can also determine a minimum/maximum value if
-        // Set is constant-bounded.
-        if (!isl_aff_is_cst(Aff.keep())) {
-          Result = give(isl_val_nan(Aff.getCtx()));
-          return isl_stat_error;
-        }
-
-        auto ThisVal = give(isl_aff_get_constant_val(Aff.keep()));
-        if (!Result) {
-          Result = ThisVal;
-          return isl_stat_ok;
-        }
-
-        if (isl_val_eq(Result.keep(), ThisVal.keep()))
-          return isl_stat_ok;
-
-        if (Max && isl_val_gt(ThisVal.keep(), Result.keep())) {
-          Result = ThisVal;
-          return isl_stat_ok;
-        }
-
-        if (Min && isl_val_lt(ThisVal.keep(), Result.keep())) {
-          Result = ThisVal;
-          return isl_stat_ok;
-        }
-
-        // Not compatible
-        Result = give(isl_val_nan(Aff.getCtx()));
-        return isl_stat_error;
-      });
+  isl::val Result;
+  foreachPieceWithBreak(PwAff, [=, &Result](isl::set Set, isl::aff Aff) {
+    if (Result && isl_val_is_nan(Result.keep()))
+      return isl_stat_ok;
+
+    // TODO: If Min/Max, we can also determine a minimum/maximum value if
+    // Set is constant-bounded.
+    if (!isl_aff_is_cst(Aff.keep())) {
+      Result = give(isl_val_nan(Aff.get_ctx().get()));
+      return isl_stat_error;
+    }
+
+    auto ThisVal = give(isl_aff_get_constant_val(Aff.keep()));
+    if (!Result) {
+      Result = ThisVal;
+      return isl_stat_ok;
+    }
+
+    if (isl_val_eq(Result.keep(), ThisVal.keep()))
+      return isl_stat_ok;
+
+    if (Max && isl_val_gt(ThisVal.keep(), Result.keep())) {
+      Result = ThisVal;
+      return isl_stat_ok;
+    }
+
+    if (Min && isl_val_lt(ThisVal.keep(), Result.keep())) {
+      Result = ThisVal;
+      return isl_stat_ok;
+    }
+
+    // Not compatible
+    Result = give(isl_val_nan(Aff.get_ctx().get()));
+    return isl_stat_error;
+  });
   return Result;
 }
 
 /// Compute @p UPwAff - @p Val.
-IslPtr<isl_union_pw_aff> subtract(IslPtr<isl_union_pw_aff> UPwAff,
-                                  IslPtr<isl_val> Val) {
+isl::union_pw_aff subtract(isl::union_pw_aff UPwAff, isl::val Val) {
   if (isl_val_is_zero(Val.keep()))
     return UPwAff;
 
   auto Result =
       give(isl_union_pw_aff_empty(isl_union_pw_aff_get_space(UPwAff.keep())));
-  foreachElt(UPwAff, [=, &Result](IslPtr<isl_pw_aff> PwAff) {
+  foreachElt(UPwAff, [=, &Result](isl::pw_aff PwAff) {
     auto ValAff = give(isl_pw_aff_val_on_domain(
         isl_set_universe(isl_space_domain(isl_pw_aff_get_space(PwAff.keep()))),
         Val.copy()));
@@ -133,14 +131,13 @@ IslPtr<isl_union_pw_aff> subtract(IslPtr
 }
 
 /// Compute @UPwAff * @p Val.
-IslPtr<isl_union_pw_aff> multiply(IslPtr<isl_union_pw_aff> UPwAff,
-                                  IslPtr<isl_val> Val) {
+isl::union_pw_aff multiply(isl::union_pw_aff UPwAff, isl::val Val) {
   if (isl_val_is_one(Val.keep()))
     return UPwAff;
 
   auto Result =
       give(isl_union_pw_aff_empty(isl_union_pw_aff_get_space(UPwAff.keep())));
-  foreachElt(UPwAff, [=, &Result](IslPtr<isl_pw_aff> PwAff) {
+  foreachElt(UPwAff, [=, &Result](isl::pw_aff PwAff) {
     auto ValAff = give(isl_pw_aff_val_on_domain(
         isl_set_universe(isl_space_domain(isl_pw_aff_get_space(PwAff.keep()))),
         Val.copy()));
@@ -155,14 +152,14 @@ IslPtr<isl_union_pw_aff> multiply(IslPtr
 ///
 /// It is assumed that all maps in the maps have at least the necessary number
 /// of out dimensions.
-IslPtr<isl_union_map> scheduleProjectOut(const IslPtr<isl_union_map> &UMap,
-                                         unsigned first, unsigned n) {
+isl::union_map scheduleProjectOut(const isl::union_map &UMap, unsigned first,
+                                  unsigned n) {
   if (n == 0)
     return UMap; /* isl_map_project_out would also reset the tuple, which should
                     have no effect on schedule ranges */
 
   auto Result = give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
-  foreachElt(UMap, [=, &Result](IslPtr<isl_map> Map) {
+  foreachElt(UMap, [=, &Result](isl::map Map) {
     auto Outprojected =
         give(isl_map_project_out(Map.take(), isl_dim_out, first, n));
     Result = give(isl_union_map_add_map(Result.take(), Outprojected.take()));
@@ -175,20 +172,19 @@ IslPtr<isl_union_map> scheduleProjectOut
 /// Because this function takes an isl_union_map, the out dimensions could be
 /// different. We return the maximum number in this case. However, a different
 /// number of dimensions is not supported by the other code in this file.
-size_t scheduleScatterDims(const IslPtr<isl_union_map> &Schedule) {
+size_t scheduleScatterDims(const isl::union_map &Schedule) {
   unsigned Dims = 0;
-  foreachElt(Schedule, [&Dims](IslPtr<isl_map> Map) {
+  foreachElt(Schedule, [&Dims](isl::map Map) {
     Dims = std::max(Dims, isl_map_dim(Map.keep(), isl_dim_out));
   });
   return Dims;
 }
 
 /// Return the @p pos' range dimension, converted to an isl_union_pw_aff.
-IslPtr<isl_union_pw_aff> scheduleExtractDimAff(IslPtr<isl_union_map> UMap,
-                                               unsigned pos) {
+isl::union_pw_aff scheduleExtractDimAff(isl::union_map UMap, unsigned pos) {
   auto SingleUMap =
       give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
-  foreachElt(UMap, [=, &SingleUMap](IslPtr<isl_map> Map) {
+  foreachElt(UMap, [=, &SingleUMap](isl::map Map) {
     auto MapDims = isl_map_dim(Map.keep(), isl_dim_out);
     auto SingleMap = give(isl_map_project_out(Map.take(), isl_dim_out, 0, pos));
     SingleMap = give(isl_map_project_out(SingleMap.take(), isl_dim_out, 1,
@@ -222,8 +218,8 @@ IslPtr<isl_union_pw_aff> scheduleExtract
 /// left.
 /// The example schedule would be transformed to:
 ///   { Stmt_X[] -> [X - l_X, ...]; Stmt_B -> [l_X - u_X + 1 + Y - l_Y, ...] }
-IslPtr<isl_union_map> tryFlattenSequence(IslPtr<isl_union_map> Schedule) {
-  auto IslCtx = Schedule.getCtx();
+isl::union_map tryFlattenSequence(isl::union_map Schedule) {
+  auto IslCtx = Schedule.get_ctx();
   auto ScatterSet =
       give(isl_set_from_union_set(isl_union_map_range(Schedule.copy())));
 
@@ -286,7 +282,7 @@ IslPtr<isl_union_map> tryFlattenSequence
     auto PartMax = give(isl_map_dim_max(FirstSubScatterMap.take(), 0));
     auto One = give(isl_pw_aff_val_on_domain(
         isl_set_universe(isl_space_set_from_params(ParamSpace.copy())),
-        isl_val_one(IslCtx)));
+        isl_val_one(IslCtx.get())));
     auto PartLen = give(isl_pw_aff_add(
         isl_pw_aff_add(PartMax.take(), isl_pw_aff_neg(PartMin.copy())),
         One.take()));
@@ -324,7 +320,7 @@ IslPtr<isl_union_map> tryFlattenSequence
 /// actual value of i. Let l_X() the smallest possible value of X and u_X() its
 /// largest value. Then, construct a new schedule
 ///   { Stmt[i] -> [i * (u_X() - l_X() + 1), ...] }
-IslPtr<isl_union_map> tryFlattenLoop(IslPtr<isl_union_map> Schedule) {
+isl::union_map tryFlattenLoop(isl::union_map Schedule) {
   assert(scheduleScatterDims(Schedule) >= 2);
 
   auto Remaining = scheduleProjectOut(Schedule, 0, 1);
@@ -379,7 +375,7 @@ IslPtr<isl_union_map> tryFlattenLoop(Isl
 }
 } // anonymous namespace
 
-IslPtr<isl_union_map> polly::flattenSchedule(IslPtr<isl_union_map> Schedule) {
+isl::union_map polly::flattenSchedule(isl::union_map Schedule) {
   auto Dims = scheduleScatterDims(Schedule);
   DEBUG(dbgs() << "Recursive schedule to process:\n  " << Schedule << "\n");
 

Modified: polly/trunk/lib/Transform/FlattenSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/FlattenSchedule.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/lib/Transform/FlattenSchedule.cpp (original)
+++ polly/trunk/lib/Transform/FlattenSchedule.cpp Fri Mar 10 05:41:03 2017
@@ -27,11 +27,10 @@ namespace {
 /// Print a schedule to @p OS.
 ///
 /// Prints the schedule for each statements on a new line.
-void printSchedule(raw_ostream &OS, const IslPtr<isl_union_map> &Schedule,
+void printSchedule(raw_ostream &OS, const isl::union_map &Schedule,
                    int indent) {
-  foreachElt(Schedule, [&OS, indent](IslPtr<isl_map> Map) {
-    OS.indent(indent) << Map << "\n";
-  });
+  foreachElt(Schedule,
+             [&OS, indent](isl::map Map) { OS.indent(indent) << Map << "\n"; });
 }
 
 /// Flatten the schedule stored in an polly::Scop.
@@ -41,7 +40,7 @@ private:
   const FlattenSchedule &operator=(const FlattenSchedule &) = delete;
 
   std::shared_ptr<isl_ctx> IslCtx;
-  IslPtr<isl_union_map> OldSchedule;
+  isl::union_map OldSchedule;
 
 public:
   static char ID;

Modified: polly/trunk/unittests/DeLICM/DeLICMTest.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/DeLICM/DeLICMTest.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/unittests/DeLICM/DeLICMTest.cpp (original)
+++ polly/trunk/unittests/DeLICM/DeLICMTest.cpp Fri Mar 10 05:41:03 2017
@@ -22,9 +22,9 @@ using namespace polly;
 namespace {
 
 /// Get the universes of all spaces in @p USet.
-IslPtr<isl_union_set> unionSpace(const IslPtr<isl_union_set> &USet) {
+isl::union_set unionSpace(const isl::union_set &USet) {
   auto Result = give(isl_union_set_empty(isl_union_set_get_space(USet.keep())));
-  foreachElt(USet, [=, &Result](IslPtr<isl_set> Set) {
+  foreachElt(USet, [=, &Result](isl::set Set) {
     auto Space = give(isl_set_get_space(Set.keep()));
     auto Universe = give(isl_set_universe(Space.take()));
     Result = give(isl_union_set_add_set(Result.take(), Universe.take()));
@@ -32,9 +32,8 @@ IslPtr<isl_union_set> unionSpace(const I
   return Result;
 }
 
-void completeLifetime(IslPtr<isl_union_set> Universe,
-                      IslPtr<isl_union_set> &Unknown,
-                      IslPtr<isl_union_set> &Undef) {
+void completeLifetime(isl::union_set Universe, isl::union_set &Unknown,
+                      isl::union_set &Undef) {
   if (!Unknown) {
     assert(Undef);
     Unknown = give(isl_union_set_subtract(Universe.copy(), Undef.copy()));
@@ -104,7 +103,7 @@ bool checkIsConflictingNonsymmetric(Know
 
   // Add a space the universe that does not occur anywhere else to ensure
   // robustness. Use &NewId to ensure that this Id is unique.
-  IslPtr<isl_id> NewId = give(isl_id_alloc(Ctx.get(), "Unrelated", &NewId));
+  isl::id NewId = give(isl_id_alloc(Ctx.get(), "Unrelated", &NewId));
   // The space must contains at least one dimension to allow order
   // modifications.
   auto NewSpace = give(isl_space_set_alloc(Ctx.get(), 0, 1));

Modified: polly/trunk/unittests/Isl/IslTest.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/unittests/Isl/IslTest.cpp?rev=297452&r1=297451&r2=297452&view=diff
==============================================================================
--- polly/trunk/unittests/Isl/IslTest.cpp (original)
+++ polly/trunk/unittests/Isl/IslTest.cpp Fri Mar 10 05:41:03 2017
@@ -16,11 +16,11 @@
 using namespace llvm;
 using namespace polly;
 
-static IslPtr<isl_space> parseSpace(isl_ctx *Ctx, const char *Str) {
+static isl::space parseSpace(isl_ctx *Ctx, const char *Str) {
   isl_stream *Stream = isl_stream_new_str(Ctx, Str);
   auto Obj = isl_stream_read_obj(Stream);
 
-  IslPtr<isl_space> Result;
+  isl::space Result;
   if (Obj.type == isl_obj_set)
     Result = give(isl_set_get_space(static_cast<isl_set *>(Obj.v)));
   else if (Obj.type == isl_obj_map)
@@ -40,38 +40,40 @@ static IslPtr<isl_space> parseSpace(isl_
 #define USET(Str) give(isl_union_set_read_from_str(Ctx.get(), Str))
 #define UMAP(Str) give(isl_union_map_read_from_str(Ctx.get(), Str))
 
-static bool operator==(const IslPtr<isl_space> &LHS,
-                       const IslPtr<isl_space> &RHS) {
+namespace isl {
+inline namespace noexceptions {
+
+static bool operator==(const isl::space &LHS, const isl::space &RHS) {
   auto IsEqual = isl_space_is_equal(LHS.keep(), RHS.keep());
   EXPECT_NE(isl_bool_error, IsEqual);
   return IsEqual;
 }
 
-static bool operator==(const IslPtr<isl_set> &LHS, const IslPtr<isl_set> &RHS) {
+static bool operator==(const isl::set &LHS, const isl::set &RHS) {
   auto IsEqual = isl_set_is_equal(LHS.keep(), RHS.keep());
   EXPECT_NE(isl_bool_error, IsEqual);
   return IsEqual;
 }
 
-static bool operator==(const IslPtr<isl_map> &LHS, const IslPtr<isl_map> &RHS) {
+static bool operator==(const isl::map &LHS, const isl::map &RHS) {
   auto IsEqual = isl_map_is_equal(LHS.keep(), RHS.keep());
   EXPECT_NE(isl_bool_error, IsEqual);
   return IsEqual;
 }
 
-static bool operator==(const IslPtr<isl_union_set> &LHS,
-                       const IslPtr<isl_union_set> &RHS) {
+static bool operator==(const isl::union_set &LHS, const isl::union_set &RHS) {
   auto IsEqual = isl_union_set_is_equal(LHS.keep(), RHS.keep());
   EXPECT_NE(isl_bool_error, IsEqual);
   return IsEqual;
 }
 
-static bool operator==(const IslPtr<isl_union_map> &LHS,
-                       const IslPtr<isl_union_map> &RHS) {
+static bool operator==(const isl::union_map &LHS, const isl::union_map &RHS) {
   auto IsEqual = isl_union_map_is_equal(LHS.keep(), RHS.keep());
   EXPECT_NE(isl_bool_error, IsEqual);
   return IsEqual;
 }
+} // namespace noexceptions
+} // namespace isl
 
 namespace {
 
@@ -310,7 +312,7 @@ TEST(Isl, Foreach) {
 
   {
     auto NumBMaps = 0;
-    foreachElt(TestMap, [&](IslPtr<isl_basic_map> BMap) {
+    foreachElt(TestMap, [&](isl::basic_map BMap) {
       EXPECT_EQ(isl_bool_true,
                 isl_basic_map_is_equal(BMap.keep(), TestBMap.keep()));
       NumBMaps++;
@@ -320,7 +322,7 @@ TEST(Isl, Foreach) {
 
   {
     auto NumBSets = 0;
-    foreachElt(TestSet, [&](IslPtr<isl_basic_set> BSet) {
+    foreachElt(TestSet, [&](isl::basic_set BSet) {
       EXPECT_EQ(isl_bool_true,
                 isl_basic_set_is_equal(BSet.keep(), TestBSet.keep()));
       NumBSets++;
@@ -330,7 +332,7 @@ TEST(Isl, Foreach) {
 
   {
     auto NumMaps = 0;
-    foreachElt(TestUMap, [&](IslPtr<isl_map> Map) {
+    foreachElt(TestUMap, [&](isl::map Map) {
       EXPECT_EQ(isl_bool_true, isl_map_is_equal(Map.keep(), TestMap.keep()));
       NumMaps++;
     });
@@ -339,7 +341,7 @@ TEST(Isl, Foreach) {
 
   {
     auto NumSets = 0;
-    foreachElt(TestUSet, [&](IslPtr<isl_set> Set) {
+    foreachElt(TestUSet, [&](isl::set Set) {
       EXPECT_EQ(isl_bool_true, isl_set_is_equal(Set.keep(), TestSet.keep()));
       NumSets++;
     });
@@ -350,7 +352,7 @@ TEST(Isl, Foreach) {
     auto UPwAff = give(isl_union_pw_aff_val_on_domain(TestUSet.copy(),
                                                       isl_val_zero(Ctx.get())));
     auto NumPwAffs = 0;
-    foreachElt(UPwAff, [&](IslPtr<isl_pw_aff> PwAff) {
+    foreachElt(UPwAff, [&](isl::pw_aff PwAff) {
       EXPECT_EQ(isl_bool_true, isl_pw_aff_is_cst(PwAff.keep()));
       NumPwAffs++;
     });
@@ -359,27 +361,26 @@ TEST(Isl, Foreach) {
 
   {
     auto NumBMaps = 0;
-    EXPECT_EQ(isl_stat_error,
-              foreachEltWithBreak(
-                  TestMap, [&](IslPtr<isl_basic_map> BMap) -> isl_stat {
-                    EXPECT_EQ(isl_bool_true, isl_basic_map_is_equal(
-                                                 BMap.keep(), TestBMap.keep()));
-                    NumBMaps++;
-                    return isl_stat_error;
-                  }));
-    EXPECT_EQ(1, NumBMaps);
-  }
-
-  {
-    auto NumMaps = 0;
     EXPECT_EQ(
         isl_stat_error,
-        foreachEltWithBreak(TestUMap, [&](IslPtr<isl_map> Map) -> isl_stat {
+        foreachEltWithBreak(TestMap, [&](isl::basic_map BMap) -> isl_stat {
           EXPECT_EQ(isl_bool_true,
-                    isl_map_is_equal(Map.keep(), TestMap.keep()));
-          NumMaps++;
+                    isl_basic_map_is_equal(BMap.keep(), TestBMap.keep()));
+          NumBMaps++;
           return isl_stat_error;
         }));
+    EXPECT_EQ(1, NumBMaps);
+  }
+
+  {
+    auto NumMaps = 0;
+    EXPECT_EQ(isl_stat_error,
+              foreachEltWithBreak(TestUMap, [&](isl::map Map) -> isl_stat {
+                EXPECT_EQ(isl_bool_true,
+                          isl_map_is_equal(Map.keep(), TestMap.keep()));
+                NumMaps++;
+                return isl_stat_error;
+              }));
     EXPECT_EQ(1, NumMaps);
   }
 
@@ -388,8 +389,7 @@ TEST(Isl, Foreach) {
         give(isl_pw_aff_val_on_domain(TestSet.copy(), isl_val_zero(Ctx.get())));
     auto NumPieces = 0;
     foreachPieceWithBreak(
-        TestPwAff,
-        [&](IslPtr<isl_set> Domain, IslPtr<isl_aff> Aff) -> isl_stat {
+        TestPwAff, [&](isl::set Domain, isl::aff Aff) -> isl_stat {
           EXPECT_EQ(isl_bool_true,
                     isl_set_is_equal(Domain.keep(), TestSet.keep()));
           EXPECT_EQ(isl_bool_true, isl_aff_is_cst(Aff.keep()));




More information about the llvm-commits mailing list