22#define DEBUG_TYPE "polly-flatten-schedule"
35 OS.indent(indent) << Map <<
"\n";
39class FlattenSchedule final :
public ScopPass {
41 FlattenSchedule(
const FlattenSchedule &) =
delete;
42 const FlattenSchedule &operator=(
const FlattenSchedule &) =
delete;
44 std::shared_ptr<isl_ctx> IslCtx;
49 explicit FlattenSchedule() :
ScopPass(ID) {}
59 IslCtx =
S.getSharedIslCtx();
61 POLLY_DEBUG(dbgs() <<
"Going to flatten old schedule:\n");
62 OldSchedule =
S.getSchedule();
65 auto Domains =
S.getDomains();
67 POLLY_DEBUG(dbgs() <<
"Old schedule with domains:\n");
68 POLLY_DEBUG(printSchedule(dbgs(), RestrictedOldSchedule, 2));
75 NewSchedule = NewSchedule.gist_domain(Domains);
76 POLLY_DEBUG(dbgs() <<
"Gisted, flattened new schedule:\n");
79 S.setSchedule(NewSchedule);
84 OS <<
"Schedule before flattening {\n";
85 printSchedule(OS, OldSchedule, 4);
88 OS <<
"Schedule after flattening {\n";
89 printSchedule(OS,
S.getSchedule(), 4);
93 void releaseMemory()
override {
99char FlattenSchedule::ID;
102class FlattenSchedulePrinterLegacyPass final :
public ScopPass {
106 FlattenSchedulePrinterLegacyPass()
107 : FlattenSchedulePrinterLegacyPass(outs()) {}
108 explicit FlattenSchedulePrinterLegacyPass(llvm::raw_ostream &OS)
112 FlattenSchedule &P = getAnalysis<FlattenSchedule>();
114 OS <<
"Printing analysis '" << P.getPassName() <<
"' for region: '"
115 <<
S.getRegion().getNameStr() <<
"' in function '"
116 <<
S.getFunction().getName() <<
"':\n";
124 AU.addRequired<FlattenSchedule>();
125 AU.setPreservesAll();
129 llvm::raw_ostream &OS;
132char FlattenSchedulePrinterLegacyPass::ID = 0;
138 return new FlattenSchedulePrinterLegacyPass(OS);
142 "Polly - Flatten schedule",
false,
false)
INITIALIZE_PASS_END(DependenceInfo, "polly-dependences", "Polly - Calculate dependences", false, false) namespace
INITIALIZE_PASS_DEPENDENCY(ScopInfoRegionPass)
INITIALIZE_PASS_BEGIN(FlattenSchedule, "polly-flatten-schedule", "Polly - Flatten schedule", false, false) INITIALIZE_PASS_END(FlattenSchedule
isl::map_list get_map_list() const
isl::union_map intersect_domain(isl::space space) const
The legacy pass manager's analysis pass to compute scop information for a region.
ScopPass - This class adapts the RegionPass interface to allow convenient creation of passes that ope...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnScop(Scop &S)=0
runOnScop - This method must be overloaded to perform the desired Polyhedral transformation or analys...
virtual void printScop(raw_ostream &OS, Scop &S) const
Print method for SCoPs.
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
llvm::Pass * createFlattenSchedulePass()
llvm::Pass * createFlattenSchedulePrinterLegacyPass(llvm::raw_ostream &OS)
isl::union_map flattenSchedule(isl::union_map Schedule)
Recursively flatten a schedule.