16#include "llvm/Support/raw_ostream.h"
39 auto ShiftAff = Identity.at(Pos);
40 ShiftAff = ShiftAff.set_constant_si(Amount);
41 return Identity.set_aff(Pos, ShiftAff);
68 for (
unsigned i = 0u; i < Dims1; i += 1)
70 for (
unsigned i = 0u; i < Dims2; i += 1) {
80 isl::basic_map BMapResult = makeTupleSwapBasicMap(FromSpace1, FromSpace2);
97 Result = Result.
unite(After);
114 Result = Result.
unite(After);
128 bool InclFrom,
bool InclTo) {
190 bool RestrictDomain) {
194 Result = Result.
unite(IdentityMap);
203 isl::map Swap = makeTupleSwapMap(Space1, Space2);
211 Result = Result.
unite(Reversed);
220 assert(
unsigned(Pos) < NumDims &&
"Dimension index must be in range");
225 return Set.
apply(TranslatorMap);
232 Result = Result.
unite(Shifted);
241 assert(
unsigned(Pos) < NumDims &&
"Dimension index must be in range");
248 Space = Space.
range();
251 llvm_unreachable(
"Unsupported value for 'dim'");
262 llvm_unreachable(
"Unsupported value for 'dim'");
270 assert(
unsigned(Pos) < NumDims &&
"Dimension index must be in range");
284 Result = Result.
unite(Shifted);
315 bool InclPrevDef,
bool InclNextDef) {
346 ReachableWrites = ReachableWrites.
lexmin();
348 ReachableWrites = ReachableWrites.
lexmax();
353 if (InclPrevDef && InclNextDef) {
356 }
else if (!InclPrevDef && !InclNextDef) {
358 ReachableWrites = ReachableWrites.
subtract(SelfUse);
368 bool IncludeLastRead,
bool IncludeWrite) {
379 Schedule, Writes,
true, ReadEltInSameInst, !ReadEltInSameInst);
392 LastOverwrittenRead, EltDomWrites, IncludeLastRead, IncludeWrite);
396 Schedule, Writes,
true, IncludeLastRead, IncludeWrite);
404 ReadsOverwrittenRotated.
domain());
406 return BetweenLastReadOverwrite.
unite(WritesWithoutReads)
411 bool InclStart,
bool InclEnd) {
412 if (!InclStart && InclEnd)
415 auto ShiftedZone =
shiftDim(Zone, -1, -1);
416 if (InclStart && !InclEnd)
418 else if (!InclStart && !InclEnd)
421 assert(InclStart && InclEnd);
422 return Zone.
unite(ShiftedZone);
426 bool InclStart,
bool InclEnd) {
427 if (!InclStart && InclEnd)
430 auto ShiftedZone =
shiftDim(Zone, Dim, -1, -1);
431 if (InclStart && !InclEnd)
433 else if (!InclStart && !InclEnd)
436 assert(InclStart && InclEnd);
437 return Zone.
unite(ShiftedZone);
441 bool InclStart,
bool InclEnd) {
442 if (!InclStart && InclEnd)
445 auto ShiftedZone =
shiftDim(Zone, Dim, -1, -1);
446 if (InclStart && !InclEnd)
448 else if (!InclStart && !InclEnd)
451 assert(InclStart && InclEnd);
452 return Zone.
unite(ShiftedZone);
484 for (
unsigned i = 0; i < DomainDims; i += 1) {
487 DomainDims + Range1Dims + i);
489 for (
unsigned i = 0; i < Range1Dims; i += 1)
492 for (
unsigned i = 0; i < Range2Dims; i += 1)
495 DomainDims + Range1Dims + DomainDims + i);
504 Result = Result.
unite(Distributed);
563 Result = isl::val::nan(Aff.ctx());
564 return isl::stat::error();
570 return isl::stat::ok();
573 if (Result.
eq(ThisVal))
576 if (Max && ThisVal.gt(Result)) {
578 return isl::stat::ok();
581 if (Min && ThisVal.lt(Result)) {
583 return isl::stat::ok();
599 return llvm::seq<unsigned>(std::min(Begin, UEnd), UEnd);
602#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
623 if (
A.is_null() ||
B.is_null())
628 unsigned Len = std::min(ALen, BLen);
630 for (
unsigned i = 0; i < Len; i += 1) {
650 int BoundedCompare = BLowerBounded - ALowerBounded;
651 if (BoundedCompare != 0)
652 return BoundedCompare;
654 if (!ALowerBounded || !BLowerBounded)
663 int MinCompare = AMinVal.
sub(BMinVal).
sgn();
679 bool ConsiderTupleLen) {
681 if (WrappingCompare != 0)
682 return WrappingCompare;
690 if (FirstResult != 0)
704 int NameCompare = AName.compare(BName);
705 if (NameCompare != 0)
708 if (ConsiderTupleLen) {
728 if (TupleNestingCompare != 0)
729 return TupleNestingCompare < 0;
732 if (TupleCompare != 0)
733 return TupleCompare < 0;
763 std::vector<isl::basic_set> BSets;
767 BSets.push_back(BSet);
787 size_t OpenPos =
Str.find_first_of(
'{');
788 assert(OpenPos != std::string::npos);
789 size_t ClosePos =
Str.find_last_of(
'}');
790 assert(ClosePos != std::string::npos);
793 OS << llvm::StringRef(
Str).substr(0, OpenPos + 1) <<
"\n ";
797 OS << llvm::StringRef(
Str).substr(OpenPos + 1, ClosePos - OpenPos - 2);
808 Expanded = Expanded.
unite(BSet);
852 Expanded = Expanded.
unite(SetExpanded);
isl::val get_constant_val() const
static isl::basic_map universe(isl::space space)
isl::basic_map equate(isl::dim type1, int pos1, isl::dim type2, int pos2) const
isl::basic_set project_out(isl::dim type, unsigned int first, unsigned int n) const
class size dim(isl::dim type) const
isl::basic_set fix_val(isl::dim type, unsigned int pos, isl::val v) const
boolean is_bounded() const
isl::map intersect(isl::map map2) const
isl::map detect_equalities() const
static isl::map universe(isl::space space)
isl::map intersect_params(isl::set params) const
isl::map intersect_range(isl::set set) const
isl::map apply_range(isl::map map2) const
isl::map unite(isl::map map2) const
static isl::map from_union_map(isl::union_map umap)
isl::map coalesce() const
static isl::map from_multi_aff(isl::multi_aff maff)
static isl::map lex_gt(isl::space set_space)
isl::map apply_domain(isl::map map2) const
isl::map subtract(isl::map map2) const
static isl::map identity(isl::space space)
class size dim(isl::dim type) const
isl::space get_space() const
__isl_keep isl_map * get() const
static isl::map lex_lt(isl::space set_space)
static isl::map empty(isl::space space)
static isl::map lex_ge(isl::space set_space)
isl::map intersect_domain(isl::set set) const
static isl::map lex_le(isl::space set_space)
__isl_give isl_map * copy() const &
isl::map range_map() const
isl::multi_aff identity() const
isl::val get_coordinate_val(isl::dim type, int pos) const
stat foreach_piece(const std::function< stat(isl::set, isl::aff)> &fn) const
isl::set subtract(isl::set set2) const
static isl::set universe(isl::space space)
__isl_give isl_set * copy() const &
isl::basic_set convex_hull() const
isl::pw_aff dim_min(int pos) const
isl::set intersect_params(isl::set params) const
isl::set detect_equalities() const
isl::set coalesce() const
static isl::set empty(isl::space space)
class size tuple_dim() const
isl::space get_space() const
isl::set apply(isl::map map) const
stat foreach_point(const std::function< stat(isl::point)> &fn) const
isl::set unite(isl::set set2) const
isl::basic_set_list get_basic_set_list() const
boolean has_tuple_name(isl::dim type) const
std::string get_tuple_name(isl::dim type) const
boolean is_params() const
isl::space map_from_domain_and_range(isl::space range) const
isl::space domain() const
class size dim(isl::dim type) const
isl::space unwrap() const
isl::space set_from_params() const
boolean is_wrapping() const
isl::space map_from_set() const
isl::space add_dims(isl::dim type, unsigned int n) const
boolean has_equal_tuples(const isl::space &space2) const
isl::union_map domain_factor_domain() const
isl::union_map range_map() const
isl::union_map reverse() const
isl::union_map uncurry() const
isl::union_set wrap() const
isl::union_map unite(isl::union_map umap2) const
isl::union_set domain() const
isl::map_list get_map_list() const
__isl_give isl_union_map * copy() const &
isl::union_map subtract_domain(isl::union_set dom) const
isl::union_map product(isl::union_map umap2) const
isl::space get_space() const
isl::union_map lexmax() const
isl::union_map apply_domain(isl::union_map umap2) const
isl::union_map coalesce() const
isl::union_map apply_range(isl::union_map umap2) const
__isl_keep isl_union_map * get() const
static isl::union_map empty(isl::ctx ctx)
isl::union_map intersect(isl::union_map umap2) const
isl::union_map detect_equalities() const
isl::union_map subtract(isl::union_map umap2) const
isl::union_map intersect_domain(isl::space space) const
isl::union_map lexmin() const
__isl_keep isl_union_set * get() const
static isl::union_set empty(isl::ctx ctx)
isl::union_set coalesce() const
isl::union_set intersect(isl::union_set uset2) const
isl::union_set unite(isl::union_set uset2) const
isl::set_list get_set_list() const
__isl_give isl_union_set * copy() const &
isl::union_map unwrap() const
isl::union_set detect_equalities() const
boolean eq(const isl::val &v2) const
isl::val sub(isl::val v2) const
static isl::val nan(isl::ctx ctx)
__isl_give isl_val * isl_map_plain_get_val_if_fixed(__isl_keep isl_map *map, enum isl_dim_type type, unsigned pos)
__isl_give isl_map * isl_map_compute_divs(__isl_take isl_map *map)
aff manage_copy(__isl_keep isl_aff *ptr)
boolean manage(isl_bool val)
unsigned getNumScatterDims(const isl::union_map &Schedule)
Determine how many dimensions the scatter space of Schedule has.
isl::map betweenScatter(isl::map From, isl::map To, bool InclFrom, bool InclTo)
Construct a range of timepoints between two timepoints.
void dumpExpanded(const isl::set &Set)
Dump all points of the argument to llvm::errs().
isl::map beforeScatter(isl::map Map, bool Strict)
Return the range elements that are lexicographically smaller.
isl::union_map computeReachingWrite(isl::union_map Schedule, isl::union_map Writes, bool Reverse, bool InclPrevDef, bool InclNextDef)
Compute the reaching definition statement or the next overwrite for each definition of an array eleme...
isl::union_map computeArrayUnused(isl::union_map Schedule, isl::union_map Writes, isl::union_map Reads, bool ReadEltInSameInst, bool InclLastRead, bool InclWrite)
Compute the timepoints where the contents of an array element are not used.
isl::val getConstant(isl::pw_aff PwAff, bool Max, bool Min)
If PwAff maps to a constant, return said constant.
isl::map makeIdentityMap(const isl::set &Set, bool RestrictDomain)
Construct an identity map for the given domain values.
isl::map distributeDomain(isl::map Map)
Distribute the domain to the tuples of a wrapped range map.
llvm::iota_range< unsigned > rangeIslSize(unsigned Begin, isl::size End)
Check that End is valid and return an iterator from Begin to End.
isl::map reverseDomain(isl::map Map)
Reverse the nested map tuple in Map's domain.
void simplify(isl::set &Set)
Simplify a set inplace.
isl::map subtractParams(isl::map Map, isl::set Params)
Subtract the parameter space Params from Map.
isl::map intersectRange(isl::map Map, isl::union_set Range)
Intersect the range of Map with Range.
isl::union_map liftDomains(isl::union_map UMap, isl::union_set Factor)
Prepend a space to the tuples of a map.
isl::union_map applyDomainRange(isl::union_map UMap, isl::union_map Func)
Apply a map to the 'middle' of another relation.
void dumpPw(const isl::set &Set)
Dump a description of the argument to llvm::errs().
isl::set shiftDim(isl::set Set, int Pos, int Amount)
Add a constant to one dimension of a set.
isl::union_set convertZoneToTimepoints(isl::union_set Zone, bool InclStart, bool InclEnd)
Convert a zone (range between timepoints) to timepoints.
isl::map afterScatter(isl::map Map, bool Strict)
Return the range elements that are lexicographically larger.
isl::map singleton(isl::union_map UMap, isl::space ExpectedSpace)
If by construction a union map is known to contain only a single map, return it.
isl::space getScatterSpace(const isl::union_map &Schedule)
Return the scatter space of a Schedule.
__isl_give isl_set * isl_set_compute_divs(__isl_take isl_set *set)
static TupleKindPtr Range("Range")
__isl_export __isl_give isl_union_map * isl_union_map_compute_divs(__isl_take isl_union_map *umap)
isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap)
struct isl_union_set isl_union_set
__isl_export __isl_give isl_union_set * isl_union_set_compute_divs(__isl_take isl_union_set *uset)
isl_size isl_union_set_n_set(__isl_keep isl_union_set *uset)