1 | //===------ DeLICM.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 | // Undo the effect of Loop Invariant Code Motion (LICM) and |
10 | // GVN Partial Redundancy Elimination (PRE) on SCoP-level. |
11 | // |
12 | // Namely, remove register/scalar dependencies by mapping them back to array |
13 | // elements. |
14 | // |
15 | //===----------------------------------------------------------------------===// |
16 | |
17 | #ifndef POLLY_DELICM_H |
18 | #define POLLY_DELICM_H |
19 | |
20 | #include "polly/ScopPass.h" |
21 | #include "isl/isl-noexceptions.h" |
22 | |
23 | namespace llvm { |
24 | class PassRegistry; |
25 | class Pass; |
26 | class raw_ostream; |
27 | } // namespace llvm |
28 | |
29 | namespace polly { |
30 | /// Create a new DeLICM pass instance. |
31 | llvm::Pass *createDeLICMWrapperPass(); |
32 | llvm::Pass *createDeLICMPrinterLegacyPass(llvm::raw_ostream &OS); |
33 | |
34 | struct DeLICMPass final : llvm::PassInfoMixin<DeLICMPass> { |
35 | DeLICMPass() {} |
36 | |
37 | llvm::PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM, |
38 | ScopStandardAnalysisResults &SAR, SPMUpdater &U); |
39 | }; |
40 | |
41 | struct DeLICMPrinterPass final : llvm::PassInfoMixin<DeLICMPrinterPass> { |
42 | DeLICMPrinterPass(raw_ostream &OS) : OS(OS) {} |
43 | |
44 | PreservedAnalyses run(Scop &S, ScopAnalysisManager &, |
45 | ScopStandardAnalysisResults &SAR, SPMUpdater &); |
46 | |
47 | private: |
48 | llvm::raw_ostream &OS; |
49 | }; |
50 | |
51 | /// Determine whether two lifetimes are conflicting. |
52 | /// |
53 | /// Used by unittesting. |
54 | bool isConflicting(isl::union_set ExistingOccupied, |
55 | isl::union_set ExistingUnused, isl::union_map ExistingKnown, |
56 | isl::union_map ExistingWrites, |
57 | isl::union_set ProposedOccupied, |
58 | isl::union_set ProposedUnused, isl::union_map ProposedKnown, |
59 | isl::union_map ProposedWrites, |
60 | llvm::raw_ostream *OS = nullptr, unsigned Indent = 0); |
61 | |
62 | } // namespace polly |
63 | |
64 | namespace llvm { |
65 | void initializeDeLICMWrapperPassPass(llvm::PassRegistry &); |
66 | void initializeDeLICMPrinterLegacyPassPass(llvm::PassRegistry &); |
67 | } // namespace llvm |
68 | |
69 | #endif /* POLLY_DELICM_H */ |
70 | |