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 
5709d30697STobias Grosser namespace {
5809d30697STobias Grosser 
5978ae52f0SPhilip Pfaffe static void verifyGeneratedFunction(Scop &S, Function &F, IslAstInfo &AI) {
60d439911fSTobias Grosser   if (!Verify || !verifyFunction(F, &errs()))
6158e58544STobias Grosser     return;
6209d30697STobias Grosser 
6309d30697STobias Grosser   DEBUG({
6409d30697STobias Grosser     errs() << "== ISL Codegen created an invalid function ==\n\n== The "
6509d30697STobias Grosser               "SCoP ==\n";
6609d30697STobias Grosser     S.print(errs());
6709d30697STobias Grosser     errs() << "\n== The isl AST ==\n";
6878ae52f0SPhilip Pfaffe     AI.print(errs());
6909d30697STobias Grosser     errs() << "\n== The invalid function ==\n";
7009d30697STobias Grosser     F.print(errs());
7109d30697STobias Grosser   });
7209d30697STobias Grosser 
7358e58544STobias Grosser   llvm_unreachable("Polly generated function could not be verified. Add "
7458e58544STobias Grosser                    "-polly-codegen-verify=false to disable this assertion.");
7509d30697STobias Grosser }
7609d30697STobias Grosser 
779c483c58SMichael Kruse // CodeGeneration adds a lot of BBs without updating the RegionInfo
789c483c58SMichael Kruse // We make all created BBs belong to the scop's parent region without any
799c483c58SMichael Kruse // nested structure to keep the RegionInfo verifier happy.
8078ae52f0SPhilip Pfaffe static void fixRegionInfo(Function &F, Region &ParentRegion, RegionInfo &RI) {
8178ae52f0SPhilip Pfaffe   for (BasicBlock &BB : F) {
8278ae52f0SPhilip Pfaffe     if (RI.getRegionFor(&BB))
839c483c58SMichael Kruse       continue;
849c483c58SMichael Kruse 
8578ae52f0SPhilip Pfaffe     RI.setRegionFor(&BB, &ParentRegion);
869c483c58SMichael Kruse   }
879c483c58SMichael Kruse }
889c483c58SMichael Kruse 
89c80d6979STobias Grosser /// Mark a basic block unreachable.
90bfb6a968STobias Grosser ///
91bfb6a968STobias Grosser /// Marks the basic block @p Block unreachable by equipping it with an
92bfb6a968STobias Grosser /// UnreachableInst.
9378ae52f0SPhilip Pfaffe static void markBlockUnreachable(BasicBlock &Block, PollyIRBuilder &Builder) {
94bfb6a968STobias Grosser   auto *OrigTerminator = Block.getTerminator();
95bfb6a968STobias Grosser   Builder.SetInsertPoint(OrigTerminator);
96bfb6a968STobias Grosser   Builder.CreateUnreachable();
97bfb6a968STobias Grosser   OrigTerminator->eraseFromParent();
98bfb6a968STobias Grosser }
99bfb6a968STobias Grosser 
100895f5d80SMichael Kruse /// Remove all lifetime markers (llvm.lifetime.start, llvm.lifetime.end) from
101895f5d80SMichael Kruse /// @R.
102895f5d80SMichael Kruse ///
103895f5d80SMichael Kruse /// CodeGeneration does not copy lifetime markers into the optimized SCoP,
104895f5d80SMichael Kruse /// which would leave the them only in the original path. This can transform
105895f5d80SMichael Kruse /// code such as
106895f5d80SMichael Kruse ///
107895f5d80SMichael Kruse ///     llvm.lifetime.start(%p)
108895f5d80SMichael Kruse ///     llvm.lifetime.end(%p)
109895f5d80SMichael Kruse ///
110895f5d80SMichael Kruse /// into
111895f5d80SMichael Kruse ///
112895f5d80SMichael Kruse ///     if (RTC) {
113895f5d80SMichael Kruse ///       // generated code
114895f5d80SMichael Kruse ///     } else {
115895f5d80SMichael Kruse ///       // original code
116895f5d80SMichael Kruse ///       llvm.lifetime.start(%p)
117895f5d80SMichael Kruse ///     }
118895f5d80SMichael Kruse ///     llvm.lifetime.end(%p)
119895f5d80SMichael Kruse ///
120895f5d80SMichael Kruse /// The current StackColoring algorithm cannot handle if some, but not all,
121895f5d80SMichael Kruse /// paths from the end marker to the entry block cross the start marker. Same
122895f5d80SMichael Kruse /// for start markers that do not always cross the end markers. We avoid any
123895f5d80SMichael Kruse /// issues by removing all lifetime markers, even from the original code.
124895f5d80SMichael Kruse ///
125895f5d80SMichael Kruse /// A better solution could be to hoist all llvm.lifetime.start to the split
126895f5d80SMichael Kruse /// node and all llvm.lifetime.end to the merge node, which should be
127895f5d80SMichael Kruse /// conservatively correct.
12878ae52f0SPhilip Pfaffe static void removeLifetimeMarkers(Region *R) {
129895f5d80SMichael Kruse   for (auto *BB : R->blocks()) {
130895f5d80SMichael Kruse     auto InstIt = BB->begin();
131895f5d80SMichael Kruse     auto InstEnd = BB->end();
132895f5d80SMichael Kruse 
133895f5d80SMichael Kruse     while (InstIt != InstEnd) {
134895f5d80SMichael Kruse       auto NextIt = InstIt;
135895f5d80SMichael Kruse       ++NextIt;
136895f5d80SMichael Kruse 
137895f5d80SMichael Kruse       if (auto *IT = dyn_cast<IntrinsicInst>(&*InstIt)) {
138895f5d80SMichael Kruse         switch (IT->getIntrinsicID()) {
139895f5d80SMichael Kruse         case llvm::Intrinsic::lifetime_start:
140895f5d80SMichael Kruse         case llvm::Intrinsic::lifetime_end:
141895f5d80SMichael Kruse           BB->getInstList().erase(InstIt);
142895f5d80SMichael Kruse           break;
143895f5d80SMichael Kruse         default:
144895f5d80SMichael Kruse           break;
145895f5d80SMichael Kruse         }
146895f5d80SMichael Kruse       }
147895f5d80SMichael Kruse 
148895f5d80SMichael Kruse       InstIt = NextIt;
149895f5d80SMichael Kruse     }
150895f5d80SMichael Kruse   }
151895f5d80SMichael Kruse }
152895f5d80SMichael Kruse 
15378ae52f0SPhilip Pfaffe static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
15478ae52f0SPhilip Pfaffe                     ScalarEvolution &SE, RegionInfo &RI) {
15509d30697STobias Grosser   // Check if we created an isl_ast root node, otherwise exit.
15678ae52f0SPhilip Pfaffe   isl_ast_node *AstRoot = AI.getAst();
15709d30697STobias Grosser   if (!AstRoot)
15809d30697STobias Grosser     return false;
15909d30697STobias Grosser 
16078ae52f0SPhilip Pfaffe   auto &DL = S.getFunction().getParent()->getDataLayout();
16122370884SMichael Kruse   Region *R = &S.getRegion();
16222370884SMichael Kruse   assert(!R->isTopLevelRegion() && "Top level regions are not supported");
16309d30697STobias Grosser 
164d78616f9STobias Grosser   ScopAnnotator Annotator;
16509d30697STobias Grosser 
16678ae52f0SPhilip Pfaffe   simplifyRegion(R, &DT, &LI, &RI);
16722370884SMichael Kruse   assert(R->isSimple());
168ef74443cSJohannes Doerfert   BasicBlock *EnteringBB = S.getEnteringBlock();
16922370884SMichael Kruse   assert(EnteringBB);
17009d30697STobias Grosser   PollyIRBuilder Builder = createPollyIRBuilder(EnteringBB, Annotator);
17109d30697STobias Grosser 
17209d30697STobias Grosser   // Only build the run-time condition and parameters _after_ having
17309d30697STobias Grosser   // introduced the conditional branch. This is important as the conditional
17409d30697STobias Grosser   // branch will guard the original scop from new induction variables that
17509d30697STobias Grosser   // the SCEVExpander may introduce while code generating the parameters and
17609d30697STobias Grosser   // which may introduce scalar dependences that prevent us from correctly
17709d30697STobias Grosser   // code generating this scop.
178256070d8SAndreas Simbuerger   BBPair StartExitBlocks =
17978ae52f0SPhilip Pfaffe       executeScopConditionally(S, Builder.getTrue(), DT, RI, LI);
180256070d8SAndreas Simbuerger   BasicBlock *StartBlock = std::get<0>(StartExitBlocks);
181dbb0ef8eSAndreas Simbuerger   BasicBlock *ExitBlock = std::get<1>(StartExitBlocks);
182256070d8SAndreas Simbuerger 
183895f5d80SMichael Kruse   removeLifetimeMarkers(R);
184bfb6a968STobias Grosser   auto *SplitBlock = StartBlock->getSinglePredecessor();
18509e3697fSJohannes Doerfert 
18678ae52f0SPhilip Pfaffe   IslNodeBuilder NodeBuilder(Builder, Annotator, DL, LI, SE, DT, S, StartBlock);
187acf80064SEli Friedman 
188214deb79SMichael Kruse   // All arrays must have their base pointers known before
189214deb79SMichael Kruse   // ScopAnnotator::buildAliasScopes.
190b738ffa8SMichael Kruse   NodeBuilder.allocateNewArrays(StartExitBlocks);
191214deb79SMichael Kruse   Annotator.buildAliasScopes(S);
192214deb79SMichael Kruse 
19365371af2STobias Grosser   if (PerfMonitoring) {
19407bee290SSiddharth Bhat     PerfMonitor P(S, EnteringBB->getParent()->getParent());
19565371af2STobias Grosser     P.initialize();
19665371af2STobias Grosser     P.insertRegionStart(SplitBlock->getTerminator());
19765371af2STobias Grosser 
198dbb0ef8eSAndreas Simbuerger     BasicBlock *MergeBlock = ExitBlock->getUniqueSuccessor();
19965371af2STobias Grosser     P.insertRegionEnd(MergeBlock->getTerminator());
20065371af2STobias Grosser   }
20165371af2STobias Grosser 
20209e3697fSJohannes Doerfert   // First generate code for the hoisted invariant loads and transitively the
20309e3697fSJohannes Doerfert   // parameters they reference. Afterwards, for the remaining parameters that
20409e3697fSJohannes Doerfert   // might reference the hoisted loads. Finally, build the runtime check
20509e3697fSJohannes Doerfert   // that might reference both hoisted loads as well as parameters.
206c4898504SJohannes Doerfert   // If the hoisting fails we have to bail and execute the original code.
20709d30697STobias Grosser   Builder.SetInsertPoint(SplitBlock->getTerminator());
208c4898504SJohannes Doerfert   if (!NodeBuilder.preloadInvariantLoads()) {
2091dd6e37aSJohannes Doerfert 
210bfb6a968STobias Grosser     // Patch the introduced branch condition to ensure that we always execute
211bfb6a968STobias Grosser     // the original SCoP.
212c4898504SJohannes Doerfert     auto *FalseI1 = Builder.getFalse();
21337977076SJohannes Doerfert     auto *SplitBBTerm = Builder.GetInsertBlock()->getTerminator();
21437977076SJohannes Doerfert     SplitBBTerm->setOperand(0, FalseI1);
2151dd6e37aSJohannes Doerfert 
216bfb6a968STobias Grosser     // Since the other branch is hence ignored we mark it as unreachable and
217bfb6a968STobias Grosser     // adjust the dominator tree accordingly.
218bfb6a968STobias Grosser     auto *ExitingBlock = StartBlock->getUniqueSuccessor();
219bfb6a968STobias Grosser     assert(ExitingBlock);
220bfb6a968STobias Grosser     auto *MergeBlock = ExitingBlock->getUniqueSuccessor();
221bfb6a968STobias Grosser     assert(MergeBlock);
222bfb6a968STobias Grosser     markBlockUnreachable(*StartBlock, Builder);
223bfb6a968STobias Grosser     markBlockUnreachable(*ExitingBlock, Builder);
224ef74443cSJohannes Doerfert     auto *ExitingBB = S.getExitingBlock();
225bfb6a968STobias Grosser     assert(ExitingBB);
22678ae52f0SPhilip Pfaffe     DT.changeImmediateDominator(MergeBlock, ExitingBB);
22778ae52f0SPhilip Pfaffe     DT.eraseNode(ExitingBlock);
228bfb6a968STobias Grosser 
229bfb6a968STobias Grosser     isl_ast_node_free(AstRoot);
2301dd6e37aSJohannes Doerfert   } else {
23109e3697fSJohannes Doerfert     NodeBuilder.addParameters(S.getContext());
23278ae52f0SPhilip Pfaffe     Value *RTC = NodeBuilder.createRTC(AI.getRunCondition());
233404a0f81SJohannes Doerfert 
2343717aa5dSTobias Grosser     Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC);
235b738ffa8SMichael Kruse 
236b738ffa8SMichael Kruse     // Explicitly set the insert point to the end of the block to avoid that a
237b738ffa8SMichael Kruse     // split at the builder's current
238b738ffa8SMichael Kruse     // insert position would move the malloc calls to the wrong BasicBlock.
239b738ffa8SMichael Kruse     // Ideally we would just split the block during allocation of the new
240b738ffa8SMichael Kruse     // arrays, but this would break the assumption that there are no blocks
241b738ffa8SMichael Kruse     // between polly.start and polly.exiting (at this point).
242b738ffa8SMichael Kruse     Builder.SetInsertPoint(StartBlock->getTerminator());
2433717aa5dSTobias Grosser 
2443717aa5dSTobias Grosser     NodeBuilder.create(AstRoot);
2458ed5e599STobias Grosser     NodeBuilder.finalize();
24678ae52f0SPhilip Pfaffe     fixRegionInfo(*EnteringBB->getParent(), *R->getParent(), RI);
2471dd6e37aSJohannes Doerfert   }
248ecff11dcSJohannes Doerfert 
2496a6a671cSJohannes Doerfert   Function *F = EnteringBB->getParent();
25078ae52f0SPhilip Pfaffe   verifyGeneratedFunction(S, *F, AI);
251a9dc5294SJohannes Doerfert   for (auto *SubF : NodeBuilder.getParallelSubfunctions())
25278ae52f0SPhilip Pfaffe     verifyGeneratedFunction(S, *SubF, AI);
253652f7808STobias Grosser 
2544c86a1d9SMichael Kruse   // Mark the function such that we run additional cleanup passes on this
2554c86a1d9SMichael Kruse   // function (e.g. mem2reg to rediscover phi nodes).
2564c86a1d9SMichael Kruse   F->addFnAttr("polly-optimized");
25709d30697STobias Grosser   return true;
25809d30697STobias Grosser }
25909d30697STobias Grosser 
26078ae52f0SPhilip Pfaffe class CodeGeneration : public ScopPass {
26178ae52f0SPhilip Pfaffe public:
26278ae52f0SPhilip Pfaffe   static char ID;
26378ae52f0SPhilip Pfaffe 
26478ae52f0SPhilip Pfaffe   CodeGeneration() : ScopPass(ID) {}
26578ae52f0SPhilip Pfaffe 
266a6d48f59SMichael Kruse   /// The data layout used.
26778ae52f0SPhilip Pfaffe   const DataLayout *DL;
26878ae52f0SPhilip Pfaffe 
26978ae52f0SPhilip Pfaffe   /// @name The analysis passes we need to generate code.
27078ae52f0SPhilip Pfaffe   ///
27178ae52f0SPhilip Pfaffe   ///{
27278ae52f0SPhilip Pfaffe   LoopInfo *LI;
27378ae52f0SPhilip Pfaffe   IslAstInfo *AI;
27478ae52f0SPhilip Pfaffe   DominatorTree *DT;
27578ae52f0SPhilip Pfaffe   ScalarEvolution *SE;
27678ae52f0SPhilip Pfaffe   RegionInfo *RI;
27778ae52f0SPhilip Pfaffe   ///}
27878ae52f0SPhilip Pfaffe 
27978ae52f0SPhilip Pfaffe   /// Generate LLVM-IR for the SCoP @p S.
28078ae52f0SPhilip Pfaffe   bool runOnScop(Scop &S) override {
281*02ca346eSSingapuram Sanjay Srivallabh     // Skip SCoPs in case they're already code-generated by PPCGCodeGeneration.
282*02ca346eSSingapuram Sanjay Srivallabh     if (S.isToBeSkipped())
283*02ca346eSSingapuram Sanjay Srivallabh       return false;
284*02ca346eSSingapuram Sanjay Srivallabh 
28578ae52f0SPhilip Pfaffe     AI = &getAnalysis<IslAstInfoWrapperPass>().getAI();
28678ae52f0SPhilip Pfaffe     LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
28778ae52f0SPhilip Pfaffe     DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
28878ae52f0SPhilip Pfaffe     SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
28978ae52f0SPhilip Pfaffe     DL = &S.getFunction().getParent()->getDataLayout();
29078ae52f0SPhilip Pfaffe     RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
29178ae52f0SPhilip Pfaffe     return CodeGen(S, *AI, *LI, *DT, *SE, *RI);
29278ae52f0SPhilip Pfaffe   }
29378ae52f0SPhilip Pfaffe 
294c80d6979STobias Grosser   /// Register all analyses and transformation required.
29509d30697STobias Grosser   void getAnalysisUsage(AnalysisUsage &AU) const override {
29609d30697STobias Grosser     AU.addRequired<DominatorTreeWrapperPass>();
2972b852e2eSPhilip Pfaffe     AU.addRequired<IslAstInfoWrapperPass>();
29809d30697STobias Grosser     AU.addRequired<RegionInfoPass>();
299c5bcf246STobias Grosser     AU.addRequired<ScalarEvolutionWrapperPass>();
3005cc87e3aSPhilip Pfaffe     AU.addRequired<ScopDetectionWrapperPass>();
30199191c78SJohannes Doerfert     AU.addRequired<ScopInfoRegionPass>();
30209d30697STobias Grosser     AU.addRequired<LoopInfoWrapperPass>();
30309d30697STobias Grosser 
30409d30697STobias Grosser     AU.addPreserved<DependenceInfo>();
30509d30697STobias Grosser 
30666ef16b2SChandler Carruth     AU.addPreserved<AAResultsWrapperPass>();
30766ef16b2SChandler Carruth     AU.addPreserved<BasicAAWrapperPass>();
30809d30697STobias Grosser     AU.addPreserved<LoopInfoWrapperPass>();
30909d30697STobias Grosser     AU.addPreserved<DominatorTreeWrapperPass>();
31066ef16b2SChandler Carruth     AU.addPreserved<GlobalsAAWrapperPass>();
3112b852e2eSPhilip Pfaffe     AU.addPreserved<IslAstInfoWrapperPass>();
3125cc87e3aSPhilip Pfaffe     AU.addPreserved<ScopDetectionWrapperPass>();
313c5bcf246STobias Grosser     AU.addPreserved<ScalarEvolutionWrapperPass>();
31466ef16b2SChandler Carruth     AU.addPreserved<SCEVAAWrapperPass>();
31509d30697STobias Grosser 
31609d30697STobias Grosser     // FIXME: We do not yet add regions for the newly generated code to the
31709d30697STobias Grosser     //        region tree.
31809d30697STobias Grosser     AU.addPreserved<RegionInfoPass>();
31999191c78SJohannes Doerfert     AU.addPreserved<ScopInfoRegionPass>();
32009d30697STobias Grosser   }
32109d30697STobias Grosser };
322522478d2STobias Grosser } // namespace
32309d30697STobias Grosser 
32478ae52f0SPhilip Pfaffe PreservedAnalyses
32578ae52f0SPhilip Pfaffe polly::CodeGenerationPass::run(Scop &S, ScopAnalysisManager &SAM,
32678ae52f0SPhilip Pfaffe                                ScopStandardAnalysisResults &AR, SPMUpdater &U) {
32778ae52f0SPhilip Pfaffe   auto &AI = SAM.getResult<IslAstAnalysis>(S, AR);
32878ae52f0SPhilip Pfaffe   if (CodeGen(S, AI, AR.LI, AR.DT, AR.SE, AR.RI))
32978ae52f0SPhilip Pfaffe     return PreservedAnalyses::none();
33078ae52f0SPhilip Pfaffe 
33178ae52f0SPhilip Pfaffe   return PreservedAnalyses::all();
33278ae52f0SPhilip Pfaffe }
33378ae52f0SPhilip Pfaffe 
33409d30697STobias Grosser char CodeGeneration::ID = 1;
33509d30697STobias Grosser 
33609d30697STobias Grosser Pass *polly::createCodeGenerationPass() { return new CodeGeneration(); }
33709d30697STobias Grosser 
33809d30697STobias Grosser INITIALIZE_PASS_BEGIN(CodeGeneration, "polly-codegen",
33909d30697STobias Grosser                       "Polly - Create LLVM-IR from SCoPs", false, false);
34009d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(DependenceInfo);
34109d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass);
34209d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass);
34309d30697STobias Grosser INITIALIZE_PASS_DEPENDENCY(RegionInfoPass);
344c5bcf246STobias Grosser INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass);
3455cc87e3aSPhilip Pfaffe INITIALIZE_PASS_DEPENDENCY(ScopDetectionWrapperPass);
34609d30697STobias Grosser INITIALIZE_PASS_END(CodeGeneration, "polly-codegen",
34709d30697STobias Grosser                     "Polly - Create LLVM-IR from SCoPs", false, false)
348