diff options
author | patacca <patacca@autistici.org> | 2021-06-15 14:21:40 +0200 |
---|---|---|
committer | patacca <patacca@autistici.org> | 2021-06-15 14:22:10 +0200 |
commit | cfe117def7b0714e5d724c80839e68f40fba4f47 (patch) | |
tree | 847ea18e7a28961a8ab4dbed944adc60cf93def9 /polly/include | |
parent | ccda8c71b2ce6b1f005f8f2434e0e7bc5028e169 (diff) | |
download | llvm-cfe117def7b0714e5d724c80839e68f40fba4f47.tar.gz |
[Polly][Isl] Replacing isl method `to_str()` with `stringFromIslObj()`. NFC.
This is part of an effort to reduce the differences between the custom C++ bindings used right now by polly in `lib/External/isl/include/isl/isl-noxceptions.h` and the official isl C++ interface.
Changes made:
- Removing method `to_str()` from all the classes in the isl C++ bindings.
- Overload method `stringFromIslObj()` so it accepts isl C++ objects.
- To keep backward compatibility `stringFromIslObj()` now accepts a value that is returned if the isl C object is `null` or doesn't have a string representation (by default it's an empty string). In some cases it's better to have the string "null" instead of an empty string.
- isl-noexceptions.h has been generated by this https://github.com/patacca/isl/commit/d33ec3a3bbaf971b254a853e6d8200ff9f5a1385
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D104211
Diffstat (limited to 'polly/include')
-rw-r--r-- | polly/include/polly/Support/GICHelper.h | 66 | ||||
-rw-r--r-- | polly/include/polly/Support/ISLOStream.h | 3 |
2 files changed, 46 insertions, 23 deletions
diff --git a/polly/include/polly/Support/GICHelper.h b/polly/include/polly/Support/GICHelper.h index ca8abe413fe1..59f1f891c948 100644 --- a/polly/include/polly/Support/GICHelper.h +++ b/polly/include/polly/Support/GICHelper.h @@ -150,71 +150,93 @@ inline llvm::APInt APIntFromVal(isl::val V) { /// Get c++ string from Isl objects. //@{ -std::string stringFromIslObj(__isl_keep isl_map *map); -std::string stringFromIslObj(__isl_keep isl_union_map *umap); -std::string stringFromIslObj(__isl_keep isl_set *set); -std::string stringFromIslObj(__isl_keep isl_union_set *uset); -std::string stringFromIslObj(__isl_keep isl_schedule *schedule); -std::string stringFromIslObj(__isl_keep isl_multi_aff *maff); -std::string stringFromIslObj(__isl_keep isl_pw_multi_aff *pma); -std::string stringFromIslObj(__isl_keep isl_multi_pw_aff *mpa); -std::string stringFromIslObj(__isl_keep isl_union_pw_multi_aff *upma); -std::string stringFromIslObj(__isl_keep isl_aff *aff); -std::string stringFromIslObj(__isl_keep isl_pw_aff *pwaff); -std::string stringFromIslObj(__isl_keep isl_space *space); +#define ISL_CPP_OBJECT_TO_STRING(name) \ + inline std::string stringFromIslObj(const name &Obj, \ + std::string DefaultValue = "") { \ + return stringFromIslObj(Obj.get(), DefaultValue); \ + } + +#define ISL_OBJECT_TO_STRING(name) \ + std::string stringFromIslObj(__isl_keep isl_##name *Obj, \ + std::string DefaultValue = ""); \ + ISL_CPP_OBJECT_TO_STRING(isl::name) + +ISL_OBJECT_TO_STRING(aff) +ISL_OBJECT_TO_STRING(ast_expr) +ISL_OBJECT_TO_STRING(ast_node) +ISL_OBJECT_TO_STRING(basic_map) +ISL_OBJECT_TO_STRING(basic_set) +ISL_OBJECT_TO_STRING(map) +ISL_OBJECT_TO_STRING(set) +ISL_OBJECT_TO_STRING(id) +ISL_OBJECT_TO_STRING(multi_aff) +ISL_OBJECT_TO_STRING(multi_pw_aff) +ISL_OBJECT_TO_STRING(multi_union_pw_aff) +ISL_OBJECT_TO_STRING(point) +ISL_OBJECT_TO_STRING(pw_aff) +ISL_OBJECT_TO_STRING(pw_multi_aff) +ISL_OBJECT_TO_STRING(schedule) +ISL_OBJECT_TO_STRING(schedule_node) +ISL_OBJECT_TO_STRING(space) +ISL_OBJECT_TO_STRING(union_access_info) +ISL_OBJECT_TO_STRING(union_flow) +ISL_OBJECT_TO_STRING(union_set) +ISL_OBJECT_TO_STRING(union_map) +ISL_OBJECT_TO_STRING(union_pw_aff) +ISL_OBJECT_TO_STRING(union_pw_multi_aff) //@} inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_union_map *Map) { - OS << polly::stringFromIslObj(Map); + OS << polly::stringFromIslObj(Map, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_map *Map) { - OS << polly::stringFromIslObj(Map); + OS << polly::stringFromIslObj(Map, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_set *Set) { - OS << polly::stringFromIslObj(Set); + OS << polly::stringFromIslObj(Set, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_pw_aff *Map) { - OS << polly::stringFromIslObj(Map); + OS << polly::stringFromIslObj(Map, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_pw_multi_aff *PMA) { - OS << polly::stringFromIslObj(PMA); + OS << polly::stringFromIslObj(PMA, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_multi_aff *MA) { - OS << polly::stringFromIslObj(MA); + OS << polly::stringFromIslObj(MA, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_union_pw_multi_aff *UPMA) { - OS << polly::stringFromIslObj(UPMA); + OS << polly::stringFromIslObj(UPMA, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_schedule *Schedule) { - OS << polly::stringFromIslObj(Schedule); + OS << polly::stringFromIslObj(Schedule, "null"); return OS; } inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, __isl_keep isl_space *Space) { - OS << polly::stringFromIslObj(Space); + OS << polly::stringFromIslObj(Space, "null"); return OS; } @@ -263,7 +285,7 @@ std::string getIslCompatibleName(const std::string &Prefix, inline llvm::DiagnosticInfoOptimizationBase & operator<<(llvm::DiagnosticInfoOptimizationBase &OS, const isl::union_map &Obj) { - OS << Obj.to_str(); + OS << stringFromIslObj(Obj); return OS; } diff --git a/polly/include/polly/Support/ISLOStream.h b/polly/include/polly/Support/ISLOStream.h index 08853a24aa0a..5f058507c60b 100644 --- a/polly/include/polly/Support/ISLOStream.h +++ b/polly/include/polly/Support/ISLOStream.h @@ -10,6 +10,7 @@ // //===----------------------------------------------------------------------===// +#include "polly/Support/GICHelper.h" #include "llvm/Support/raw_ostream.h" #include "isl/isl-noexceptions.h" namespace polly { @@ -17,7 +18,7 @@ namespace polly { #define ADD_OSTREAM_PRINTER(name) \ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, \ const name &Obj) { \ - OS << Obj.to_str(); \ + OS << stringFromIslObj(Obj); \ return OS; \ } |