1 //===------ PPCGCodeGeneration.cpp - Polly Accelerator Code Generation. ---===// 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 // Take a scop created by ScopInfo and map it to GPU code using the ppcg 11 // GPU mapping strategy. 12 // 13 //===----------------------------------------------------------------------===// 14 15 #include "polly/CodeGen/IslNodeBuilder.h" 16 #include "polly/DependenceInfo.h" 17 #include "polly/LinkAllPasses.h" 18 #include "polly/ScopInfo.h" 19 #include "llvm/Analysis/AliasAnalysis.h" 20 #include "llvm/Analysis/BasicAliasAnalysis.h" 21 #include "llvm/Analysis/GlobalsModRef.h" 22 #include "llvm/Analysis/PostDominators.h" 23 #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" 24 25 #include "llvm/Support/Debug.h" 26 27 using namespace polly; 28 using namespace llvm; 29 30 #define DEBUG_TYPE "polly-codegen-ppcg" 31 32 namespace { 33 class PPCGCodeGeneration : public ScopPass { 34 public: 35 static char ID; 36 37 PPCGCodeGeneration() : ScopPass(ID) {} 38 39 bool runOnScop(Scop &S) override { return true; } 40 41 void printScop(raw_ostream &, Scop &) const override {} 42 43 void getAnalysisUsage(AnalysisUsage &AU) const override { 44 AU.addRequired<DominatorTreeWrapperPass>(); 45 AU.addRequired<RegionInfoPass>(); 46 AU.addRequired<ScalarEvolutionWrapperPass>(); 47 AU.addRequired<ScopDetection>(); 48 AU.addRequired<ScopInfoRegionPass>(); 49 AU.addRequired<LoopInfoWrapperPass>(); 50 51 AU.addPreserved<AAResultsWrapperPass>(); 52 AU.addPreserved<BasicAAWrapperPass>(); 53 AU.addPreserved<LoopInfoWrapperPass>(); 54 AU.addPreserved<DominatorTreeWrapperPass>(); 55 AU.addPreserved<GlobalsAAWrapperPass>(); 56 AU.addPreserved<PostDominatorTreeWrapperPass>(); 57 AU.addPreserved<ScopDetection>(); 58 AU.addPreserved<ScalarEvolutionWrapperPass>(); 59 AU.addPreserved<SCEVAAWrapperPass>(); 60 61 // FIXME: We do not yet add regions for the newly generated code to the 62 // region tree. 63 AU.addPreserved<RegionInfoPass>(); 64 AU.addPreserved<ScopInfoRegionPass>(); 65 } 66 }; 67 } 68 69 char PPCGCodeGeneration::ID = 1; 70 71 Pass *polly::createPPCGCodeGenerationPass() { return new PPCGCodeGeneration(); } 72 73 INITIALIZE_PASS_BEGIN(PPCGCodeGeneration, "polly-codegen-ppcg", 74 "Polly - Apply PPCG translation to SCOP", false, false) 75 INITIALIZE_PASS_DEPENDENCY(DependenceInfo); 76 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass); 77 INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass); 78 INITIALIZE_PASS_DEPENDENCY(RegionInfoPass); 79 INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass); 80 INITIALIZE_PASS_DEPENDENCY(ScopDetection); 81 INITIALIZE_PASS_END(PPCGCodeGeneration, "polly-codegen-ppcg", 82 "Polly - Apply PPCG translation to SCOP", false, false) 83