[PATCH] D38198: [Polly][Support] Force instatiation of isl dump() methods. NFC.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 05:04:04 PDT 2017


Meinersbur created this revision.
Meinersbur added a project: Polly.

In order for debuggers to be able to call an inline method, it must have
been instantiated somewhere. The dump() methods are usually not used, so
add an instantiation in debug builds.

This allows to call .dump() on any isl++ object from the gcc/gdb and
Visual Studio debugger in debug builds with assertions enabled.
In optimized builds, even with assertions enabled, the dump() methods
are also inlined in GICHelper.cpp, so no externally visible symbols
will be available either. This would require e.g.
__attribute__((noinline)) in isl-noexceptions.cpp which in turn would
require a translation unit they are instatiated in, making the isl C++
binding loose its header-only property.


https://reviews.llvm.org/D38198

Files:
  lib/Support/GICHelper.cpp


Index: lib/Support/GICHelper.cpp
===================================================================
--- lib/Support/GICHelper.cpp
+++ lib/Support/GICHelper.cpp
@@ -223,3 +223,60 @@
 
   return getIslCompatibleName(Prefix, ValStr, Suffix);
 }
+
+#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() {
+  isl::aff().dump();
+  isl::aff_list().dump();
+  isl::ast_expr().dump();
+  isl::ast_expr_list().dump();
+  isl::ast_node().dump();
+  isl::ast_node_list().dump();
+  isl::band_list().dump();
+  isl::basic_map().dump();
+  isl::basic_map_list().dump();
+  isl::basic_set().dump();
+  isl::basic_set_list().dump();
+  isl::constraint().dump();
+  isl::constraint_list().dump();
+  isl::id().dump();
+  isl::id_list().dump();
+  isl::id_to_ast_expr().dump();
+  isl::local_space().dump();
+  isl::map().dump();
+  isl::map_list().dump();
+  isl::multi_aff().dump();
+  isl::multi_pw_aff().dump();
+  isl::multi_union_pw_aff().dump();
+  isl::multi_val().dump();
+  isl::point().dump();
+  isl::pw_aff().dump();
+  isl::pw_aff_list().dump();
+  isl::pw_multi_aff().dump();
+  isl::pw_qpolynomial().dump();
+  isl::qpolynomial().dump();
+  isl::schedule().dump();
+  isl::schedule_constraints().dump();
+  isl::schedule_node().dump();
+  isl::set().dump();
+  isl::set_list().dump();
+  isl::space().dump();
+  isl::union_map().dump();
+  isl::union_map_list().dump();
+  isl::union_pw_aff().dump();
+  isl::union_pw_aff_list().dump();
+  isl::union_pw_multi_aff().dump();
+  isl::union_pw_multi_aff_list().dump();
+  isl::union_set().dump();
+  isl::union_set_list().dump();
+  isl::val().dump();
+  isl::val_list().dump();
+}
+#endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38198.116416.patch
Type: text/x-patch
Size: 2150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/229e1699/attachment.bin>


More information about the llvm-commits mailing list