1 //===- polly/PolyhedralInfo.h - PolyhedralInfo class definition -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// This file contains the declaration of the PolyhedralInfo class, which will
11 /// provide an interface to expose polyhedral analysis information of Polly.
13 /// This is work in progress. We will add more API's as and when deemed
15 //===----------------------------------------------------------------------===///
17 #ifndef POLLY_POLYHEDRAL_INFO_H
18 #define POLLY_POLYHEDRAL_INFO_H
20 #include "llvm/Pass.h"
22 #include "isl/union_map.h"
32 class DependenceInfoWrapperPass
;
34 class PolyhedralInfo
: public llvm::FunctionPass
{
36 static char ID
; // Pass identification, replacement for typeid
38 /// Construct a new PolyhedralInfo pass.
39 PolyhedralInfo() : FunctionPass(ID
) {}
42 /// Check if a given loop is parallel.
44 /// @param L The loop.
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.
51 /// @param L The loop.
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.
59 /// @param S The SCoP containing the given loop
60 /// @param L The loop.
62 /// @return Returns the partial schedule for the given loop
63 __isl_give isl_union_map
*getScheduleForLoop(const Scop
*S
,
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
;
80 /// Check if a given loop is parallel or vectorizable.
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
86 /// @return Returns true if loop is parallel or vectorizable, false
88 bool checkParallel(llvm::Loop
*L
,
89 __isl_give isl_pw_aff
**MinDepDistPtr
= nullptr) const;
92 DependenceInfoWrapperPass
*DI
;
95 } // end namespace polly
99 void initializePolyhedralInfoPass(llvm::PassRegistry
&);