[PM] Properly require and preserve OptimizationRemarkEmitter. NFCI.
[polly-mirror.git] / include / polly / PolyhedralInfo.h
blob54d5de9e251b3e8eeec84de946644b6db0090624
1 //===- polly/PolyhedralInfo.h - PolyhedralInfo class definition -*- 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 /// This file contains the declaration of the PolyhedralInfo class, which will
11 /// provide an interface to expose polyhedral analysis information of Polly.
12 ///
13 /// This is work in progress. We will add more API's as and when deemed
14 /// required.
15 //===----------------------------------------------------------------------===///
17 #ifndef POLLY_POLYHEDRAL_INFO_H
18 #define POLLY_POLYHEDRAL_INFO_H
20 #include "llvm/Pass.h"
21 #include "isl/ctx.h"
22 #include "isl/union_map.h"
24 namespace llvm {
25 class Loop;
26 } // namespace llvm
28 namespace polly {
30 class Scop;
31 class ScopInfo;
32 class DependenceInfoWrapperPass;
34 class PolyhedralInfo : public llvm::FunctionPass {
35 public:
36 static char ID; // Pass identification, replacement for typeid
38 /// Construct a new PolyhedralInfo pass.
39 PolyhedralInfo() : FunctionPass(ID) {}
40 ~PolyhedralInfo() {}
42 /// Check if a given loop is parallel.
43 ///
44 /// @param L The loop.
45 ///
46 /// @return Returns true, if loop is parallel false otherwise.
47 bool isParallel(llvm::Loop *L) const;
49 /// Return the SCoP containing the @p L loop.
50 ///
51 /// @param L The loop.
52 ///
53 /// @return Returns the SCoP containing the given loop.
54 /// Returns null if the loop is not contained in any SCoP.
55 const Scop *getScopContainingLoop(llvm::Loop *L) const;
57 /// Computes the partial schedule for the given @p L loop.
58 ///
59 /// @param S The SCoP containing the given loop
60 /// @param L The loop.
61 ///
62 /// @return Returns the partial schedule for the given loop
63 __isl_give isl_union_map *getScheduleForLoop(const Scop *S,
64 llvm::Loop *L) const;
66 /// Get the SCoP and dependence analysis information for @p F.
67 bool runOnFunction(llvm::Function &F) override;
69 /// Release the internal memory.
70 void releaseMemory() override {}
72 /// Print to @p OS if each dimension of a loop nest is parallel or not.
73 void print(llvm::raw_ostream &OS,
74 const llvm::Module *M = nullptr) const override;
76 /// Register all analyses and transformation required.
77 void getAnalysisUsage(llvm::AnalysisUsage &AU) const override;
79 private:
80 /// Check if a given loop is parallel or vectorizable.
81 ///
82 /// @param L The loop.
83 /// @param MinDepDistPtr If not nullptr, the minimal dependence distance will
84 /// be returned at the address of that pointer
85 ///
86 /// @return Returns true if loop is parallel or vectorizable, false
87 /// otherwise.
88 bool checkParallel(llvm::Loop *L,
89 __isl_give isl_pw_aff **MinDepDistPtr = nullptr) const;
91 ScopInfo *SI;
92 DependenceInfoWrapperPass *DI;
95 } // end namespace polly
97 namespace llvm {
98 class PassRegistry;
99 void initializePolyhedralInfoPass(llvm::PassRegistry &);
100 } // namespace llvm
102 #endif