109d30697STobias Grosser //===------ CodeGeneration.cpp - Code generate the Scops using ISL. ----======//
209d30697STobias Grosser //
309d30697STobias Grosser //                     The LLVM Compiler Infrastructure
409d30697STobias Grosser //
509d30697STobias Grosser // This file is distributed under the University of Illinois Open Source
609d30697STobias Grosser // License. See LICENSE.TXT for details.
709d30697STobias Grosser //
809d30697STobias Grosser //===----------------------------------------------------------------------===//
909d30697STobias Grosser //
1009d30697STobias Grosser // The CodeGeneration pass takes a Scop created by ScopInfo and translates it
1109d30697STobias Grosser // back to LLVM-IR using the ISL code generator.
1209d30697STobias Grosser //
13a6d48f59SMichael Kruse // The Scop describes the high level memory behavior of a control flow region.
1409d30697STobias Grosser // Transformation passes can update the schedule (execution order) of statements
1509d30697STobias Grosser // in the Scop. ISL is used to generate an abstract syntax tree that reflects
1609d30697STobias Grosser // the updated execution order. This clast is used to create new LLVM-IR that is
1709d30697STobias Grosser // computationally equivalent to the original control flow region, but executes
1809d30697STobias Grosser // its code in the new execution order defined by the changed schedule.
1909d30697STobias Grosser //
2009d30697STobias Grosser //===----------------------------------------------------------------------===//
2109d30697STobias Grosser 
2278ae52f0SPhilip Pfaffe #include "polly/CodeGen/CodeGeneration.h"
2309d30697STobias Grosser #include "polly/CodeGen/IslAst.h"
245624d3c9STobias Grosser #include "polly/CodeGen/IslNodeBuilder.h"
2565371af2STobias Grosser #include "polly/CodeGen/PerfMonitor.h"
2609d30697STobias Grosser #include "polly/CodeGen/Utils.h"
2709d30697STobias Grosser #include "polly/DependenceInfo.h"
2809d30697STobias Grosser #include "polly/LinkAllPasses.h"
2958e58544STobias Grosser #include "polly/Options.h"
3009d30697STobias Grosser #include "polly/ScopInfo.h"
3109d30697STobias Grosser #include "polly/Support/ScopHelper.h"
3266ef16b2SChandler Carruth #include "llvm/Analysis/AliasAnalysis.h"
3366ef16b2SChandler Carruth #include "llvm/Analysis/BasicAliasAnalysis.h"
3466ef16b2SChandler Carruth #include "llvm/Analysis/GlobalsModRef.h"
3578ae52f0SPhilip Pfaffe #include "llvm/Analysis/LoopInfo.h"
3666ef16b2SChandler Carruth #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
37c2bb0cbeSTobias Grosser #include "llvm/IR/Module.h"
3878ae52f0SPhilip Pfaffe #include "llvm/IR/PassManager.h"
39c2bb0cbeSTobias Grosser #include "llvm/IR/Verifier.h"
40c2bb0cbeSTobias Grosser #include "llvm/Support/Debug.h"
4109d30697STobias Grosser 
4209d30697STobias Grosser using namespace polly;
4309d30697STobias Grosser using namespace llvm;
4409d30697STobias Grosser 
4509d30697STobias Grosser #define DEBUG_TYPE "polly-codegen"
4609d30697STobias Grosser 
4758e58544STobias Grosser static cl::opt<bool> Verify("polly-codegen-verify",
4858e58544STobias Grosser                             cl::desc("Verify the function generated by Polly"),
49f1372217STobias Grosser                             cl::Hidden, cl::init(false), cl::ZeroOrMore,
5058e58544STobias Grosser                             cl::cat(PollyCategory));
5158e58544STobias Grosser 
5265371af2STobias Grosser static cl::opt<bool>
5365371af2STobias Grosser     PerfMonitoring("polly-codegen-perf-monitoring",
5465371af2STobias Grosser                    cl::desc("Add run-time performance monitoring"), cl::Hidden,
5565371af2STobias Grosser                    cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
5665371af2STobias Grosser 
57*71dfb3ebSSiddharth Bhat namespace polly {
58*71dfb3ebSSiddharth Bhat /// Mark a basic block unreachable.
59*71dfb3ebSSiddharth Bhat ///
60*71dfb3ebSSiddharth Bhat /// Marks the basic block @p Block unreachable by equipping it with an
61*71dfb3ebSSiddharth Bhat /// UnreachableInst.
62*71dfb3ebSSiddharth Bhat void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder) {
63*71dfb3ebSSiddharth Bhat   auto *OrigTerminator = Block.getTerminator();
64*71dfb3ebSSiddharth Bhat   Builder.SetInsertPoint(OrigTerminator);
65*71dfb3ebSSiddharth Bhat   Builder.CreateUnreachable();
66*71dfb3ebSSiddharth Bhat   OrigTerminator->eraseFromParent();
67*71dfb3ebSSiddharth Bhat }
68*71dfb3ebSSiddharth Bhat 
69*71dfb3ebSSiddharth Bhat } // namespace polly
70*71dfb3ebSSiddharth Bhat 
7109d30697STobias Grosser namespace {
7209d30697STobias Grosser 
7378ae52f0SPhilip Pfaffe static void verifyGeneratedFunction(Scop &S, Function &F, IslAstInfo &AI) {
74d439911fSTobias Grosser   if (!Verify || !verifyFunction(F, &errs()))
7558e58544STobias Grosser     return;
7609d30697STobias Grosser 
7709d30697STobias Grosser   DEBUG({
7809d30697STobias Grosser     errs() << "== ISL Codegen created an invalid function ==\n\n== The "
7909d30697STobias Grosser               "SCoP ==\n";
80cd4c977bSMichael Kruse     errs() << S;
8109d30697STobias Grosser     errs() << "\n== The isl AST ==\n";
8278ae52f0SPhilip Pfaffe     AI.print(errs());
8309d30697STobias Grosser     errs() << "\n== The invalid function ==\n";
8409d30697STobias Grosser     F.print(errs());
8509d30697STobias Grosser   });
8609d30697STobias Grosser 
8758e58544STobias Grosser   llvm_unreachable("Polly generated function could not be verified. Add "
8858e58544STobias Grosser                    "-polly-codegen-verify=false to disable this assertion.");
8909d30697STobias Grosser }
9009d30697STobias Grosser 
919c483c58SMichael Kruse // CodeGeneration adds a lot of BBs without updating the RegionInfo
929c483c58SMichael Kruse // We make all created BBs belong to the scop's parent region without any
939c483c58SMichael Kruse // nested structure to keep the RegionInfo verifier happy.
9478ae52f0SPhilip Pfaffe static void fixRegionInfo(Function &F, Region &ParentRegion, RegionInfo &RI) {
9578ae52f0SPhilip Pfaffe   for (BasicBlock &BB : F) {
9678ae52f0SPhilip Pfaffe     if (RI.getRegionFor(&BB))
979c483c58SMichael Kruse       continue;
989c483c58SMichael Kruse 
9978ae52f0SPhilip Pfaffe     RI.setRegionFor(&BB, &ParentRegion);
1009c483c58SMichael Kruse   }
1019c483c58SMichael Kruse }
1029c483c58SMichael Kruse 
103895f5d80SMichael Kruse /// Remove all lifetime markers (llvm.lifetime.start, llvm.lifetime.end) from
104895f5d80SMichael Kruse /// @R.
105895f5d80SMichael Kruse ///
106895f5d80SMichael Kruse /// CodeGeneration does not copy lifetime markers into the optimized SCoP,
107895f5d80SMichael Kruse /// which would leave the them only in the original path. This can transform
108895f5d80SMichael Kruse /// code such as
109895f5d80SMichael Kruse ///
110895f5d80SMichael Kruse ///     llvm.lifetime.start(%p)
111895f5d80SMichael Kruse ///     llvm.lifetime.end(%p)
112895f5d80SMichael Kruse ///
113895f5d80SMichael Kruse /// into
114895f5d80SMichael Kruse ///
115895f5d80SMichael Kruse ///     if (RTC) {
116895f5d80SMichael Kruse ///       // generated code
117895f5d80SMichael Kruse ///     } else {
118895f5d80SMichael Kruse ///       // original code
119895f5d80SMichael Kruse ///       llvm.lifetime.start(%p)
120895f5d80SMichael Kruse ///     }
121895f5d80SMichael Kruse ///     llvm.lifetime.end(%p)
122895f5d80SMichael Kruse ///
123895f5d80SMichael Kruse /// The current StackColoring algorithm cannot handle if some, but not all,
124895f5d80SMichael Kruse /// paths from the end marker to the entry block cross the start marker. Same
125895f5d80SMichael Kruse /// for start markers that do not always cross the end markers. We avoid any
126895f5d80SMichael Kruse /// issues by removing all lifetime markers, even from the original code.
127895f5d80SMichael Kruse ///
128895f5d80SMichael Kruse /// A better solution could be to hoist all llvm.lifetime.start to the split
129895f5d80SMichael Kruse /// node and all llvm.lifetime.end to the merge node, which should be
130895f5d80SMichael Kruse /// conservatively correct.
13178ae52f0SPhilip Pfaffe static void removeLifetimeMarkers(Region *R) {
132895f5d80SMichael Kruse   for (auto *BB : R->blocks()) {
133895f5d80SMichael Kruse     auto InstIt = BB->begin();
134895f5d80SMichael Kruse     auto InstEnd = BB->end();
135895f5d80SMichael Kruse 
136895f5d80SMichael Kruse     while (InstIt != InstEnd) {
137895f5d80SMichael Kruse       auto NextIt = InstIt;
138895f5d80SMichael Kruse       ++NextIt;
139895f5d80SMichael Kruse 
140895f5d80SMichael Kruse       if (auto *IT = dyn_cast<IntrinsicInst>(&*InstIt)) {
141895f5d80SMichael Kruse         switch (IT->getIntrinsicID()) {
142895f5d80SMichael Kruse         case llvm::Intrinsic::lifetime_start:
143895f5d80SMichael Kruse         case llvm::Intrinsic::lifetime_end:
144895f5d80SMichael Kruse           BB->getInstList().erase(InstIt);
145895f5d80SMichael Kruse           break;
146895f5d80SMichael Kruse         default:
147895f5d80SMichael Kruse           break;
148895f5d80SMichael Kruse         }
149895f5d80SMichael Kruse       }
150895f5d80SMichael Kruse 
151895f5d80SMichael Kruse       InstIt = NextIt;
152895f5d80SMichael Kruse     }
153895f5d80SMichael Kruse   }
154895f5d80SMichael Kruse }
155895f5d80SMichael Kruse 
15678ae52f0SPhilip Pfaffe static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
15778ae52f0SPhilip Pfaffe                     ScalarEvolution &SE, RegionInfo &RI) {
15809d30697STobias Grosser   // Check if we created an isl_ast root node, otherwise exit.
15978ae52f0SPhilip Pfaffe   isl_ast_node *AstRoot = AI.getAst();
16009d30697STobias Grosser   if (!AstRoot)
16109d30697STobias Grosser     return false;
16209d30697STobias Grosser 
16378ae52f0SPhilip Pfaffe   auto &DL = S.getFunction().getParent()->getDataLayout();
16422370884SMichael Kruse   Region *R = &S.getRegion();
16522370884SMichael Kruse   assert(!R->isTopLevelRegion() && "Top level regions are not supported");
16609d30697STobias Grosser 
167d78616f9STobias Grosser   ScopAnnotator Annotator;
16809d30697STobias Grosser 
16978ae52f0SPhilip Pfaffe   simplifyRegion(R, &DT, &LI, &RI);
17022370884SMichael Kruse   assert(R->isSimple());
171ef74443cSJohannes Doerfert   BasicBlock *EnteringBB = S.getEnteringBlock();
17222370884SMichael Kruse   assert(EnteringBB);
17309d30697STobias Grosser   PollyIRBuilder Builder = createPollyIRBuilder(EnteringBB, Annotator);
17409d30697STobias Grosser 
17509d30697STobias Grosser   // Only build the run-time condition and parameters _after_ having
17609d30697STobias Grosser   // introduced the conditional branch. This is important as the conditional
17709d30697STobias Grosser   // branch will guard the original scop from new induction variables that
17809d30697STobias Grosser   // the SCEVExpander may introduce while code generating the parameters and
17909d30697STobias Grosser   // which may introduce scalar dependences that prevent us from correctly
18009d30697STobias Grosser   // code generating this scop.
181256070d8SAndreas Simbuerger   BBPair StartExitBlocks =
18203346c27SSiddharth Bhat       std::get<0>(executeScopConditionally(S, Builder.getTrue(), DT, RI, LI));
183256070d8SAndreas Simbuerger   BasicBlock *StartBlock = std::get<0>(StartExitBlocks);
184dbb0ef8eSAndreas Simbuerger   BasicBlock *ExitBlock = std::get<1>(StartExitBlocks);
185256070d8SAndreas Simbuerger 
186895f5d80SMichael Kruse   removeLifetimeMarkers(R);
187bfb6a968STobias Grosser   auto *SplitBlock = StartBlock->getSinglePredecessor();
18809e3697fSJohannes Doerfert 
18978ae52f0SPhilip Pfaffe   IslNodeBuilder NodeBuilder(Builder, Annotator, DL, LI, SE, DT, S, StartBlock);
190acf80064SEli Friedman 
191214deb79SMichael Kruse   // All arrays must have their base pointers known before
192214deb79SMichael Kruse   // ScopAnnotator::buildAliasScopes.
193b738ffa8SMichael Kruse   NodeBuilder.allocateNewArrays(StartExitBlocks);
194214deb79SMichael Kruse   Annotator.buildAliasScopes(S);
195214deb79SMichael Kruse 
19665371af2STobias Grosser   if (PerfMonitoring) {
19707bee290SSiddharth Bhat     PerfMonitor P(S, EnteringBB->getParent()->getParent());
19865371af2STobias Grosser     P.initialize();
19965371af2STobias Grosser     P.insertRegionStart(SplitBlock->getTerminator());
20065371af2STobias Grosser 
201dbb0ef8eSAndreas Simbuerger     BasicBlock *MergeBlock = ExitBlock->getUniqueSuccessor();
20265371af2STobias Grosser     P.insertRegionEnd(MergeBlock->getTerminator());
20365371af2STobias Grosser   }
20465371af2STobias Grosser 
20509e3697fSJohannes Doerfert   // First generate code for the hoisted invariant loads and transitively the
20609e3697fSJohannes Doerfert   // parameters they reference. Afterwards, for the remaining parameters that
20709e3697fSJohannes Doerfert   // might reference the hoisted loads. Finally, build the runtime check
20809e3697fSJohannes Doerfert   // that might reference both hoisted loads as well as parameters.
209c4898504SJohannes Doerfert   // If the hoisting fails we have to bail and execute the original code.
21009d30697STobias Grosser   Builder.SetInsertPoint(SplitBlock->getTerminator());
211c4898504SJohannes Doerfert   if (!NodeBuilder.preloadInvariantLoads()) {
2121dd6e37aSJohannes Doerfert 
213bfb6a968STobias Grosser     // Patch the introduced branch condition to ensure that we always execute
214bfb6a968STobias Grosser     // the original SCoP.
215c4898504SJohannes Doerfert     auto *FalseI1 = Builder.getFalse();
21637977076SJohannes Doerfert     auto *SplitBBTerm = Builder.GetInsertBlock()->getTerminator();
21737977076SJohannes Doerfert     SplitBBTerm->setOperand(0, FalseI1);
2181dd6e37aSJohannes Doerfert 
219bfb6a968STobias Grosser     // Since the other branch is hence ignored we mark it as unreachable and
220bfb6a968STobias Grosser     // adjust the dominator tree accordingly.
221bfb6a968STobias Grosser     auto *ExitingBlock = StartBlock->getUniqueSuccessor();
222bfb6a968STobias Grosser     assert(ExitingBlock);
223bfb6a968STobias Grosser     auto *MergeBlock = ExitingBlock->getUniqueSuccessor();
224bfb6a968STobias Grosser     assert(MergeBlock);
225bfb6a968STobias Grosser     markBlockUnreachable(*StartBlock, Builder);
226bfb6a968STobias Grosser     markBlockUnreachable(*ExitingBlock, Builder);
227ef74443cSJohannes Doerfert     auto *ExitingBB = S.getExitingBlock();
228bfb6a968STobias Grosser     assert(ExitingBB);
22978ae52f0SPhilip Pfaffe     DT.changeImmediateDominator(MergeBlock, ExitingBB);
23078ae52f0SPhilip Pfaffe     DT.eraseNode(ExitingBlock);
231bfb6a968STobias Grosser 
232bfb6a968STobias Grosser     isl_ast_node_free(AstRoot);
2331dd6e37aSJohannes Doerfert   } else {
2348ea1fc19STobias Grosser     NodeBuilder.addParameters(S.getContext().release());
23578ae52f0SPhilip Pfaffe     Value *RTC = NodeBuilder.createRTC(AI.getRunCondition());
236404a0f81SJohannes Doerfert 
2373717aa5dSTobias Grosser     Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);
238b738ffa8SMichael Kruse 
239b738ffa8SMichael Kruse     // Explicitly set the insert point to the end of the block to avoid that a
240b738ffa8SMichael Kruse     // split at the builder's current
241b738ffa8SMichael Kruse     // insert position would move the malloc calls to the wrong BasicBlock.
242b738ffa8SMichael Kruse     // Ideally we would just split the block during allocation of the new
243b738ffa8SMichael Kruse     // arrays, but this would break the assumption that there are no blocks
244b738ffa8SMichael Kruse     // between polly.start and polly.exiting (at this point).
245b738ffa8SMichael Kruse     Builder.SetInsertPoint(StartBlock->getTerminator());
2463717aa5dSTobias Grosser 
2473717aa5dSTobias Grosser     NodeBuilder.create(AstRoot);
2488ed5e599STobias Grosser     NodeBuilder.finalize();
24978ae52f0SPhilip Pfaffe     fixRegionInfo(*EnteringBB->getParent(), *R->getParent(), RI);
2501dd6e37aSJohannes Doerfert   }
251ecff11dcSJohannes Doerfert 
2526a6a671cSJohannes Doerfert   Function *F = EnteringBB->getParent();
25378ae52f0SPhilip Pfaffe   verifyGeneratedFunction(S, *F, AI);
254a9dc5294SJohannes Doerfert   for (auto *SubF : NodeBuilder.getParallelSubfunctions())
25578ae52f0SPhilip Pfaffe     verifyGeneratedFunction(S, *SubF, AI);
256652f7808STobias Grosser 
2574c86a1d9SMichael Kruse   // Mark the function such that we run additional cleanup passes on this
2584c86a1d9SMichael Kruse   // function (e.g. mem2reg to rediscover phi nodes).
2594c86a1d9SMichael Kruse   F->addFnAttr("polly-optimized");
26009d30697STobias Grosser   return true;
26109d30697STobias Grosser }
26209d30697STobias Grosser 
26378ae52f0SPhilip Pfaffe class CodeGeneration : public ScopPass {
26478ae52f0SPhilip Pfaffe public:
26578ae52f0SPhilip Pfaffe   static char ID;
26678ae52f0SPhilip Pfaffe 
26778ae52f0SPhilip Pfaffe   CodeGeneration() : ScopPass(ID) {}
26878ae52f0SPhilip Pfaffe 
269a6d48f59SMichael Kruse   /// The data layout used.
27078ae52f0SPhilip Pfaffe   const DataLayout *DL;
27178ae52f0SPhilip Pfaffe 
27278ae52f0SPhilip Pfaffe   /// @name The analysis passes we need to generate code.
27378ae52f0SPhilip Pfaffe   ///
27478ae52f0SPhilip Pfaffe   ///{
27578ae52f0SPhilip Pfaffe   LoopInfo *LI;
27678ae52f0SPhilip Pfaffe   IslAstInfo *AI;
27778ae52f0SPhilip Pfaffe   DominatorTree *DT;
27878ae52f0SPhilip Pfaffe   ScalarEvolution *SE;
27978ae52f0SPhilip Pfaffe   RegionInfo *RI;
28078ae52f0SPhilip Pfaffe   ///}
28178ae52f0SPhilip Pfaffe 
28278ae52f0SPhilip Pfaffe   /// Generate LLVM-IR for the SCoP @p S.
28378ae52f0SPhilip Pfaffe   bool runOnScop(Scop &S) override {
28402ca346eSSingapuram Sanjay Srivallabh     // Skip SCoPs in case they're already code-generated by PPCGCodeGeneration.
28502ca346eSSingapuram Sanjay Srivallabh     if (S.isToBeSkipped())
28602ca346eSSingapuram Sanjay Srivallabh       return false;
28702ca346eSSingapuram Sanjay Srivallabh 
28878ae52f0SPhilip Pfaffe     AI = &getAnalysis<IslAstInfoWrapperPass>().getAI();
28978ae52f0SPhilip Pfaffe     LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
29078ae52f0SPhilip Pfaffe     DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
29178ae52f0SPhilip Pfaffe     SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
29278ae52f0SPhilip Pfaffe     DL = &S.getFunction().getParent()->getDataLayout();
29378ae52f0SPhilip Pfaffe     RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
29478ae52f0SPhilip Pfaffe     return CodeGen(S, *AI, *LI, *DT, *SE, *RI);
29578ae52f0SPhilip Pfaffe   }
29678ae52f0SPhilip Pfaffe 
297c80d6979STobias Grosser   /// Register all analyses and transformation required.
29809d30697STobias Grosser   void getAnalysisUsage(AnalysisUsage &AU) const override {
29909d30697STobias Grosser     AU.addRequired<DominatorTreeWrapperPass>();
3002b852e2eSPhilip Pfaffe     AU.addRequired<IslAstInfoWrapperPass>();
30109d30697STobias Grosser     AU.addRequired<RegionInfoPass>();
302c5bcf246STobias Grosser     AU.addRequired<ScalarEvolutionWrapperPass>();
3035cc87e3aSPhilip Pfaffe     AU.addRequired<ScopDetectionWrapperPass>();
30499191c78SJohannes Doerfert     AU.addRequired<ScopInfoRegionPass>();
30509d30697STobias Grosser     AU.addRequired<LoopInfoWrapperPass>();
30609d30697STobias Grosser 
30709d30697STobias Grosser     AU.addPreserved<DependenceInfo>();
30809d30697STobias Grosser 
30966ef16b2SChandler Carruth     AU.addPreserved<AAResultsWrapperPass>();
31066ef16b2SChandler Carruth     AU.addPreserved<BasicAAWrapperPass>();
31109d30697STobias Grosser     AU.addPreserved<LoopInfoWrapperPass>();
31209d30697STobias Grosser     AU.addPreserved<DominatorTreeWrapperPass>();
31366ef16b2SChandler Carruth     AU.addPreserved<GlobalsAAWrapperPass>();
3142b852e2eSPhilip Pfaffe     AU.addPreserved<IslAstInfoWrapperPass>();
3155cc87e3aSPhilip Pfaffe     AU.addPreserved<ScopDetectionWrapperPass>();
316c5bcf246STobias Grosser     AU.addPreserved<ScalarEvolutionWrapperPass>();
31766ef16b2SChandler Carruth     AU.addPreserved<SCEVAAWrapperPass>();
31809d30697STobias Grosser 
31909d30697STobias Grosser     // FIXME: We do not yet add regions for the newly generated code to the
32009d30697STobias Grosser     //        region tree.
32109d30697STobias Grosser     AU.addPreserved<RegionInfoPass>();
32299191c78SJohannes Doerfert     AU.addPreserved<ScopInfoRegionPass>();
32309d30697STobias Grosser   }
32409d30697STobias Grosser };
325522478d2STobias Grosser } // namespace
32609d30697STobias Grosser 
32778ae52f0SPhilip Pfaffe PreservedAnalyses
32878ae52f0SPhilip Pfaffe polly::CodeGenerationPass::run(Scop &S, ScopAnalysisManager &SAM,
32978ae52f0SPhilip Pfaffe                                ScopStandardAnalysisResults &AR, SPMUpdater &U) {
33078ae52f0SPhilip Pfaffe   auto &AI = SAM.getResult<IslAstAnalysis>(S, AR);
33178ae52f0SPhilip Pfaffe   if (CodeGen(S, AI, AR.LI, AR.DT, AR.SE, AR.RI))
33278ae52f0SPhilip Pfaffe     return PreservedAnalyses::none();
33378ae52f0SPhilip Pfaffe 
33478ae52f0SPhilip Pfaffe   return PreservedAnalyses::all();
33578ae52f0SPhilip Pfaffe }
33678ae52f0SPhilip Pfaffe 
33709d30697STobias Grosser char CodeGeneration::ID = 1;
33809d30697STobias Grosser 
33909d30697STobias Grosser Pass *polly::createCodeGenerationPass() { return new CodeGeneration(); }
34009d30697STobias Grosser 
34109d30697STobias Grosser INITIALIZE_PASS_BEGIN(CodeGeneration, "polly-codegen",
34209d30697STobias Grosser                       "Polly - Create LLVM-IR from SCoPs", false, false);
34309d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(DependenceInfo);
34409d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass);
34509d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass);
34609d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(RegionInfoPass);
347c5bcf246STobias Grosser INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass);
3485cc87e3aSPhilip Pfaffe INITIALIZE_PASS_DEPENDENCY(ScopDetectionWrapperPass);
34909d30697STobias Grosser INITIALIZE_PASS_END(CodeGeneration, "polly-codegen",
35009d30697STobias Grosser                     "Polly - Create LLVM-IR from SCoPs", false, false)
351