LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
TransformationPasses.td
Go to the documentation of this file.
1//===-- TransformationPasses.td ----------------------------*- tablegen -*-===//
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#ifndef LLZK_DIALECT_STRUCT_TRANSFORMS_TRANSFORMATION_PASSES_TD
11#define LLZK_DIALECT_STRUCT_TRANSFORMS_TRANSFORMATION_PASSES_TD
12
13include "llzk/Pass/PassBase.td"
14
15def InlineStructsPass : LLZKPass<"llzk-inline-structs"> {
16 let summary = "Inlines nested structs (i.e., subcomponents).";
17 let description = [{
18 This pass inlines nested structs (i.e., subcomponents) at struct-type members and at calls to the
19 subcomponent compute/constrain functions. Inlining decisions are guided by the call graph of
20 "constrain" functions.
21
22 The `max-merge-complexity` parameter can be used to limit the complexity of the resulting structs such
23 that a potential inlining will not take place if doing so would push the sum of constraint and
24 multiplications in the combined struct over the limit. The default value `0` indicates no limits
25 which means all structs will be inlined into the Main struct.
26
27 This pass should be run after `llzk-flatten` to ensure structs do not have template parameters
28 because structs with template parameters cannot (currently) be inlined. Inlining is also not
29 (currently) supported for subcomponent structs stored in an array-type member.
30
31 This pass also assumes that all subcomponents that are created by calling a struct "@compute"
32 function are ultimately written to exactly one member within the current struct.
33 }];
34 let options = [Option<"maxComplexity", "max-merge-complexity", "uint64_t",
35 /* default: no limit */ "0",
36 "Maximum allowed constraint+multiplications in merged "
37 "@constrain functions">,
38 ];
39}
40
41#endif // LLZK_DIALECT_STRUCT_TRANSFORMS_TRANSFORMATION_PASSES_TD