|
1 |
| -//===- ConstantSubgraphAnalysis.cpp - Constant subgraph analysis ----===// |
| 1 | +//===- ConstantSubgraphAnalyser.cpp - Constant subgraph analysis ----===// |
2 | 2 | //
|
3 | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
4 | 4 | // See https://llvm.org/LICENSE.txt for license information.
|
5 | 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
6 | 6 | //
|
7 | 7 | //===----------------------------------------------------------------------===//
|
8 |
| -#include "gc/Analysis/DataFlow/ConstantSubgraphAnalysis.h" |
| 8 | +#include "gc/Analysis/DataFlow/ConstantSubgraphAnalyser.h" |
9 | 9 | #include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
|
10 | 10 | #include "mlir/Analysis/DataFlow/SparseAnalysis.h"
|
11 | 11 | #include "mlir/Dialect/Arith/IR/Arith.h"
|
@@ -46,13 +46,13 @@ void InConstantSubgraph::print(raw_ostream &os) const {
|
46 | 46 | }
|
47 | 47 |
|
48 | 48 | //===----------------------------------------------------------------------===//
|
49 |
| -// ConstantSubgraphAnalysis |
| 49 | +// ConstantSubgraphAnalyser |
50 | 50 | //===----------------------------------------------------------------------===//
|
51 | 51 |
|
52 |
| -void ConstantSubgraphAnalysis::visitOperation( |
| 52 | +void ConstantSubgraphAnalyser::visitOperation( |
53 | 53 | Operation *op, ArrayRef<const Lattice<InConstantSubgraph> *> operands,
|
54 | 54 | ArrayRef<Lattice<InConstantSubgraph> *> results) {
|
55 |
| - LLVM_DEBUG(llvm::dbgs() << "ConstantSubgraphAnalysis: Visiting operation:\n" |
| 55 | + LLVM_DEBUG(llvm::dbgs() << "ConstantSubgraphAnalyser: Visiting operation:\n" |
56 | 56 | << *op << "\n");
|
57 | 57 |
|
58 | 58 | bool in = true;
|
@@ -92,7 +92,7 @@ void ConstantSubgraphAnalysis::visitOperation(
|
92 | 92 | }
|
93 | 93 | }
|
94 | 94 |
|
95 |
| -void ConstantSubgraphAnalysis::setToEntryState( |
| 95 | +void ConstantSubgraphAnalyser::setToEntryState( |
96 | 96 | Lattice<InConstantSubgraph> *lattice) {
|
97 | 97 | if (auto blockArg = cast<BlockArgument>(lattice->getPoint())) {
|
98 | 98 | auto parent_op = blockArg.getParentBlock()->getParentOp();
|
@@ -121,12 +121,12 @@ void ConstantSubgraphAnalysis::setToEntryState(
|
121 | 121 | }
|
122 | 122 |
|
123 | 123 | //===----------------------------------------------------------------------===//
|
124 |
| -// RunConstantSubgraphAnalysis |
| 124 | +// RunConstantSubgraphAnalyser |
125 | 125 | //===----------------------------------------------------------------------===//
|
126 | 126 |
|
127 | 127 | /// Get the operations whose inputs and outputs are all constant values.
|
128 | 128 | /// These operations will be put into a seperate subgraph.
|
129 |
| -void RunConstantSubgraphAnalysis::getConstantSubgraph(DataFlowSolver &solver, |
| 129 | +void RunConstantSubgraphAnalyser::getConstantSubgraph(DataFlowSolver &solver, |
130 | 130 | Operation *topFunc) {
|
131 | 131 | OpBuilder builder(topFunc->getContext());
|
132 | 132 | SmallVector<Operation *> constantOperations;
|
@@ -161,19 +161,19 @@ void RunConstantSubgraphAnalysis::getConstantSubgraph(DataFlowSolver &solver,
|
161 | 161 | }
|
162 | 162 | }
|
163 | 163 |
|
164 |
| -RunConstantSubgraphAnalysis::RunConstantSubgraphAnalysis() { |
| 164 | +RunConstantSubgraphAnalyser::RunConstantSubgraphAnalyser() { |
165 | 165 | solver.load<DeadCodeAnalysis>();
|
166 |
| - solver.load<ConstantSubgraphAnalysis>(); |
| 166 | + solver.load<ConstantSubgraphAnalyser>(); |
167 | 167 | }
|
168 | 168 |
|
169 |
| -void RunConstantSubgraphAnalysis::run(Operation *topFunc) { |
| 169 | +void RunConstantSubgraphAnalyser::run(Operation *topFunc) { |
170 | 170 | if (failed(solver.initializeAndRun(topFunc))) {
|
171 | 171 | return;
|
172 | 172 | }
|
173 | 173 | getConstantSubgraph(solver, topFunc);
|
174 | 174 | }
|
175 | 175 |
|
176 |
| -bool RunConstantSubgraphAnalysis::getInConstantSubgraph(Value val) { |
| 176 | +bool RunConstantSubgraphAnalyser::getInConstantSubgraph(Value val) { |
177 | 177 | auto *lattice = solver.lookupState<Lattice<InConstantSubgraph>>(val);
|
178 | 178 | const InConstantSubgraph &latticeValue = lattice->getValue();
|
179 | 179 | return latticeValue.getInConstantSubgraph();
|
|
0 commit comments