Polly 20.0.0git
PolyhedralInfo.h
Go to the documentation of this file.
1//===- polly/PolyhedralInfo.h - PolyhedralInfo class definition -*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// This file contains the declaration of the PolyhedralInfo class, which will
10/// provide an interface to expose polyhedral analysis information of Polly.
11///
12/// This is work in progress. We will add more API's as and when deemed
13/// required.
14//===----------------------------------------------------------------------===///
15
16#ifndef POLLY_POLYHEDRAL_INFO_H
17#define POLLY_POLYHEDRAL_INFO_H
18
19#include "llvm/Pass.h"
20#include "isl/aff_type.h"
21#include "isl/ctx.h"
22#include "isl/union_map_type.h"
23
24namespace llvm {
25class Loop;
26} // namespace llvm
27
28namespace polly {
29
30class Scop;
31class ScopInfo;
32class DependenceInfoWrapperPass;
33
34class PolyhedralInfo final : public llvm::FunctionPass {
35public:
36 static char ID; // Pass identification, replacement for typeid
37
38 /// Construct a new PolyhedralInfo pass.
39 PolyhedralInfo() : FunctionPass(ID) {}
41
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;
48
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;
56
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
64 llvm::Loop *L) const;
65
66 /// Get the SCoP and dependence analysis information for @p F.
67 bool runOnFunction(llvm::Function &F) override;
68
69 /// Release the internal memory.
70 void releaseMemory() override {}
71
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;
75
76 /// Register all analyses and transformation required.
77 void getAnalysisUsage(llvm::AnalysisUsage &AU) const override;
78
79private:
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;
90
93};
94
95llvm::Pass *createPolyhedralInfoPrinterLegacyPass(llvm::raw_ostream &OS);
96} // end namespace polly
97
98namespace llvm {
99class PassRegistry;
100void initializePolyhedralInfoPass(llvm::PassRegistry &);
101void initializePolyhedralInfoPrinterLegacyPassPass(llvm::PassRegistry &);
102} // namespace llvm
103
104#endif
static RegisterPass< ScopPrinterWrapperPass > M("dot-scops", "Polly - Print Scops of function")
Construct a new DependenceInfoWrapper pass.
bool checkParallel(llvm::Loop *L, __isl_give isl_pw_aff **MinDepDistPtr=nullptr) const
Check if a given loop is parallel or vectorizable.
void getAnalysisUsage(llvm::AnalysisUsage &AU) const override
Register all analyses and transformation required.
bool isParallel(llvm::Loop *L) const
Check if a given loop is parallel.
DependenceInfoWrapperPass * DI
PolyhedralInfo()
Construct a new PolyhedralInfo pass.
const Scop * getScopContainingLoop(llvm::Loop *L) const
Return the SCoP containing the L loop.
void releaseMemory() override
Release the internal memory.
void print(llvm::raw_ostream &OS, const llvm::Module *M=nullptr) const override
Print to OS if each dimension of a loop nest is parallel or not.
__isl_give isl_union_map * getScheduleForLoop(const Scop *S, llvm::Loop *L) const
Computes the partial schedule for the given L loop.
bool runOnFunction(llvm::Function &F) override
Get the SCoP and dependence analysis information for F.
Static Control Part.
Definition: ScopInfo.h:1630
#define __isl_give
Definition: ctx.h:19
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
void initializePolyhedralInfoPrinterLegacyPassPass(llvm::PassRegistry &)
void initializePolyhedralInfoPass(llvm::PassRegistry &)
llvm::Pass * createPolyhedralInfoPrinterLegacyPass(llvm::raw_ostream &OS)