//===- DataFlowFramework.cpp - A generic framework for data-flow analysis -===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/Analysis/DataFlowFramework.h" #include "mlir/IR/Location.h" #include "mlir/IR/Operation.h" #include "mlir/IR/Value.h" #include "llvm/ADT/iterator.h" #include "llvm/Config/abi-breaking.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #define DEBUG_TYPE … #if LLVM_ENABLE_ABI_BREAKING_CHECKS #define DATAFLOW_DEBUG … #else #define DATAFLOW_DEBUG(X) … #endif // LLVM_ENABLE_ABI_BREAKING_CHECKS usingnamespacemlir; //===----------------------------------------------------------------------===// // GenericLatticeAnchor //===----------------------------------------------------------------------===// GenericLatticeAnchor::~GenericLatticeAnchor() = default; //===----------------------------------------------------------------------===// // AnalysisState //===----------------------------------------------------------------------===// AnalysisState::~AnalysisState() = default; void AnalysisState::addDependency(ProgramPoint dependent, DataFlowAnalysis *analysis) { … } void AnalysisState::dump() const { … } //===----------------------------------------------------------------------===// // LatticeAnchor //===----------------------------------------------------------------------===// void ProgramPoint::print(raw_ostream &os) const { … } void LatticeAnchor::print(raw_ostream &os) const { … } Location LatticeAnchor::getLoc() const { … } //===----------------------------------------------------------------------===// // DataFlowSolver //===----------------------------------------------------------------------===// LogicalResult DataFlowSolver::initializeAndRun(Operation *top) { … } void DataFlowSolver::propagateIfChanged(AnalysisState *state, ChangeResult changed) { … } //===----------------------------------------------------------------------===// // DataFlowAnalysis //===----------------------------------------------------------------------===// DataFlowAnalysis::~DataFlowAnalysis() = default; DataFlowAnalysis::DataFlowAnalysis(DataFlowSolver &solver) : … { … } void DataFlowAnalysis::addDependency(AnalysisState *state, ProgramPoint point) { … } void DataFlowAnalysis::propagateIfChanged(AnalysisState *state, ChangeResult changed) { … }