Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 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 | |||
| 19 | namespace llvm { |
||
| 20 | class PassRegistry; |
||
| 21 | class Pass; |
||
| 22 | } // namespace llvm |
||
| 23 | |||
| 24 | namespace polly { |
||
| 25 | class MemoryAccess; |
||
| 26 | class 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. |
||
| 42 | llvm::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. |
||
| 52 | llvm::Pass *createSimplifyWrapperPass(int CallNo = 0); |
||
| 53 | llvm::Pass *createSimplifyPrinterLegacyPass(llvm::raw_ostream &OS); |
||
| 54 | |||
| 55 | struct SimplifyPass final : PassInfoMixin<SimplifyPass> { |
||
| 56 | SimplifyPass(int CallNo = 0) : CallNo(CallNo) {} |
||
| 57 | |||
| 58 | llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM, |
||
| 59 | ScopStandardAnalysisResults &AR, SPMUpdater &U); |
||
| 60 | |||
| 61 | private: |
||
| 62 | int CallNo; |
||
| 63 | }; |
||
| 64 | |||
| 65 | struct SimplifyPrinterPass final : PassInfoMixin<SimplifyPrinterPass> { |
||
| 66 | SimplifyPrinterPass(raw_ostream &OS, int CallNo = 0) |
||
| 67 | : OS(OS), CallNo(CallNo) {} |
||
| 68 | |||
| 69 | PreservedAnalyses run(Scop &S, ScopAnalysisManager &, |
||
| 70 | ScopStandardAnalysisResults &, SPMUpdater &); |
||
| 71 | |||
| 72 | private: |
||
| 73 | raw_ostream &OS; |
||
| 74 | int CallNo; |
||
| 75 | }; |
||
| 76 | } // namespace polly |
||
| 77 | |||
| 78 | namespace llvm { |
||
| 79 | void initializeSimplifyWrapperPassPass(llvm::PassRegistry &); |
||
| 80 | void initializeSimplifyPrinterLegacyPassPass(llvm::PassRegistry &); |
||
| 81 | } // namespace llvm |
||
| 82 | |||
| 83 | #endif /* POLLY_TRANSFORM_SIMPLIFY_H */ |