LLZK
3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
EffectHelper.h
Go to the documentation of this file.
1
//===-- EffectHelper.h ------------------------------------------*- C++ -*-===//
2
//
3
// Part of the LLZK Project, under the Apache License v2.0.
4
// See LICENSE.txt for license information.
5
// Copyright 2026 Project LLZK
6
// SPDX-License-Identifier: Apache-2.0
7
//
8
//===----------------------------------------------------------------------===//
9
10
#pragma once
11
12
#include <mlir/IR/Operation.h>
13
#include <mlir/Interfaces/SideEffectInterfaces.h>
14
15
#include <llvm/ADT/STLExtras.h>
16
17
namespace
llzk
{
18
21
inline
bool
hasReadEffect
(mlir::Operation *op) {
22
auto
effects = mlir::getEffectsRecursively(op);
23
return
effects && llvm::any_of(*effects, [](
const
mlir::MemoryEffects::EffectInstance &effect) {
24
return
llvm::isa<mlir::MemoryEffects::Read>(effect.getEffect());
25
});
26
}
27
30
inline
bool
hasUnknownOrNonReadEffect
(mlir::Operation *op) {
31
auto
effects = mlir::getEffectsRecursively(op);
32
return
!effects || llvm::any_of(*effects, [](
const
mlir::MemoryEffects::EffectInstance &effect) {
33
return
!llvm::isa<mlir::MemoryEffects::Read>(effect.getEffect());
34
});
35
}
36
37
}
// namespace llzk
llzk
Definition
AnalysisPassEnums.cpp:19
llzk::hasReadEffect
bool hasReadEffect(mlir::Operation *op)
Returns true when op has a memory read effect.
Definition
EffectHelper.h:21
llzk::hasUnknownOrNonReadEffect
bool hasUnknownOrNonReadEffect(mlir::Operation *op)
Returns true when op may have an unknown effect or any effect other than memory read.
Definition
EffectHelper.h:30
include
llzk
Util
EffectHelper.h
Generated by
1.14.0
Copyright 2025 Veridise Inc. under the Apache License v2.0. Copyright 2026 Project LLZK under the Apache License v2.0.