1 //===------ DeLICM.cpp -----------------------------------------*- C++ -*-===// 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 // Undo the effect of Loop Invariant Code Motion (LICM) and 11 // GVN Partial Redundancy Elimination (PRE) on SCoP-level. 12 // 13 // Namely, remove register/scalar dependencies by mapping them back to array 14 // elements. 15 // 16 //===----------------------------------------------------------------------===// 17 18 #include "polly/DeLICM.h" 19 #include "polly/ScopInfo.h" 20 #include "polly/ScopPass.h" 21 #define DEBUG_TYPE "polly-delicm" 22 23 using namespace polly; 24 using namespace llvm; 25 26 namespace { 27 28 class DeLICM : public ScopPass { 29 private: 30 DeLICM(const DeLICM &) = delete; 31 const DeLICM &operator=(const DeLICM &) = delete; 32 33 public: 34 static char ID; 35 explicit DeLICM() : ScopPass(ID) {} 36 37 virtual void getAnalysisUsage(AnalysisUsage &AU) const override { 38 AU.addRequiredTransitive<ScopInfoRegionPass>(); 39 AU.setPreservesAll(); 40 } 41 42 virtual bool runOnScop(Scop &S) override { 43 // Free resources for previous scop's computation, if not yet done. 44 releaseMemory(); 45 46 // TODO: Run DeLICM algorithm 47 48 return false; 49 } 50 51 virtual void printScop(raw_ostream &OS, Scop &S) const override { 52 OS << "DeLICM result:\n"; 53 // TODO: Print analysis results and performed transformation details 54 } 55 56 virtual void releaseMemory() override { 57 // TODO: Release resources (eg. shared_ptr to isl_ctx) 58 } 59 }; 60 61 char DeLICM::ID; 62 } // anonymous namespace 63 64 Pass *polly::createDeLICMPass() { return new DeLICM(); } 65 66 INITIALIZE_PASS_BEGIN(DeLICM, "polly-delicm", "Polly - DeLICM/DePRE", false, 67 false) 68 INITIALIZE_PASS_DEPENDENCY(ScopInfoWrapperPass) 69 INITIALIZE_PASS_END(DeLICM, "polly-delicm", "Polly - DeLICM/DePRE", false, 70 false) 71