From 3320485961eda2faf634b6bc0304ce22b681121d Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sun, 21 May 2017 13:16:05 +0000 Subject: [PATCH] [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. llvm-svn: 303503 --- polly/include/polly/Support/ISLOStream.h | 47 +++++++ polly/lib/External/isl/include/isl-noexceptions.h | 156 ---------------------- polly/lib/Transform/DeLICM.cpp | 1 + polly/lib/Transform/FlattenAlgo.cpp | 1 + polly/lib/Transform/FlattenSchedule.cpp | 1 + polly/lib/Transform/Simplify.cpp | 1 + 6 files changed, 51 insertions(+), 156 deletions(-) create mode 100644 polly/include/polly/Support/ISLOStream.h diff --git a/polly/include/polly/Support/ISLOStream.h b/polly/include/polly/Support/ISLOStream.h new file mode 100644 index 0000000..b544d58 --- /dev/null +++ b/polly/include/polly/Support/ISLOStream.h @@ -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) +} diff --git a/polly/lib/External/isl/include/isl-noexceptions.h b/polly/lib/External/isl/include/isl-noexceptions.h index a6d894e..76e435a 100644 --- a/polly/lib/External/isl/include/isl-noexceptions.h +++ b/polly/lib/External/isl/include/isl-noexceptions.h @@ -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() const { 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() const { 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() const { 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(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() const { 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() const { 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); diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp index a6ef8cd..6676a0a 100644 --- a/polly/lib/Transform/DeLICM.cpp +++ b/polly/lib/Transform/DeLICM.cpp @@ -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" diff --git a/polly/lib/Transform/FlattenAlgo.cpp b/polly/lib/Transform/FlattenAlgo.cpp index 46c40a8..37cde5a 100644 --- a/polly/lib/Transform/FlattenAlgo.cpp +++ b/polly/lib/Transform/FlattenAlgo.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "polly/FlattenAlgo.h" +#include "polly/Support/ISLOStream.h" #include "llvm/Support/Debug.h" #define DEBUG_TYPE "polly-flatten-algo" diff --git a/polly/lib/Transform/FlattenSchedule.cpp b/polly/lib/Transform/FlattenSchedule.cpp index cd5db6e..fab0bdd 100644 --- a/polly/lib/Transform/FlattenSchedule.cpp +++ b/polly/lib/Transform/FlattenSchedule.cpp @@ -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; diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp index b316341..bc04960 100644 --- a/polly/lib/Transform/Simplify.cpp +++ b/polly/lib/Transform/Simplify.cpp @@ -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" -- 2.7.4