[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.

llvm-svn: 282870
This commit is contained in:
Michael Kruse 2016-09-30 16:10:19 +00:00
parent 64bf0509f6
commit 55519dad62
2 changed files with 37 additions and 0 deletions

View File

@ -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>

View File

@ -199,6 +199,28 @@ std::string polly::getIslCompatibleName(const std::string &Prefix,
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(