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 = nullptr;
22 
23   if ((S = getAnalysis<ScopInfoRegionPass>().getScop()))
24     return runOnScop(*S);
25 
26   return false;
27 }
28 
29 void ScopPass::print(raw_ostream &OS, const Module *M) const {
30   if (S)
31     printScop(OS, *S);
32 }
33 
34 void ScopPass::getAnalysisUsage(AnalysisUsage &AU) const {
35   AU.addRequired<ScopInfoRegionPass>();
36   AU.setPreservesAll();
37 }
38