LLZK
3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Toggle main menu visibility
Loading...
Searching...
No Matches
AnalysisUtil.cpp
Go to the documentation of this file.
1
//===-- AnalysisUtil.cpp - Data-flow analysis utils -------------*- C++ -*-===//
2
//
3
// Part of the LLZK Project, under the Apache License v2.0.
4
// See LICENSE.txt for license information.
5
// Copyright 2025 Veridise Inc.
6
// SPDX-License-Identifier: Apache-2.0
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "
llzk/Analysis/AnalysisUtil.h
"
11
12
#include <mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h>
13
#include <mlir/Analysis/DataFlow/DeadCodeAnalysis.h>
14
#include <mlir/IR/Operation.h>
15
16
using namespace
mlir
;
17
18
using
Executable
= mlir::dataflow::Executable;
19
20
namespace
llzk::dataflow
{
21
22
void
loadRequiredAnalyses
(DataFlowSolver &solver) {
23
solver.load<mlir::dataflow::SparseConstantPropagation>();
24
solver.load<mlir::dataflow::DeadCodeAnalysis>();
25
}
26
27
LogicalResult
loadAndRunRequiredAnalyses
(DataFlowSolver &solver, Operation *op) {
28
loadRequiredAnalyses
(solver);
29
return
solver.initializeAndRun(op);
30
}
31
32
bool
isOperationLive
(DataFlowSolver &solver, Operation *op) {
33
if
(!op->getBlock()) {
34
return
true
;
35
}
36
if
(
const
auto
*exec =
37
solver.lookupState<
Executable
>(solver.getProgramPointBefore(op->getBlock()))) {
38
return
exec->isLive();
39
}
40
return
true
;
41
}
42
43
}
// namespace llzk::dataflow
Executable
mlir::dataflow::Executable Executable
Definition
AnalysisUtil.cpp:18
AnalysisUtil.h
llzk::dataflow
Definition
AnalysisUtil.cpp:20
llzk::dataflow::loadRequiredAnalyses
void loadRequiredAnalyses(DataFlowSolver &solver)
Definition
AnalysisUtil.cpp:22
llzk::dataflow::loadAndRunRequiredAnalyses
LogicalResult loadAndRunRequiredAnalyses(DataFlowSolver &solver, Operation *op)
Definition
AnalysisUtil.cpp:27
llzk::dataflow::isOperationLive
bool isOperationLive(DataFlowSolver &solver, Operation *op)
Definition
AnalysisUtil.cpp:32
mlir
Definition
ValueModel.h:30
lib
Analysis
AnalysisUtil.cpp
Generated by
1.17.0
Copyright 2025 Veridise Inc. under the Apache License v2.0. Copyright 2026 Project LLZK under the Apache License v2.0.