LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
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
16
17#include <llvm/ADT/SmallVector.h>
18#include <llvm/Support/Error.h>
19#include <llvm/Support/JSON.h>
20
21#include <string>
22
23namespace llzk::witgen {
24
27 std::string name;
28 mlir::Type type;
29 unsigned index = 0;
30};
31
34 llvm::SmallVector<std::string> path;
35 mlir::Type type;
36};
37
40
42llvm::SmallVector<InputBinding> collectInputBindings(llzk::function::FuncDefOp computeFunc);
43
45mlir::FailureOr<llvm::SmallVector<OutputBinding>> collectOutputBindings(
46 component::StructDefOp mainDef, mlir::SymbolTableCollection &tables, mlir::Operation *origin,
47 OutputScope scope
48);
49
51llvm::json::Value buildSignalsJSONObject(
52 llvm::ArrayRef<OutputBinding> bindings, llvm::ArrayRef<llvm::json::Value> serializedLeaves
53);
54
55} // namespace llzk::witgen
llvm::SmallVector< InputBinding > collectInputBindings(function::FuncDefOp computeFunc)
Collect stable JSON bindings for the main compute inputs.
OutputScope
Select the JSON scope emitted by llzk-witgen.
FailureOr< llvm::SmallVector< OutputBinding > > collectOutputBindings(component::StructDefOp mainDef, SymbolTableCollection &tables, Operation *origin, OutputScope scope)
Collect the selected output bindings for the requested scope.
llvm::json::Value buildSignalsJSONObject(ArrayRef< OutputBinding > bindings, ArrayRef< llvm::json::Value > serializedLeaves)
Assemble a nested JSON object from selected witness leaves.
bool memberIsSignal(component::StructDefOp owner, component::MemberDefOp member)
Return true iff the member is considered a witness signal.
Describe one JSON-visible main input binding.
Describe one selected witness output leaf.
llvm::SmallVector< std::string > path