14#include "llvm/ADT/APInt.h"
36 Abs = Int.sext(Int.getBitWidth() + 1).abs();
40 const uint64_t *Data = Abs.getRawData();
41 unsigned Words = Abs.getNumWords();
45 if (IsSigned && Int.isNegative())
54 const static int ChunkSize =
sizeof(uint64_t);
59 Data = (uint64_t *)malloc(NumChunks * ChunkSize);
61 int NumBits = CHAR_BIT * ChunkSize * NumChunks;
62 APInt
A(NumBits, NumChunks, Data);
70 A =
A.zext(
A.getBitWidth() + 1);
77 if (
A.getSignificantBits() <
A.getBitWidth())
78 A =
A.trunc(
A.getSignificantBits());
85template <
typename ISLTy,
typename ISL_CTX_GETTER,
typename ISL_PRINTER>
86static inline std::string
88 ISL_CTX_GETTER ctx_getter_fn, ISL_PRINTER printer_fn,
89 const std::string &DefaultValue) {
100 string = DefaultValue;
106#define ISL_C_OBJECT_TO_STRING(name) \
107 std::string polly::stringFromIslObj(__isl_keep isl_##name *Obj, \
108 std::string DefaultValue) { \
109 return stringFromIslObjInternal(Obj, isl_##name##_get_ctx, \
110 isl_printer_print_##name, DefaultValue); \
146 llvm::replace(
str,
'.',
'_');
147 llvm::replace(
str,
'\"',
'_');
148 replace(
str, StringRef(
" "), StringRef(
"__"));
149 replace(
str, StringRef(
"=>"), StringRef(
"TO"));
150 llvm::replace(
str,
'+',
'_');
154 const std::string &Middle,
155 const std::string &Suffix) {
156 std::string
S = Prefix + Middle + Suffix;
162 const std::string &Name,
long Number,
163 const std::string &Suffix,
164 bool UseInstructionNames) {
165 std::string
S = Prefix;
168 S += std::string(
"_") + Name;
170 S += std::to_string(Number);
179 const Value *Val,
long Number,
180 const std::string &Suffix,
181 bool UseInstructionNames) {
184 if (UseInstructionNames && Val->hasName())
185 ValStr = std::string(
"_") + std::string(Val->getName());
187 ValStr = std::to_string(Number);
189 return getIslCompatibleName(Prefix, ValStr, Suffix);
192#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
193#define ISL_DUMP_OBJECT_IMPL(NAME) \
194 void polly::dumpIslObj(const isl::NAME &Obj) { \
195 isl_##NAME##_dump(Obj.get()); \
197 void polly::dumpIslObj(isl_##NAME *Obj) { isl_##NAME##_dump(Obj); }
static std::string stringFromIslObjInternal(__isl_keep ISLTy *isl_obj, ISL_CTX_GETTER ctx_getter_fn, ISL_PRINTER printer_fn, const std::string &DefaultValue)
static void replace(std::string &str, StringRef find, StringRef replace)
#define ISL_C_OBJECT_TO_STRING(name)
#define ISL_DUMP_OBJECT_IMPL(NAME)
static void makeIslCompatible(std::string &str)
__isl_keep isl_schedule_node * get() const
__isl_export __isl_give ISL_HMAP __isl_take ISL_KEY __isl_take ISL_VAL * val
static int find(int *con, unsigned len, int status)
static unsigned pos(__isl_keep isl_space *space, enum isl_dim_type type)
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
std::string getIslCompatibleName(const std::string &Prefix, const llvm::Value *Val, long Number, const std::string &Suffix, bool UseInstructionNames)
Combine Prefix, Val (or Number) and Suffix to an isl-compatible name.
__isl_give isl_val * isl_valFromAPInt(isl_ctx *Ctx, const llvm::APInt Int, bool IsSigned)
Translate an llvm::APInt to an isl_val.
void dumpIslObj(const isl::schedule_node &Node, llvm::raw_ostream &OS)
Emit the equivaltent of the isl_*_dump output into a raw_ostream.
llvm::APInt APIntFromVal(__isl_take isl_val *Val)
Translate isl_val to llvm::APInt.
__isl_null isl_printer * isl_printer_free(__isl_take isl_printer *printer)
__isl_give char * isl_printer_get_str(__isl_keep isl_printer *printer)
#define ISL_YAML_STYLE_BLOCK
__isl_give isl_printer * isl_printer_set_yaml_style(__isl_take isl_printer *p, int yaml_style)
__isl_give isl_printer * isl_printer_to_str(isl_ctx *ctx)
__isl_give isl_printer * isl_printer_print_schedule_node(__isl_take isl_printer *p, __isl_keep isl_schedule_node *node)
isl_ctx * isl_schedule_node_get_ctx(__isl_keep isl_schedule_node *node)
__isl_give isl_val * isl_val_int_from_chunks(isl_ctx *ctx, size_t n, size_t size, const void *chunks)
isl_size isl_val_n_abs_num_chunks(__isl_keep isl_val *v, size_t size)
__isl_export isl_bool isl_val_is_neg(__isl_keep isl_val *v)
__isl_null isl_val * isl_val_free(__isl_take isl_val *v)
isl_stat isl_val_get_abs_num_chunks(__isl_keep isl_val *v, size_t size, void *chunks)
__isl_export __isl_give isl_val * isl_val_neg(__isl_take isl_val *v)
__isl_export isl_bool isl_val_is_int(__isl_keep isl_val *v)