mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-02 21:22:44 +00:00
[DeLICM/ZoneAlgo] Remove duplicate code. NFC.
DeLICM and ZoneAlgo both implemented filterKnownValInst. Declare ZoneAlgo's version in the header and let DeLCIM use it. llvm-svn: 310381
This commit is contained in:
parent
1563f039f5
commit
ce67358281
@ -29,6 +29,13 @@ class Scop;
|
||||
class ScopStmt;
|
||||
class MemoryAccess;
|
||||
|
||||
/// Return only the mappings that map to known values.
|
||||
///
|
||||
/// @param UMap { [] -> ValInst[] }
|
||||
///
|
||||
/// @return { [] -> ValInst[] }
|
||||
isl::union_map filterKnownValInst(const isl::union_map &UMap);
|
||||
|
||||
/// Base class for algorithms based on zones, like DeLICM.
|
||||
class ZoneAlgorithm {
|
||||
protected:
|
||||
|
@ -121,31 +121,6 @@ isl::map computeScalarReachingOverwrite(isl::union_map Schedule,
|
||||
return singleton(std::move(ReachOverwrite), ResultSpace);
|
||||
}
|
||||
|
||||
/// Return whether @p Map maps to an unknown value.
|
||||
///
|
||||
/// @param { [] -> ValInst[] }
|
||||
bool isMapToUnknown(const isl::map &Map) {
|
||||
auto Space = give(isl_space_range(isl_map_get_space(Map.keep())));
|
||||
return !isl_map_has_tuple_id(Map.keep(), isl_dim_set) &&
|
||||
!isl_space_is_wrapping(Space.keep()) &&
|
||||
isl_map_dim(Map.keep(), isl_dim_out) == 0;
|
||||
}
|
||||
|
||||
/// Return only the mappings that map to known values.
|
||||
///
|
||||
/// @param UMap { [] -> ValInst[] }
|
||||
///
|
||||
/// @return { [] -> ValInst[] }
|
||||
isl::union_map filterKnownValInst(const isl::union_map &UMap) {
|
||||
auto Result = give(isl_union_map_empty(isl_union_map_get_space(UMap.keep())));
|
||||
UMap.foreach_map([=, &Result](isl::map Map) -> isl::stat {
|
||||
if (!isMapToUnknown(Map))
|
||||
Result = give(isl_union_map_add_map(Result.take(), Map.take()));
|
||||
return isl::stat::ok;
|
||||
});
|
||||
return Result;
|
||||
}
|
||||
|
||||
/// Try to find a 'natural' extension of a mapped to elements outside its
|
||||
/// domain.
|
||||
///
|
||||
|
@ -246,12 +246,7 @@ static bool isMapToUnknown(const isl::map &Map) {
|
||||
Space.is_wrapping().is_false() && Space.dim(isl::dim::set) == 0;
|
||||
}
|
||||
|
||||
/// Return only the mappings that map to known values.
|
||||
///
|
||||
/// @param UMap { [] -> ValInst[] }
|
||||
///
|
||||
/// @return { [] -> ValInst[] }
|
||||
static isl::union_map filterKnownValInst(const isl::union_map &UMap) {
|
||||
isl::union_map polly::filterKnownValInst(const isl::union_map &UMap) {
|
||||
isl::union_map Result = isl::union_map::empty(UMap.get_space());
|
||||
UMap.foreach_map([=, &Result](isl::map Map) -> isl::stat {
|
||||
if (!isMapToUnknown(Map))
|
||||
|
Loading…
x
Reference in New Issue
Block a user