Polly 19.0.0git
Simplify.h
Go to the documentation of this file.
1//===------ Simplify.h ------------------------------------------*- 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// Simplify a SCoP by removing unnecessary statements and accesses.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef POLLY_TRANSFORM_SIMPLIFY_H
14#define POLLY_TRANSFORM_SIMPLIFY_H
15
16#include "polly/ScopPass.h"
17#include "llvm/ADT/SmallVector.h"
18
19namespace llvm {
20class PassRegistry;
21class Pass;
22} // namespace llvm
23
24namespace polly {
25class MemoryAccess;
26class ScopStmt;
27
28/// Return a vector that contains MemoryAccesses in the order in
29/// which they are executed.
30///
31/// The order is:
32/// - Implicit reads (BlockGenerator::generateScalarLoads)
33/// - Explicit reads and writes (BlockGenerator::generateArrayLoad,
34/// BlockGenerator::generateArrayStore)
35/// - In block statements, the accesses are in order in which their
36/// instructions are executed.
37/// - In region statements, that order of execution is not predictable at
38/// compile-time.
39/// - Implicit writes (BlockGenerator::generateScalarStores)
40/// The order in which implicit writes are executed relative to each other is
41/// undefined.
42llvm::SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt);
43
44/// Create a Simplify pass
45///
46/// @param CallNo Disambiguates this instance for when there are multiple
47/// instances of this pass in the pass manager. It is used only to
48/// keep the statistics apart and has no influence on the
49/// simplification itself.
50///
51/// @return The Simplify pass.
52llvm::Pass *createSimplifyWrapperPass(int CallNo = 0);
53llvm::Pass *createSimplifyPrinterLegacyPass(llvm::raw_ostream &OS);
54
55struct SimplifyPass final : PassInfoMixin<SimplifyPass> {
57
58 llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
60
61private:
62 int CallNo;
63};
64
65struct SimplifyPrinterPass final : PassInfoMixin<SimplifyPrinterPass> {
66 SimplifyPrinterPass(raw_ostream &OS, int CallNo = 0)
67 : OS(OS), CallNo(CallNo) {}
68
69 PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
71
72private:
73 raw_ostream &OS;
74 int CallNo;
75};
76} // namespace polly
77
78namespace llvm {
79void initializeSimplifyWrapperPassPass(llvm::PassRegistry &);
80void initializeSimplifyPrinterLegacyPassPass(llvm::PassRegistry &);
81} // namespace llvm
82
83#endif /* POLLY_TRANSFORM_SIMPLIFY_H */
Static Control Part.
Definition: ScopInfo.h:1628
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
void initializeSimplifyWrapperPassPass(llvm::PassRegistry &)
void initializeSimplifyPrinterLegacyPassPass(llvm::PassRegistry &)
llvm::SmallVector< MemoryAccess *, 32 > getAccessesInOrder(ScopStmt &Stmt)
Return a vector that contains MemoryAccesses in the order in which they are executed.
Definition: Simplify.cpp:828
llvm::Pass * createSimplifyWrapperPass(int)
Create a Simplify pass.
Definition: Simplify.cpp:846
llvm::Pass * createSimplifyPrinterLegacyPass(llvm::raw_ostream &OS)
AnalysisManager< Scop, ScopStandardAnalysisResults & > ScopAnalysisManager
Definition: ScopPass.h:46
SimplifyPass(int CallNo=0)
Definition: Simplify.h:56
llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM, ScopStandardAnalysisResults &AR, SPMUpdater &U)
Definition: Simplify.cpp:816
SimplifyPrinterPass(raw_ostream &OS, int CallNo=0)
Definition: Simplify.h:66
PreservedAnalyses run(Scop &S, ScopAnalysisManager &, ScopStandardAnalysisResults &, SPMUpdater &)
Definition: Simplify.cpp:823