[polly] r282870 - [Support] Add (Nonowning-)IslPtr::dump(). NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 09:10:19 PDT 2016


Author: meinersbur
Date: Fri Sep 30 11:10:19 2016
New Revision: 282870

URL: http://llvm.org/viewvc/llvm-project?rev=282870&view=rev
Log:
[Support] Add (Nonowning-)IslPtr::dump(). NFC.

The dump() methods can be called from a debugger instead of e.g.

    isl_*_dump(Var.Obj)

where Var is a variable of type IslPtr/NonowningIslPtr. To ensure that the
existence of the function pointers do not depdend on whether the methods are
used somwhere, they are declared with external linkage.

Modified:
    polly/trunk/include/polly/Support/GICHelper.h
    polly/trunk/lib/Support/GICHelper.cpp

Modified: polly/trunk/include/polly/Support/GICHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/GICHelper.h?rev=282870&r1=282869&r2=282870&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/GICHelper.h (original)
+++ polly/trunk/include/polly/Support/GICHelper.h Fri Sep 30 11:10:19 2016
@@ -291,6 +291,16 @@ public:
 
   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) {
@@ -338,6 +348,11 @@ public:
 
   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.
+  ///
+  /// @see IslPtr<T>::dump()
+  void dump() const;
 };
 
 template <typename T>

Modified: polly/trunk/lib/Support/GICHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/GICHelper.cpp?rev=282870&r1=282869&r2=282870&view=diff
==============================================================================
--- polly/trunk/lib/Support/GICHelper.cpp (original)
+++ polly/trunk/lib/Support/GICHelper.cpp Fri Sep 30 11:10:19 2016
@@ -199,6 +199,28 @@ std::string polly::getIslCompatibleName(
   return getIslCompatibleName(Prefix, ValStr, Suffix);
 }
 
+#define DEFINE_ISLPTR(TYPE)                                                    \
+  template <> void polly::IslPtr<isl_##TYPE>::dump() const {                   \
+    isl_##TYPE##_dump(Obj);                                                    \
+  }                                                                            \
+  template <> void polly::NonowningIslPtr<isl_##TYPE>::dump() const {          \
+    isl_##TYPE##_dump(Obj);                                                    \
+  }
+
+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(pw_aff)
+// DEFINE_ISLPTR(union_pw_aff) /* There is no isl_union_pw_aff_dump() */
+DEFINE_ISLPTR(multi_union_pw_aff)
+DEFINE_ISLPTR(union_pw_multi_aff)
+
 void polly::foreachElt(NonowningIslPtr<isl_union_map> UMap,
                        const std::function<void(IslPtr<isl_map> Map)> &F) {
   isl_union_map_foreach_map(




More information about the llvm-commits mailing list