Changeset View
Changeset View
Standalone View
Standalone View
lib/Transform/ZoneAlgo.cpp
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
/// @param InclDef Include the timepoint of the definition to the result. | /// @param InclDef Include the timepoint of the definition to the result. | ||||
/// @param InclRedef Include the timepoint of the overwrite into the result. | /// @param InclRedef Include the timepoint of the overwrite into the result. | ||||
/// | /// | ||||
/// @return { Scatter[] -> DomainWrite[] } | /// @return { Scatter[] -> DomainWrite[] } | ||||
static isl::union_map computeScalarReachingDefinition(isl::union_map Schedule, | static isl::union_map computeScalarReachingDefinition(isl::union_map Schedule, | ||||
isl::union_set Writes, | isl::union_set Writes, | ||||
bool InclDef, | bool InclDef, | ||||
bool InclRedef) { | bool InclRedef) { | ||||
// { DomainWrite[] -> Element[] } | // { DomainWrite[] -> Element[] } | ||||
auto Defs = give(isl_union_map_from_domain(Writes.take())); | isl::union_map Defs = isl::union_map::from_domain(Writes); | ||||
// { [Element[] -> Scatter[]] -> DomainWrite[] } | // { [Element[] -> Scatter[]] -> DomainWrite[] } | ||||
auto ReachDefs = | auto ReachDefs = | ||||
computeReachingDefinition(Schedule, Defs, InclDef, InclRedef); | computeReachingDefinition(Schedule, Defs, InclDef, InclRedef); | ||||
// { Scatter[] -> DomainWrite[] } | // { Scatter[] -> DomainWrite[] } | ||||
return give(isl_union_set_unwrap( | return ReachDefs.curry().range().unwrap(); | ||||
isl_union_map_range(isl_union_map_curry(ReachDefs.take())))); | |||||
} | } | ||||
/// Compute the reaching definition of a scalar. | /// Compute the reaching definition of a scalar. | ||||
/// | /// | ||||
/// This overload accepts only a single writing statement as an isl_map, | /// This overload accepts only a single writing statement as an isl_map, | ||||
/// consequently the result also is only a single isl_map. | /// consequently the result also is only a single isl_map. | ||||
/// | /// | ||||
/// @param Schedule { DomainWrite[] -> Scatter[] } | /// @param Schedule { DomainWrite[] -> Scatter[] } | ||||
/// @param Writes { DomainWrite[] } | /// @param Writes { DomainWrite[] } | ||||
/// @param InclDef Include the timepoint of the definition to the result. | /// @param InclDef Include the timepoint of the definition to the result. | ||||
/// @param InclRedef Include the timepoint of the overwrite into the result. | /// @param InclRedef Include the timepoint of the overwrite into the result. | ||||
/// | /// | ||||
/// @return { Scatter[] -> DomainWrite[] } | /// @return { Scatter[] -> DomainWrite[] } | ||||
static isl::map computeScalarReachingDefinition(isl::union_map Schedule, | static isl::map computeScalarReachingDefinition(isl::union_map Schedule, | ||||
isl::set Writes, bool InclDef, | isl::set Writes, bool InclDef, | ||||
bool InclRedef) { | bool InclRedef) { | ||||
auto DomainSpace = give(isl_set_get_space(Writes.keep())); | isl::space DomainSpace = Writes.get_space(); | ||||
auto ScatterSpace = getScatterSpace(Schedule); | isl::space ScatterSpace = getScatterSpace(Schedule); | ||||
// { Scatter[] -> DomainWrite[] } | // { Scatter[] -> DomainWrite[] } | ||||
auto UMap = computeScalarReachingDefinition( | isl::union_map UMap = computeScalarReachingDefinition( | ||||
Schedule, give(isl_union_set_from_set(Writes.take())), InclDef, | Schedule, isl::union_set(Writes), InclDef, InclRedef); | ||||
InclRedef); | |||||
auto ResultSpace = give(isl_space_map_from_domain_and_range( | isl::space ResultSpace = ScatterSpace.map_from_domain_and_range(DomainSpace); | ||||
ScatterSpace.take(), DomainSpace.take())); | |||||
return singleton(UMap, ResultSpace); | return singleton(UMap, ResultSpace); | ||||
} | } | ||||
isl::union_map polly::makeUnknownForDomain(isl::union_set Domain) { | isl::union_map polly::makeUnknownForDomain(isl::union_set Domain) { | ||||
return give(isl_union_map_from_domain(Domain.take())); | return give(isl_union_map_from_domain(Domain.take())); | ||||
} | } | ||||
/// Create a domain-to-unknown value mapping. | /// Create a domain-to-unknown value mapping. | ||||
▲ Show 20 Lines • Show All 541 Lines • Show Last 20 Lines |