LLZK
2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
LLZKComputeConstrainToProductPass.h
Go to the documentation of this file.
1
//===-- LLZKComputeConstrainToProductPass.h ---------------------*- 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
#pragma once
11
12
#include "
llzk/Analysis/LightweightSignalEquivalenceAnalysis.h
"
13
#include "
llzk/Dialect/Function/IR/Ops.h
"
14
#include "
llzk/Dialect/Struct/IR/Ops.h
"
15
16
#include <mlir/Support/LogicalResult.h>
17
18
#include <vector>
19
20
namespace
llzk
{
21
22
class
ProductAligner
{
23
mlir::SymbolTableCollection &tables;
24
LightweightSignalEquivalenceAnalysis
&equivalence;
25
26
public
:
27
std::vector<component::StructDefOp>
alignedStructs
;
28
ProductAligner
(
29
mlir::SymbolTableCollection &_tables,
LightweightSignalEquivalenceAnalysis
&_equivalence
30
)
31
: tables {_tables}, equivalence {_equivalence} {}
32
33
// Given a @product function body, try to match up calls to @A::@compute and @A::@constrain for
34
// every sub-struct @A and replace them with a call to @A::@product
35
mlir::LogicalResult
alignCalls
(
function::FuncDefOp
product);
36
37
// Given a StructDefOp @root, replace the @root::@compute and @root::@constrain functions with a
38
// @root::@product
39
function::FuncDefOp
alignFuncs
(
40
component::StructDefOp
root,
function::FuncDefOp
compute,
function::FuncDefOp
constrain
41
);
42
};
43
44
}
// namespace llzk
Ops.h
LightweightSignalEquivalenceAnalysis.h
Ops.h
llzk::LightweightSignalEquivalenceAnalysis
Definition
LightweightSignalEquivalenceAnalysis.h:24
llzk::ProductAligner::alignedStructs
std::vector< component::StructDefOp > alignedStructs
Definition
LLZKComputeConstrainToProductPass.h:27
llzk::ProductAligner::alignFuncs
function::FuncDefOp alignFuncs(component::StructDefOp root, function::FuncDefOp compute, function::FuncDefOp constrain)
Definition
LLZKComputeConstrainToProductPass.cpp:46
llzk::ProductAligner::ProductAligner
ProductAligner(mlir::SymbolTableCollection &_tables, LightweightSignalEquivalenceAnalysis &_equivalence)
Definition
LLZKComputeConstrainToProductPass.h:28
llzk::ProductAligner::alignCalls
mlir::LogicalResult alignCalls(function::FuncDefOp product)
Definition
LLZKComputeConstrainToProductPass.cpp:108
llzk::component::StructDefOp
Definition
Ops.h.inc:1143
llzk::function::FuncDefOp
Definition
Ops.h.inc:620
llzk::constrain
Definition
Ops.cpp:25
llzk
Definition
AnalysisPassEnums.cpp:19
include
llzk
Transforms
LLZKComputeConstrainToProductPass.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.