[polly] r303503 - [isl++] Move isl raw_ostream printers into separate header

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun May 21 06:16:05 PDT 2017


Author: grosser
Date: Sun May 21 08:16:05 2017
New Revision: 303503

URL: http://llvm.org/viewvc/llvm-project?rev=303503&view=rev
Log:
[isl++] Move isl raw_ostream printers into separate header

Instead of relying on these functions to be part of the isl C++ bindings, we
just define this functionality independently. This allows us to use isl C++
bindings that do not contain LLVM specific functionality.

Added:
    polly/trunk/include/polly/Support/ISLOStream.h
Modified:
    polly/trunk/lib/External/isl/include/isl-noexceptions.h
    polly/trunk/lib/Transform/DeLICM.cpp
    polly/trunk/lib/Transform/FlattenAlgo.cpp
    polly/trunk/lib/Transform/FlattenSchedule.cpp
    polly/trunk/lib/Transform/Simplify.cpp

Added: polly/trunk/include/polly/Support/ISLOStream.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/ISLOStream.h?rev=303503&view=auto
==============================================================================
--- polly/trunk/include/polly/Support/ISLOStream.h (added)
+++ polly/trunk/include/polly/Support/ISLOStream.h Sun May 21 08:16:05 2017
@@ -0,0 +1,47 @@
+//===------ IslOstream.h ----------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// raw_ostream printers for isl C++ objects.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/raw_ostream.h"
+#include "isl-noexceptions.h"
+namespace polly {
+
+#define ADD_OSTREAM_PRINTER(name)                                              \
+  inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,                  \
+                                       const name &Obj) {                      \
+    OS << Obj.to_str();                                                        \
+    return OS;                                                                 \
+  }
+
+ADD_OSTREAM_PRINTER(isl::aff)
+ADD_OSTREAM_PRINTER(isl::ast_expr)
+ADD_OSTREAM_PRINTER(isl::ast_node)
+ADD_OSTREAM_PRINTER(isl::basic_map)
+ADD_OSTREAM_PRINTER(isl::basic_set)
+ADD_OSTREAM_PRINTER(isl::map)
+ADD_OSTREAM_PRINTER(isl::set)
+ADD_OSTREAM_PRINTER(isl::id)
+ADD_OSTREAM_PRINTER(isl::multi_aff)
+ADD_OSTREAM_PRINTER(isl::multi_pw_aff)
+ADD_OSTREAM_PRINTER(isl::multi_union_pw_aff)
+ADD_OSTREAM_PRINTER(isl::point)
+ADD_OSTREAM_PRINTER(isl::pw_aff)
+ADD_OSTREAM_PRINTER(isl::schedule)
+ADD_OSTREAM_PRINTER(isl::schedule_node)
+ADD_OSTREAM_PRINTER(isl::space)
+ADD_OSTREAM_PRINTER(isl::union_access_info)
+ADD_OSTREAM_PRINTER(isl::union_flow)
+ADD_OSTREAM_PRINTER(isl::union_set)
+ADD_OSTREAM_PRINTER(isl::union_map)
+ADD_OSTREAM_PRINTER(isl::union_pw_aff)
+ADD_OSTREAM_PRINTER(isl::union_pw_multi_aff)
+}

Modified: 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=303503&r1=303502&r2=303503&view=diff
==============================================================================
--- polly/trunk/lib/External/isl/include/isl-noexceptions.h (original)
+++ polly/trunk/lib/External/isl/include/isl-noexceptions.h Sun May 21 08:16:05 2017
@@ -1460,12 +1460,6 @@ std::string aff::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::aff aff::add(isl::aff aff2) const {
   auto res = isl_aff_add(copy(), aff2.release());
   return manage(res);
@@ -1670,12 +1664,6 @@ std::string ast_expr::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const ast_expr &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 std::string ast_expr::to_C_str() const {
   auto res = isl_ast_expr_to_C_str(get());
   std::string tmp(res);
@@ -1757,12 +1745,6 @@ std::string ast_node::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const ast_node &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 std::string ast_node::to_C_str() const {
   auto res = isl_ast_node_to_C_str(get());
   std::string tmp(res);
@@ -1849,12 +1831,6 @@ std::string basic_map::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const basic_map &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::basic_map basic_map::affine_hull() const {
   auto res = isl_basic_map_affine_hull(copy());
   return manage(res);
@@ -2059,12 +2035,6 @@ std::string basic_set::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const basic_set &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::basic_set basic_set::affine_hull() const {
   auto res = isl_basic_set_affine_hull(copy());
   return manage(res);
@@ -2229,12 +2199,6 @@ std::string id::to_str() const {
   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
 isl::local_space manage(__isl_take isl_local_space *ptr) {
   return local_space(ptr);
@@ -2390,12 +2354,6 @@ std::string map::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const map &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::basic_map map::affine_hull() const {
   auto res = isl_map_affine_hull(copy());
   return manage(res);
@@ -2675,12 +2633,6 @@ std::string multi_aff::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const multi_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::multi_aff multi_aff::add(isl::multi_aff multi2) const {
   auto res = isl_multi_aff_add(copy(), multi2.release());
   return manage(res);
@@ -2805,12 +2757,6 @@ std::string multi_pw_aff::to_str() const
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const multi_pw_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::multi_pw_aff multi_pw_aff::add(isl::multi_pw_aff multi2) const {
   auto res = isl_multi_pw_aff_add(copy(), multi2.release());
   return manage(res);
@@ -2945,12 +2891,6 @@ std::string multi_union_pw_aff::to_str()
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const multi_union_pw_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::multi_union_pw_aff multi_union_pw_aff::add(isl::multi_union_pw_aff multi2) const {
   auto res = isl_multi_union_pw_aff_add(copy(), multi2.release());
   return manage(res);
@@ -3055,12 +2995,6 @@ std::string multi_val::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const multi_val &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::multi_val multi_val::add(isl::multi_val multi2) const {
   auto res = isl_multi_val_add(copy(), multi2.release());
   return manage(res);
@@ -3165,12 +3099,6 @@ std::string point::to_str() const {
   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
 isl::pw_aff manage(__isl_take isl_pw_aff *ptr) {
   return pw_aff(ptr);
@@ -3265,12 +3193,6 @@ std::string pw_aff::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const pw_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::pw_aff pw_aff::add(isl::pw_aff pwaff2) const {
   auto res = isl_pw_aff_add(copy(), pwaff2.release());
   return manage(res);
@@ -3420,12 +3342,6 @@ std::string pw_multi_aff::to_str() const
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const pw_multi_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::pw_multi_aff pw_multi_aff::add(isl::pw_multi_aff pma2) const {
   auto res = isl_pw_multi_aff_add(copy(), pma2.release());
   return manage(res);
@@ -3540,12 +3456,6 @@ std::string schedule::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const schedule &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_map schedule::get_map() const {
   auto res = isl_schedule_get_map(get());
   return manage(res);
@@ -3640,12 +3550,6 @@ std::string schedule_constraints::to_str
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const schedule_constraints &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_map schedule_constraints::get_coincidence() const {
   auto res = isl_schedule_constraints_get_coincidence(get());
   return manage(res);
@@ -3755,12 +3659,6 @@ std::string schedule_node::to_str() cons
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const schedule_node &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::boolean schedule_node::band_member_get_coincident(int pos) const {
   auto res = isl_schedule_node_band_member_get_coincident(get(), pos);
   return res;
@@ -3895,12 +3793,6 @@ std::string set::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const set &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::set set::add_dims(isl::dim type, unsigned int n) const {
   auto res = isl_set_add_dims(copy(), static_cast<enum isl_dim_type>(type), n);
   return manage(res);
@@ -4160,12 +4052,6 @@ std::string space::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const space &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::space space::domain() const {
   auto res = isl_space_domain(copy());
   return manage(res);
@@ -4265,12 +4151,6 @@ std::string union_access_info::to_str()
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const union_access_info &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_flow union_access_info::compute_flow() const {
   auto res = isl_union_access_info_compute_flow(copy());
   return manage(res);
@@ -4370,12 +4250,6 @@ std::string union_flow::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const union_flow &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_map union_flow::get_full_may_dependence() const {
   auto res = isl_union_flow_get_full_may_dependence(get());
   return manage(res);
@@ -4500,12 +4374,6 @@ std::string union_map::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const union_map &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_map union_map::add_map(isl::map map) const {
   auto res = isl_union_map_add_map(copy(), map.release());
   return manage(res);
@@ -4875,12 +4743,6 @@ std::string union_pw_aff::to_str() const
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const union_pw_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_pw_aff union_pw_aff::add(isl::union_pw_aff upa2) const {
   auto res = isl_union_pw_aff_add(copy(), upa2.release());
   return manage(res);
@@ -5020,12 +4882,6 @@ std::string union_pw_multi_aff::to_str()
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const union_pw_multi_aff &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_pw_multi_aff union_pw_multi_aff::add(isl::union_pw_multi_aff upma2) const {
   auto res = isl_union_pw_multi_aff_add(copy(), upma2.release());
   return manage(res);
@@ -5140,12 +4996,6 @@ std::string union_set::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const union_set &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::union_set union_set::affine_hull() const {
   auto res = isl_union_set_affine_hull(copy());
   return manage(res);
@@ -5355,12 +5205,6 @@ std::string val::to_str() const {
   return S;
 }
 
-inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
-                                     const val &Obj) {
-  OS << Obj.to_str();
-  return OS;
-}
-
 isl::val val::two_exp() const {
   auto res = isl_val_2exp(copy());
   return manage(res);

Modified: polly/trunk/lib/Transform/DeLICM.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/DeLICM.cpp?rev=303503&r1=303502&r2=303503&view=diff
==============================================================================
--- polly/trunk/lib/Transform/DeLICM.cpp (original)
+++ polly/trunk/lib/Transform/DeLICM.cpp Sun May 21 08:16:05 2017
@@ -157,6 +157,7 @@
 #include "polly/Options.h"
 #include "polly/ScopInfo.h"
 #include "polly/ScopPass.h"
+#include "polly/Support/ISLOStream.h"
 #include "polly/Support/ISLTools.h"
 #include "polly/Support/VirtualInstruction.h"
 #include "llvm/ADT/Statistic.h"

Modified: polly/trunk/lib/Transform/FlattenAlgo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/FlattenAlgo.cpp?rev=303503&r1=303502&r2=303503&view=diff
==============================================================================
--- polly/trunk/lib/Transform/FlattenAlgo.cpp (original)
+++ polly/trunk/lib/Transform/FlattenAlgo.cpp Sun May 21 08:16:05 2017
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "polly/FlattenAlgo.h"
+#include "polly/Support/ISLOStream.h"
 #include "llvm/Support/Debug.h"
 #define DEBUG_TYPE "polly-flatten-algo"
 

Modified: polly/trunk/lib/Transform/FlattenSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/FlattenSchedule.cpp?rev=303503&r1=303502&r2=303503&view=diff
==============================================================================
--- polly/trunk/lib/Transform/FlattenSchedule.cpp (original)
+++ polly/trunk/lib/Transform/FlattenSchedule.cpp Sun May 21 08:16:05 2017
@@ -17,6 +17,7 @@
 #include "polly/FlattenAlgo.h"
 #include "polly/ScopInfo.h"
 #include "polly/ScopPass.h"
+#include "polly/Support/ISLOStream.h"
 #define DEBUG_TYPE "polly-flatten-schedule"
 
 using namespace polly;

Modified: polly/trunk/lib/Transform/Simplify.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/Simplify.cpp?rev=303503&r1=303502&r2=303503&view=diff
==============================================================================
--- polly/trunk/lib/Transform/Simplify.cpp (original)
+++ polly/trunk/lib/Transform/Simplify.cpp Sun May 21 08:16:05 2017
@@ -15,6 +15,7 @@
 #include "polly/ScopInfo.h"
 #include "polly/ScopPass.h"
 #include "polly/Support/GICHelper.h"
+#include "polly/Support/ISLOStream.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Support/Debug.h"
 #define DEBUG_TYPE "polly-simplify"




More information about the llvm-commits mailing list