Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:48:21

0001 //===------ Simplify.h ------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Simplify a SCoP by removing unnecessary statements and accesses.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef POLLY_TRANSFORM_SIMPLIFY_H
0014 #define POLLY_TRANSFORM_SIMPLIFY_H
0015 
0016 #include "polly/ScopPass.h"
0017 #include "llvm/ADT/SmallVector.h"
0018 
0019 namespace llvm {
0020 class PassRegistry;
0021 class Pass;
0022 } // namespace llvm
0023 
0024 namespace polly {
0025 class MemoryAccess;
0026 class ScopStmt;
0027 
0028 /// Return a vector that contains MemoryAccesses in the order in
0029 /// which they are executed.
0030 ///
0031 /// The order is:
0032 /// - Implicit reads (BlockGenerator::generateScalarLoads)
0033 /// - Explicit reads and writes (BlockGenerator::generateArrayLoad,
0034 ///   BlockGenerator::generateArrayStore)
0035 ///   - In block statements, the accesses are in order in which their
0036 ///     instructions are executed.
0037 ///   - In region statements, that order of execution is not predictable at
0038 ///     compile-time.
0039 /// - Implicit writes (BlockGenerator::generateScalarStores)
0040 ///   The order in which implicit writes are executed relative to each other is
0041 ///   undefined.
0042 llvm::SmallVector<MemoryAccess *, 32> getAccessesInOrder(ScopStmt &Stmt);
0043 
0044 /// Create a Simplify pass
0045 ///
0046 /// @param CallNo Disambiguates this instance for when there are multiple
0047 ///               instances of this pass in the pass manager. It is used only to
0048 ///               keep the statistics apart and has no influence on the
0049 ///               simplification itself.
0050 ///
0051 /// @return The Simplify pass.
0052 llvm::Pass *createSimplifyWrapperPass(int CallNo = 0);
0053 llvm::Pass *createSimplifyPrinterLegacyPass(llvm::raw_ostream &OS);
0054 
0055 struct SimplifyPass final : PassInfoMixin<SimplifyPass> {
0056   SimplifyPass(int CallNo = 0) : CallNo(CallNo) {}
0057 
0058   llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
0059                               ScopStandardAnalysisResults &AR, SPMUpdater &U);
0060 
0061 private:
0062   int CallNo;
0063 };
0064 
0065 struct SimplifyPrinterPass final : PassInfoMixin<SimplifyPrinterPass> {
0066   SimplifyPrinterPass(raw_ostream &OS, int CallNo = 0)
0067       : OS(OS), CallNo(CallNo) {}
0068 
0069   PreservedAnalyses run(Scop &S, ScopAnalysisManager &,
0070                         ScopStandardAnalysisResults &, SPMUpdater &);
0071 
0072 private:
0073   raw_ostream &OS;
0074   int CallNo;
0075 };
0076 } // namespace polly
0077 
0078 namespace llvm {
0079 void initializeSimplifyWrapperPassPass(llvm::PassRegistry &);
0080 void initializeSimplifyPrinterLegacyPassPass(llvm::PassRegistry &);
0081 } // namespace llvm
0082 
0083 #endif /* POLLY_TRANSFORM_SIMPLIFY_H */