1 //===- ScopPass.cpp - The base class of Passes that operate on Polly IR ---===// 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 // This file contains the definitions of the ScopPass members. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #include "polly/ScopPass.h" 15 #include "polly/ScopInfo.h" 16 17 using namespace llvm; 18 using namespace polly; 19 20 bool ScopPass::runOnRegion(Region *R, RGPassManager &RGM) { 21 S = 0; 22 23 if ((S = getAnalysis<ScopInfo>().getScop())) 24 return runOnScop(*S); 25 26 return false; 27 } 28 29 isl_ctx *ScopPass::getIslContext() { 30 assert(S && "Not in on a Scop!"); 31 return S->getCtx(); 32 } 33 34 void ScopPass::print(raw_ostream &OS, const Module *M) const { 35 if (S) 36 printScop(OS); 37 } 38 39 void ScopPass::getAnalysisUsage(AnalysisUsage &AU) const { 40 AU.addRequired<ScopInfo>(); 41 AU.setPreservesAll(); 42 } 43