LLZK
3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Toggle main menu visibility
Loading...
Searching...
No Matches
WitnessSelection.h
Go to the documentation of this file.
1
//===-- WitnessSelection.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 "
WitgenDriver.h
"
13
14
#include "
llzk/Dialect/Function/IR/Ops.h
"
15
#include "
llzk/Dialect/Struct/IR/Ops.h
"
16
17
#include <llvm/ADT/SmallVector.h>
18
#include <llvm/Support/Error.h>
19
#include <llvm/Support/JSON.h>
20
21
#include <string>
22
23
namespace
llzk::witgen
{
24
26
struct
InputBinding
{
27
std::string
name
;
28
mlir::Type
type
;
29
unsigned
index
= 0;
30
};
31
33
struct
OutputBinding
{
34
llvm::SmallVector<std::string>
path
;
35
mlir::Type
type
;
36
};
37
39
bool
memberIsSignal
(
component::StructDefOp
owner,
component::MemberDefOp
member);
40
42
llvm::SmallVector<InputBinding>
collectInputBindings
(
llzk::function::FuncDefOp
computeFunc);
43
45
mlir::FailureOr<llvm::SmallVector<OutputBinding>>
collectOutputBindings
(
46
component::StructDefOp
mainDef, mlir::SymbolTableCollection &tables, mlir::Operation *origin,
47
OutputScope
scope
48
);
49
51
llvm::json::Value
buildSignalsJSONObject
(
52
llvm::ArrayRef<OutputBinding> bindings, llvm::ArrayRef<llvm::json::Value> serializedLeaves
53
);
54
55
}
// namespace llzk::witgen
Ops.h
Ops.h
WitgenDriver.h
llzk::component::MemberDefOp
Definition
Ops.h.inc:307
llzk::component::StructDefOp
Definition
Ops.h.inc:1148
llzk::function::FuncDefOp
Definition
Ops.h.inc:633
llzk::witgen
Definition
Errors.h:15
llzk::witgen::collectInputBindings
llvm::SmallVector< InputBinding > collectInputBindings(function::FuncDefOp computeFunc)
Collect stable JSON bindings for the main compute inputs.
Definition
WitnessSelection.cpp:157
llzk::witgen::OutputScope
OutputScope
Select the JSON scope emitted by llzk-witgen.
Definition
WitgenDriver.h:34
llzk::witgen::collectOutputBindings
FailureOr< llvm::SmallVector< OutputBinding > > collectOutputBindings(component::StructDefOp mainDef, SymbolTableCollection &tables, Operation *origin, OutputScope scope)
Collect the selected output bindings for the requested scope.
Definition
WitnessSelection.cpp:173
llzk::witgen::buildSignalsJSONObject
llvm::json::Value buildSignalsJSONObject(ArrayRef< OutputBinding > bindings, ArrayRef< llvm::json::Value > serializedLeaves)
Assemble a nested JSON object from selected witness leaves.
Definition
WitnessSelection.cpp:197
llzk::witgen::memberIsSignal
bool memberIsSignal(component::StructDefOp owner, component::MemberDefOp member)
Return true iff the member is considered a witness signal.
Definition
WitnessSelection.cpp:152
llzk::witgen::InputBinding
Describe one JSON-visible main input binding.
Definition
WitnessSelection.h:26
llzk::witgen::InputBinding::index
unsigned index
Definition
WitnessSelection.h:29
llzk::witgen::InputBinding::name
std::string name
Definition
WitnessSelection.h:27
llzk::witgen::InputBinding::type
mlir::Type type
Definition
WitnessSelection.h:28
llzk::witgen::OutputBinding
Describe one selected witness output leaf.
Definition
WitnessSelection.h:33
llzk::witgen::OutputBinding::path
llvm::SmallVector< std::string > path
Definition
WitnessSelection.h:34
llzk::witgen::OutputBinding::type
mlir::Type type
Definition
WitnessSelection.h:35
tools
llzk-witgen
WitnessSelection.h
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.