[Polly] Do not inline dumpIslObj methods. NFC.

Instead of being inline and having a neverCalled() workaround to make it
work in the debugger, define it as a regular exported function.

Also add overloads for the C API types isl_* so it works with managed as
well as unmanaged ISL objects.
This commit is contained in:
Michael Kruse 2021-10-12 22:17:01 -05:00
parent a5de04d261
commit ec2029f986
2 changed files with 49 additions and 48 deletions

View File

@ -186,10 +186,13 @@ ISL_OBJECT_TO_STRING(union_pw_aff)
ISL_OBJECT_TO_STRING(union_pw_multi_aff)
//@}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// C++ wrapper for isl_*_dump() functions.
//@{
#define ISL_DUMP_OBJECT(name) \
inline void dumpIslObj(const isl::name &Obj) { isl_##name##_dump(Obj.get()); }
void dumpIslObj(const isl::name &Obj); \
void dumpIslObj(isl_##name *Obj);
ISL_DUMP_OBJECT(aff)
ISL_DUMP_OBJECT(aff_list)
@ -236,6 +239,7 @@ ISL_DUMP_OBJECT(val_list)
void dumpIslObj(const isl::schedule_node &Node, llvm::raw_ostream &OS);
void dumpIslObj(__isl_keep isl_schedule_node *node, llvm::raw_ostream &OS);
/// @}
#endif
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
__isl_keep isl_union_map *Map) {

View File

@ -191,53 +191,50 @@ std::string polly::getIslCompatibleName(const std::string &Prefix,
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// To call a inline dump() method in a debugger, at it must have been
/// instantiated in at least one translation unit. Because isl's dump() method
/// are meant to be called from a debugger only, but not from code, no such
/// instantiation would exist. We use this method to force an instantiation in
/// this translation unit. Because it has non-static linking, the compiler does
/// not know that it is never called, and therefore must ensure the existence of
/// the dump functions.
void neverCalled() {
polly::dumpIslObj(isl::aff());
polly::dumpIslObj(isl::aff_list());
polly::dumpIslObj(isl::ast_expr());
polly::dumpIslObj(isl::ast_node());
polly::dumpIslObj(isl::ast_node_list());
polly::dumpIslObj(isl::basic_map());
polly::dumpIslObj(isl::basic_map_list());
polly::dumpIslObj(isl::basic_set());
polly::dumpIslObj(isl::basic_set_list());
polly::dumpIslObj(isl::constraint());
polly::dumpIslObj(isl::id());
polly::dumpIslObj(isl::id_list());
polly::dumpIslObj(isl::id_to_ast_expr());
polly::dumpIslObj(isl::local_space());
polly::dumpIslObj(isl::map());
polly::dumpIslObj(isl::map_list());
polly::dumpIslObj(isl::multi_aff());
polly::dumpIslObj(isl::multi_pw_aff());
polly::dumpIslObj(isl::multi_union_pw_aff());
polly::dumpIslObj(isl::multi_val());
polly::dumpIslObj(isl::point());
polly::dumpIslObj(isl::pw_aff());
polly::dumpIslObj(isl::pw_aff_list());
polly::dumpIslObj(isl::pw_multi_aff());
polly::dumpIslObj(isl::schedule());
polly::dumpIslObj(isl::schedule_constraints());
polly::dumpIslObj(isl::schedule_node());
polly::dumpIslObj(isl::set());
polly::dumpIslObj(isl::set_list());
polly::dumpIslObj(isl::space());
polly::dumpIslObj(isl::union_map());
polly::dumpIslObj(isl::union_pw_aff());
polly::dumpIslObj(isl::union_pw_aff_list());
polly::dumpIslObj(isl::union_pw_multi_aff());
polly::dumpIslObj(isl::union_set());
polly::dumpIslObj(isl::union_set_list());
polly::dumpIslObj(isl::val());
polly::dumpIslObj(isl::val_list());
}
#define ISL_DUMP_OBJECT_IMPL(NAME) \
void polly::dumpIslObj(const isl::NAME &Obj) { \
isl_##NAME##_dump(Obj.get()); \
} \
void polly::dumpIslObj(isl_##NAME *Obj) { isl_##NAME##_dump(Obj); }
ISL_DUMP_OBJECT_IMPL(aff)
ISL_DUMP_OBJECT_IMPL(aff_list)
ISL_DUMP_OBJECT_IMPL(ast_expr)
ISL_DUMP_OBJECT_IMPL(ast_node)
ISL_DUMP_OBJECT_IMPL(ast_node_list)
ISL_DUMP_OBJECT_IMPL(basic_map)
ISL_DUMP_OBJECT_IMPL(basic_map_list)
ISL_DUMP_OBJECT_IMPL(basic_set)
ISL_DUMP_OBJECT_IMPL(basic_set_list)
ISL_DUMP_OBJECT_IMPL(constraint)
ISL_DUMP_OBJECT_IMPL(id)
ISL_DUMP_OBJECT_IMPL(id_list)
ISL_DUMP_OBJECT_IMPL(id_to_ast_expr)
ISL_DUMP_OBJECT_IMPL(local_space)
ISL_DUMP_OBJECT_IMPL(map)
ISL_DUMP_OBJECT_IMPL(map_list)
ISL_DUMP_OBJECT_IMPL(multi_aff)
ISL_DUMP_OBJECT_IMPL(multi_pw_aff)
ISL_DUMP_OBJECT_IMPL(multi_union_pw_aff)
ISL_DUMP_OBJECT_IMPL(multi_val)
ISL_DUMP_OBJECT_IMPL(point)
ISL_DUMP_OBJECT_IMPL(pw_aff)
ISL_DUMP_OBJECT_IMPL(pw_aff_list)
ISL_DUMP_OBJECT_IMPL(pw_multi_aff)
ISL_DUMP_OBJECT_IMPL(schedule)
ISL_DUMP_OBJECT_IMPL(schedule_constraints)
ISL_DUMP_OBJECT_IMPL(schedule_node)
ISL_DUMP_OBJECT_IMPL(set)
ISL_DUMP_OBJECT_IMPL(set_list)
ISL_DUMP_OBJECT_IMPL(space)
ISL_DUMP_OBJECT_IMPL(union_map)
ISL_DUMP_OBJECT_IMPL(union_pw_aff)
ISL_DUMP_OBJECT_IMPL(union_pw_aff_list)
ISL_DUMP_OBJECT_IMPL(union_pw_multi_aff)
ISL_DUMP_OBJECT_IMPL(union_set)
ISL_DUMP_OBJECT_IMPL(union_set_list)
ISL_DUMP_OBJECT_IMPL(val)
ISL_DUMP_OBJECT_IMPL(val_list)
void polly::dumpIslObj(__isl_keep isl_schedule_node *node, raw_ostream &OS) {
if (!node)