diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-07-25 12:48:45 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2016-07-25 12:48:45 +0000 |
commit | 8031238017a5aa0294168ecec4ef90fc1b3b76b4 (patch) | |
tree | 94fa1b19fec6b7e2ee777a45bcc461785e782a46 /polly/include/polly/PolyhedralInfo.h | |
parent | 13c78e4d517dd6f4b8fa133f53e09a9e11596fc8 (diff) | |
download | bcm5719-llvm-8031238017a5aa0294168ecec4ef90fc1b3b76b4.tar.gz bcm5719-llvm-8031238017a5aa0294168ecec4ef90fc1b3b76b4.zip |
[GSoC] Add PolyhedralInfo pass - new interface to polly analysis
Adding a new pass PolyhedralInfo. This pass will be the interface to Polly.
Initially, we will provide the following interface:
- #IsParallel(Loop *L) - return a bool depending on whether the loop is
parallel or not for the given program order.
Patch by Utpal Bora <cs14mtech11017@iith.ac.in>
Differential Revision: https://reviews.llvm.org/D21486
llvm-svn: 276637
Diffstat (limited to 'polly/include/polly/PolyhedralInfo.h')
-rw-r--r-- | polly/include/polly/PolyhedralInfo.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/polly/include/polly/PolyhedralInfo.h b/polly/include/polly/PolyhedralInfo.h new file mode 100644 index 00000000000..3f2d6a39a66 --- /dev/null +++ b/polly/include/polly/PolyhedralInfo.h @@ -0,0 +1,101 @@ +//===- polly/PolyhedralInfo.h - PolyhedralInfo class definition -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// +/// This file contains the declaration of the PolyhedralInfo class, which will +/// provide an interface to expose polyhedral analysis information of Polly. +/// +/// This is work in progress. We will add more API's as an when deemed required. +//===----------------------------------------------------------------------===/// + +#ifndef POLLY_POLYHEDRAL_INFO_H +#define POLLY_POLYHEDRAL_INFO_H + +#include "llvm/Pass.h" +#include "isl/ctx.h" +#include "isl/union_map.h" + +namespace llvm { +class Loop; +} + +namespace polly { + +class Scop; +class ScopInfoWrapperPass; +class DependenceInfoWrapperPass; + +class PolyhedralInfo : public llvm::FunctionPass { +public: + static char ID; // Pass identification, replacement for typeid + + /// @brief Construct a new PolyhedralInfo pass. + PolyhedralInfo() : FunctionPass(ID) {} + ~PolyhedralInfo() {} + + /// @brief Check if a given loop is parallel. + /// + /// @param L The loop. + /// + /// @return Returns true, if loop is parallel false otherwise. + bool isParallel(llvm::Loop *L) const; + + /// @brief Return the SCoP containing the @p L loop. + /// + /// @param L The loop. + /// + /// @return Returns the SCoP containing the given loop. + /// Returns null if the loop is not contained in any SCoP. + const Scop *getScopContainingLoop(llvm::Loop *L) const; + + /// @brief Computes the partial schedule for the given @p L loop. + /// + /// @param S The SCoP containing the given loop + /// @param L The loop. + /// + /// @return Returns the partial schedule for the given loop + __isl_give isl_union_map *getScheduleForLoop(const Scop *S, + llvm::Loop *L) const; + + /// @brief Get the SCoP and dependence analysis information for @p F. + bool runOnFunction(llvm::Function &F) override; + + /// @brief Release the internal memory. + void releaseMemory() override {} + + /// @brief Print to @p OS if each dimension of a loop nest is parallel or not. + void print(llvm::raw_ostream &OS, + const llvm::Module *M = nullptr) const override; + + /// @brief Register all analyses and transformation required. + void getAnalysisUsage(llvm::AnalysisUsage &AU) const override; + +private: + /// @brief Check if a given loop is parallel or vectorizable. + /// + /// @param L The loop. + /// @param MinDepDistPtr If not nullptr, the minimal dependence distance will + /// be returned at the address of that pointer + /// + /// @return Returns true if loop is parallel or vectorizable, false + /// otherwise. + bool checkParallel(llvm::Loop *L, + __isl_give isl_pw_aff **MinDepDistPtr = nullptr) const; + + ScopInfoWrapperPass *SI; + DependenceInfoWrapperPass *DI; +}; + +} // end namespace polly + +namespace llvm { +class PassRegistry; +void initializePolyhedralInfoPass(llvm::PassRegistry &); +} + +#endif |