1 //===- IslAst.cpp - isl code generator interface --------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // The isl code generator interface takes a Scop and generates a isl_ast. This
11 // ist_ast can either be returned directly or it can be pretty printed to
12 // stdout.
13 //
14 // A typical isl_ast output looks like this:
15 //
16 // for (c2 = max(0, ceild(n + m, 2); c2 <= min(511, floord(5 * n, 3)); c2++) {
17 //   bb2(c2);
18 // }
19 //
20 //===----------------------------------------------------------------------===//
21 
22 #include "polly/CodeGen/CodeGeneration.h"
23 #include "polly/CodeGen/IslAst.h"
24 #include "polly/DependenceInfo.h"
25 #include "polly/LinkAllPasses.h"
26 #include "polly/Options.h"
27 #include "polly/ScopInfo.h"
28 #include "polly/Support/GICHelper.h"
29 #include "llvm/Analysis/RegionInfo.h"
30 #include "llvm/Support/Debug.h"
31 #include "isl/aff.h"
32 #include "isl/ast_build.h"
33 #include "isl/list.h"
34 #include "isl/map.h"
35 #include "isl/set.h"
36 #include "isl/union_map.h"
37 
38 #define DEBUG_TYPE "polly-ast"
39 
40 using namespace llvm;
41 using namespace polly;
42 
43 using IslAstUserPayload = IslAstInfo::IslAstUserPayload;
44 
45 static cl::opt<bool>
46     PollyParallel("polly-parallel",
47                   cl::desc("Generate thread parallel code (isl codegen only)"),
48                   cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
49 
50 static cl::opt<bool> PollyParallelForce(
51     "polly-parallel-force",
52     cl::desc(
53         "Force generation of thread parallel code ignoring any cost model"),
54     cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
55 
56 static cl::opt<bool> UseContext("polly-ast-use-context",
57                                 cl::desc("Use context"), cl::Hidden,
58                                 cl::init(false), cl::ZeroOrMore,
59                                 cl::cat(PollyCategory));
60 
61 static cl::opt<bool> DetectParallel("polly-ast-detect-parallel",
62                                     cl::desc("Detect parallelism"), cl::Hidden,
63                                     cl::init(false), cl::ZeroOrMore,
64                                     cl::cat(PollyCategory));
65 
66 static cl::opt<bool> NoEarlyExit(
67     "polly-no-early-exit",
68     cl::desc("Do not exit early if no benefit of the Polly version was found."),
69     cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
70 
71 namespace polly {
72 class IslAst {
73 public:
74   static IslAst *create(Scop *Scop, const Dependences &D);
75   ~IslAst();
76 
77   /// Print a source code representation of the program.
78   void pprint(llvm::raw_ostream &OS);
79 
80   __isl_give isl_ast_node *getAst();
81 
82   /// @brief Get the run-time conditions for the Scop.
83   __isl_give isl_ast_expr *getRunCondition();
84 
85 private:
86   Scop *S;
87   isl_ast_node *Root;
88   isl_ast_expr *RunCondition;
89 
90   IslAst(Scop *Scop);
91   void init(const Dependences &D);
92 
93   void buildRunCondition(__isl_keep isl_ast_build *Build);
94 };
95 } // End namespace polly.
96 
97 /// @brief Free an IslAstUserPayload object pointed to by @p Ptr
98 static void freeIslAstUserPayload(void *Ptr) {
99   delete ((IslAstInfo::IslAstUserPayload *)Ptr);
100 }
101 
102 IslAstInfo::IslAstUserPayload::~IslAstUserPayload() {
103   isl_ast_build_free(Build);
104   isl_pw_aff_free(MinimalDependenceDistance);
105 }
106 
107 /// @brief Temporary information used when building the ast.
108 struct AstBuildUserInfo {
109   /// @brief Construct and initialize the helper struct for AST creation.
110   AstBuildUserInfo()
111       : Deps(nullptr), InParallelFor(false), LastForNodeId(nullptr) {}
112 
113   /// @brief The dependence information used for the parallelism check.
114   const Dependences *Deps;
115 
116   /// @brief Flag to indicate that we are inside a parallel for node.
117   bool InParallelFor;
118 
119   /// @brief The last iterator id created for the current SCoP.
120   isl_id *LastForNodeId;
121 };
122 
123 /// @brief Print a string @p str in a single line using @p Printer.
124 static isl_printer *printLine(__isl_take isl_printer *Printer,
125                               const std::string &str,
126                               __isl_keep isl_pw_aff *PWA = nullptr) {
127   Printer = isl_printer_start_line(Printer);
128   Printer = isl_printer_print_str(Printer, str.c_str());
129   if (PWA)
130     Printer = isl_printer_print_pw_aff(Printer, PWA);
131   return isl_printer_end_line(Printer);
132 }
133 
134 /// @brief Return all broken reductions as a string of clauses (OpenMP style).
135 static const std::string getBrokenReductionsStr(__isl_keep isl_ast_node *Node) {
136   IslAstInfo::MemoryAccessSet *BrokenReductions;
137   std::string str;
138 
139   BrokenReductions = IslAstInfo::getBrokenReductions(Node);
140   if (!BrokenReductions || BrokenReductions->empty())
141     return "";
142 
143   // Map each type of reduction to a comma separated list of the base addresses.
144   std::map<MemoryAccess::ReductionType, std::string> Clauses;
145   for (MemoryAccess *MA : *BrokenReductions)
146     if (MA->isWrite())
147       Clauses[MA->getReductionType()] +=
148           ", " + MA->getBaseAddr()->getName().str();
149 
150   // Now print the reductions sorted by type. Each type will cause a clause
151   // like:  reduction (+ : sum0, sum1, sum2)
152   for (const auto &ReductionClause : Clauses) {
153     str += " reduction (";
154     str += MemoryAccess::getReductionOperatorStr(ReductionClause.first);
155     // Remove the first two symbols (", ") to make the output look pretty.
156     str += " : " + ReductionClause.second.substr(2) + ")";
157   }
158 
159   return str;
160 }
161 
162 /// @brief Callback executed for each for node in the ast in order to print it.
163 static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
164                                __isl_take isl_ast_print_options *Options,
165                                __isl_keep isl_ast_node *Node, void *) {
166 
167   isl_pw_aff *DD = IslAstInfo::getMinimalDependenceDistance(Node);
168   const std::string BrokenReductionsStr = getBrokenReductionsStr(Node);
169   const std::string KnownParallelStr = "#pragma known-parallel";
170   const std::string DepDisPragmaStr = "#pragma minimal dependence distance: ";
171   const std::string SimdPragmaStr = "#pragma simd";
172   const std::string OmpPragmaStr = "#pragma omp parallel for";
173 
174   if (DD)
175     Printer = printLine(Printer, DepDisPragmaStr, DD);
176 
177   if (IslAstInfo::isInnermostParallel(Node))
178     Printer = printLine(Printer, SimdPragmaStr + BrokenReductionsStr);
179 
180   if (IslAstInfo::isExecutedInParallel(Node))
181     Printer = printLine(Printer, OmpPragmaStr);
182   else if (IslAstInfo::isOutermostParallel(Node))
183     Printer = printLine(Printer, KnownParallelStr + BrokenReductionsStr);
184 
185   isl_pw_aff_free(DD);
186   return isl_ast_node_for_print(Node, Printer, Options);
187 }
188 
189 /// @brief Check if the current scheduling dimension is parallel
190 ///
191 /// In case the dimension is parallel we also check if any reduction
192 /// dependences is broken when we exploit this parallelism. If so,
193 /// @p IsReductionParallel will be set to true. The reduction dependences we use
194 /// to check are actually the union of the transitive closure of the initial
195 /// reduction dependences together with their reveresal. Even though these
196 /// dependences connect all iterations with each other (thus they are cyclic)
197 /// we can perform the parallelism check as we are only interested in a zero
198 /// (or non-zero) dependence distance on the dimension in question.
199 static bool astScheduleDimIsParallel(__isl_keep isl_ast_build *Build,
200                                      const Dependences *D,
201                                      IslAstUserPayload *NodeInfo) {
202   if (!D->hasValidDependences())
203     return false;
204 
205   isl_union_map *Schedule = isl_ast_build_get_schedule(Build);
206   isl_union_map *Deps = D->getDependences(
207       Dependences::TYPE_RAW | Dependences::TYPE_WAW | Dependences::TYPE_WAR);
208 
209   if (!D->isParallel(Schedule, Deps, &NodeInfo->MinimalDependenceDistance) &&
210       !isl_union_map_free(Schedule))
211     return false;
212 
213   isl_union_map *RedDeps = D->getDependences(Dependences::TYPE_TC_RED);
214   if (!D->isParallel(Schedule, RedDeps))
215     NodeInfo->IsReductionParallel = true;
216 
217   if (!NodeInfo->IsReductionParallel && !isl_union_map_free(Schedule))
218     return true;
219 
220   // Annotate reduction parallel nodes with the memory accesses which caused the
221   // reduction dependences parallel execution of the node conflicts with.
222   for (const auto &MaRedPair : D->getReductionDependences()) {
223     if (!MaRedPair.second)
224       continue;
225     RedDeps = isl_union_map_from_map(isl_map_copy(MaRedPair.second));
226     if (!D->isParallel(Schedule, RedDeps))
227       NodeInfo->BrokenReductions.insert(MaRedPair.first);
228   }
229 
230   isl_union_map_free(Schedule);
231   return true;
232 }
233 
234 // This method is executed before the construction of a for node. It creates
235 // an isl_id that is used to annotate the subsequently generated ast for nodes.
236 //
237 // In this function we also run the following analyses:
238 //
239 // - Detection of openmp parallel loops
240 //
241 static __isl_give isl_id *astBuildBeforeFor(__isl_keep isl_ast_build *Build,
242                                             void *User) {
243   AstBuildUserInfo *BuildInfo = (AstBuildUserInfo *)User;
244   IslAstUserPayload *Payload = new IslAstUserPayload();
245   isl_id *Id = isl_id_alloc(isl_ast_build_get_ctx(Build), "", Payload);
246   Id = isl_id_set_free_user(Id, freeIslAstUserPayload);
247   BuildInfo->LastForNodeId = Id;
248 
249   // Test for parallelism only if we are not already inside a parallel loop
250   if (!BuildInfo->InParallelFor)
251     BuildInfo->InParallelFor = Payload->IsOutermostParallel =
252         astScheduleDimIsParallel(Build, BuildInfo->Deps, Payload);
253 
254   return Id;
255 }
256 
257 // This method is executed after the construction of a for node.
258 //
259 // It performs the following actions:
260 //
261 // - Reset the 'InParallelFor' flag, as soon as we leave a for node,
262 //   that is marked as openmp parallel.
263 //
264 static __isl_give isl_ast_node *
265 astBuildAfterFor(__isl_take isl_ast_node *Node, __isl_keep isl_ast_build *Build,
266                  void *User) {
267   isl_id *Id = isl_ast_node_get_annotation(Node);
268   assert(Id && "Post order visit assumes annotated for nodes");
269   IslAstUserPayload *Payload = (IslAstUserPayload *)isl_id_get_user(Id);
270   assert(Payload && "Post order visit assumes annotated for nodes");
271 
272   AstBuildUserInfo *BuildInfo = (AstBuildUserInfo *)User;
273   assert(!Payload->Build && "Build environment already set");
274   Payload->Build = isl_ast_build_copy(Build);
275   Payload->IsInnermost = (Id == BuildInfo->LastForNodeId);
276 
277   // Innermost loops that are surrounded by parallel loops have not yet been
278   // tested for parallelism. Test them here to ensure we check all innermost
279   // loops for parallelism.
280   if (Payload->IsInnermost && BuildInfo->InParallelFor) {
281     if (Payload->IsOutermostParallel)
282       Payload->IsInnermostParallel = true;
283     else
284       Payload->IsInnermostParallel =
285           astScheduleDimIsParallel(Build, BuildInfo->Deps, Payload);
286   }
287   if (Payload->IsOutermostParallel)
288     BuildInfo->InParallelFor = false;
289 
290   isl_id_free(Id);
291   return Node;
292 }
293 
294 static __isl_give isl_ast_node *AtEachDomain(__isl_take isl_ast_node *Node,
295                                              __isl_keep isl_ast_build *Build,
296                                              void *User) {
297   assert(!isl_ast_node_get_annotation(Node) && "Node already annotated");
298 
299   IslAstUserPayload *Payload = new IslAstUserPayload();
300   isl_id *Id = isl_id_alloc(isl_ast_build_get_ctx(Build), "", Payload);
301   Id = isl_id_set_free_user(Id, freeIslAstUserPayload);
302 
303   Payload->Build = isl_ast_build_copy(Build);
304 
305   return isl_ast_node_set_annotation(Node, Id);
306 }
307 
308 // Build alias check condition given a pair of minimal/maximal access.
309 static __isl_give isl_ast_expr *
310 buildCondition(__isl_keep isl_ast_build *Build, const Scop::MinMaxAccessTy *It0,
311                const Scop::MinMaxAccessTy *It1) {
312   isl_ast_expr *NonAliasGroup, *MinExpr, *MaxExpr;
313   MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
314       Build, isl_pw_multi_aff_copy(It0->first)));
315   MaxExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
316       Build, isl_pw_multi_aff_copy(It1->second)));
317   NonAliasGroup = isl_ast_expr_le(MaxExpr, MinExpr);
318   MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
319       Build, isl_pw_multi_aff_copy(It1->first)));
320   MaxExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
321       Build, isl_pw_multi_aff_copy(It0->second)));
322   NonAliasGroup =
323       isl_ast_expr_or(NonAliasGroup, isl_ast_expr_le(MaxExpr, MinExpr));
324 
325   return NonAliasGroup;
326 }
327 
328 void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
329   // The conditions that need to be checked at run-time for this scop are
330   // available as an isl_set in the AssumedContext from which we can directly
331   // derive a run-time condition.
332   RunCondition = isl_ast_build_expr_from_set(Build, S->getAssumedContext());
333 
334   // Create the alias checks from the minimal/maximal accesses in each alias
335   // group which consists of read only and non read only (read write) accesses.
336   // This operation is by construction quadratic in the read-write pointers and
337   // linear int the read only pointers in each alias group.
338   for (const Scop::MinMaxVectorPairTy &MinMaxAccessPair : S->getAliasGroups()) {
339     auto &MinMaxReadWrite = MinMaxAccessPair.first;
340     auto &MinMaxReadOnly = MinMaxAccessPair.second;
341     auto RWAccEnd = MinMaxReadWrite.end();
342 
343     for (auto RWAccIt0 = MinMaxReadWrite.begin(); RWAccIt0 != RWAccEnd;
344          ++RWAccIt0) {
345       for (auto RWAccIt1 = RWAccIt0 + 1; RWAccIt1 != RWAccEnd; ++RWAccIt1)
346         RunCondition = isl_ast_expr_and(
347             RunCondition, buildCondition(Build, RWAccIt0, RWAccIt1));
348       for (const Scop::MinMaxAccessTy &ROAccIt : MinMaxReadOnly)
349         RunCondition = isl_ast_expr_and(
350             RunCondition, buildCondition(Build, RWAccIt0, &ROAccIt));
351     }
352   }
353 }
354 
355 /// @brief Simple cost analysis for a given SCoP
356 ///
357 /// TODO: Improve this analysis and extract it to make it usable in other
358 ///       places too.
359 ///       In order to improve the cost model we could either keep track of
360 ///       performed optimizations (e.g., tiling) or compute properties on the
361 ///       original as well as optimized SCoP (e.g., #stride-one-accesses).
362 static bool benefitsFromPolly(Scop *Scop, bool PerformParallelTest) {
363 
364   // First check the user choice.
365   if (NoEarlyExit)
366     return true;
367 
368   // Check if nothing interesting happened.
369   if (!PerformParallelTest && !Scop->isOptimized() &&
370       Scop->getAliasGroups().empty())
371     return false;
372 
373   // The default assumption is that Polly improves the code.
374   return true;
375 }
376 
377 IslAst::IslAst(Scop *Scop) : S(Scop), Root(nullptr), RunCondition(nullptr) {}
378 
379 void IslAst::init(const Dependences &D) {
380   bool PerformParallelTest = PollyParallel || DetectParallel ||
381                              PollyVectorizerChoice != VECTORIZER_NONE;
382 
383   // Skip AST and code generation if there was no benefit achieved.
384   if (!benefitsFromPolly(S, PerformParallelTest))
385     return;
386 
387   isl_ctx *Ctx = S->getIslCtx();
388   isl_options_set_ast_build_atomic_upper_bound(Ctx, true);
389   isl_ast_build *Build;
390   AstBuildUserInfo BuildInfo;
391 
392   if (UseContext)
393     Build = isl_ast_build_from_context(S->getContext());
394   else
395     Build = isl_ast_build_from_context(isl_set_universe(S->getParamSpace()));
396 
397   Build = isl_ast_build_set_at_each_domain(Build, AtEachDomain, nullptr);
398 
399   if (PerformParallelTest) {
400     BuildInfo.Deps = &D;
401     BuildInfo.InParallelFor = 0;
402 
403     Build = isl_ast_build_set_before_each_for(Build, &astBuildBeforeFor,
404                                               &BuildInfo);
405     Build =
406         isl_ast_build_set_after_each_for(Build, &astBuildAfterFor, &BuildInfo);
407   }
408 
409   buildRunCondition(Build);
410 
411   Root = isl_ast_build_node_from_schedule(Build, S->getScheduleTree());
412 
413   isl_ast_build_free(Build);
414 }
415 
416 IslAst *IslAst::create(Scop *Scop, const Dependences &D) {
417   auto Ast = new IslAst(Scop);
418   Ast->init(D);
419   return Ast;
420 }
421 
422 IslAst::~IslAst() {
423   isl_ast_node_free(Root);
424   isl_ast_expr_free(RunCondition);
425 }
426 
427 __isl_give isl_ast_node *IslAst::getAst() { return isl_ast_node_copy(Root); }
428 __isl_give isl_ast_expr *IslAst::getRunCondition() {
429   return isl_ast_expr_copy(RunCondition);
430 }
431 
432 void IslAstInfo::releaseMemory() {
433   if (Ast) {
434     delete Ast;
435     Ast = nullptr;
436   }
437 }
438 
439 bool IslAstInfo::runOnScop(Scop &Scop) {
440   if (Ast)
441     delete Ast;
442 
443   S = &Scop;
444 
445   const Dependences &D = getAnalysis<DependenceInfo>().getDependences();
446 
447   Ast = IslAst::create(&Scop, D);
448 
449   DEBUG(printScop(dbgs(), Scop));
450   return false;
451 }
452 
453 __isl_give isl_ast_node *IslAstInfo::getAst() const { return Ast->getAst(); }
454 __isl_give isl_ast_expr *IslAstInfo::getRunCondition() const {
455   return Ast->getRunCondition();
456 }
457 
458 IslAstUserPayload *IslAstInfo::getNodePayload(__isl_keep isl_ast_node *Node) {
459   isl_id *Id = isl_ast_node_get_annotation(Node);
460   if (!Id)
461     return nullptr;
462   IslAstUserPayload *Payload = (IslAstUserPayload *)isl_id_get_user(Id);
463   isl_id_free(Id);
464   return Payload;
465 }
466 
467 bool IslAstInfo::isInnermost(__isl_keep isl_ast_node *Node) {
468   IslAstUserPayload *Payload = getNodePayload(Node);
469   return Payload && Payload->IsInnermost;
470 }
471 
472 bool IslAstInfo::isParallel(__isl_keep isl_ast_node *Node) {
473   return IslAstInfo::isInnermostParallel(Node) ||
474          IslAstInfo::isOutermostParallel(Node);
475 }
476 
477 bool IslAstInfo::isInnermostParallel(__isl_keep isl_ast_node *Node) {
478   IslAstUserPayload *Payload = getNodePayload(Node);
479   return Payload && Payload->IsInnermostParallel;
480 }
481 
482 bool IslAstInfo::isOutermostParallel(__isl_keep isl_ast_node *Node) {
483   IslAstUserPayload *Payload = getNodePayload(Node);
484   return Payload && Payload->IsOutermostParallel;
485 }
486 
487 bool IslAstInfo::isReductionParallel(__isl_keep isl_ast_node *Node) {
488   IslAstUserPayload *Payload = getNodePayload(Node);
489   return Payload && Payload->IsReductionParallel;
490 }
491 
492 bool IslAstInfo::isExecutedInParallel(__isl_keep isl_ast_node *Node) {
493 
494   if (!PollyParallel)
495     return false;
496 
497   // Do not parallelize innermost loops.
498   //
499   // Parallelizing innermost loops is often not profitable, especially if
500   // they have a low number of iterations.
501   //
502   // TODO: Decide this based on the number of loop iterations that will be
503   //       executed. This can possibly require run-time checks, which again
504   //       raises the question of both run-time check overhead and code size
505   //       costs.
506   if (!PollyParallelForce && isInnermost(Node))
507     return false;
508 
509   return isOutermostParallel(Node) && !isReductionParallel(Node);
510 }
511 
512 isl_union_map *IslAstInfo::getSchedule(__isl_keep isl_ast_node *Node) {
513   IslAstUserPayload *Payload = getNodePayload(Node);
514   return Payload ? isl_ast_build_get_schedule(Payload->Build) : nullptr;
515 }
516 
517 isl_pw_aff *
518 IslAstInfo::getMinimalDependenceDistance(__isl_keep isl_ast_node *Node) {
519   IslAstUserPayload *Payload = getNodePayload(Node);
520   return Payload ? isl_pw_aff_copy(Payload->MinimalDependenceDistance)
521                  : nullptr;
522 }
523 
524 IslAstInfo::MemoryAccessSet *
525 IslAstInfo::getBrokenReductions(__isl_keep isl_ast_node *Node) {
526   IslAstUserPayload *Payload = getNodePayload(Node);
527   return Payload ? &Payload->BrokenReductions : nullptr;
528 }
529 
530 isl_ast_build *IslAstInfo::getBuild(__isl_keep isl_ast_node *Node) {
531   IslAstUserPayload *Payload = getNodePayload(Node);
532   return Payload ? Payload->Build : nullptr;
533 }
534 
535 void IslAstInfo::printScop(raw_ostream &OS, Scop &S) const {
536   isl_ast_print_options *Options;
537   isl_ast_node *RootNode = getAst();
538   Function *F = S.getRegion().getEntry()->getParent();
539 
540   OS << ":: isl ast :: " << F->getName() << " :: " << S.getRegion().getNameStr()
541      << "\n";
542 
543   if (!RootNode) {
544     OS << ":: isl ast generation and code generation was skipped!\n\n";
545     return;
546   }
547 
548   isl_ast_expr *RunCondition = getRunCondition();
549   char *RtCStr, *AstStr;
550 
551   Options = isl_ast_print_options_alloc(S.getIslCtx());
552   Options = isl_ast_print_options_set_print_for(Options, cbPrintFor, nullptr);
553 
554   isl_printer *P = isl_printer_to_str(S.getIslCtx());
555   P = isl_printer_print_ast_expr(P, RunCondition);
556   RtCStr = isl_printer_get_str(P);
557   P = isl_printer_flush(P);
558   P = isl_printer_indent(P, 4);
559   P = isl_printer_set_output_format(P, ISL_FORMAT_C);
560   P = isl_ast_node_print(RootNode, P, Options);
561   AstStr = isl_printer_get_str(P);
562 
563   isl_union_map *Schedule =
564       isl_union_map_intersect_domain(S.getSchedule(), S.getDomains());
565 
566   DEBUG({
567     dbgs() << S.getContextStr() << "\n";
568     dbgs() << stringFromIslObj(Schedule);
569   });
570   OS << "\nif (" << RtCStr << ")\n\n";
571   OS << AstStr << "\n";
572   OS << "else\n";
573   OS << "    {  /* original code */ }\n\n";
574 
575   free(RtCStr);
576   free(AstStr);
577 
578   isl_ast_expr_free(RunCondition);
579   isl_union_map_free(Schedule);
580   isl_ast_node_free(RootNode);
581   isl_printer_free(P);
582 }
583 
584 void IslAstInfo::getAnalysisUsage(AnalysisUsage &AU) const {
585   // Get the Common analysis usage of ScopPasses.
586   ScopPass::getAnalysisUsage(AU);
587   AU.addRequired<ScopInfo>();
588   AU.addRequired<DependenceInfo>();
589 }
590 
591 char IslAstInfo::ID = 0;
592 
593 Pass *polly::createIslAstInfoPass() { return new IslAstInfo(); }
594 
595 INITIALIZE_PASS_BEGIN(IslAstInfo, "polly-ast",
596                       "Polly - Generate an AST of the SCoP (isl)", false,
597                       false);
598 INITIALIZE_PASS_DEPENDENCY(ScopInfo);
599 INITIALIZE_PASS_DEPENDENCY(DependenceInfo);
600 INITIALIZE_PASS_END(IslAstInfo, "polly-ast",
601                     "Polly - Generate an AST from the SCoP (isl)", false, false)
602