LLZK 0.1.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.td
Go to the documentation of this file.
1//===-- Ops.td ---------------------------------------------*- tablegen -*-===//
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#ifndef LLZK_OPS
11#define LLZK_OPS
12
13include "llzk/Dialect/LLZK/IR/Dialect.td"
14include "llzk/Dialect/Shared/Types.td"
15
16include "mlir/IR/OpAsmInterface.td"
17include "mlir/IR/OpBase.td"
18include "mlir/Interfaces/SideEffectInterfaces.td"
19
20//===------------------------------------------------------------------===//
21// Op Classes
22//===------------------------------------------------------------------===//
23
24class LLZKDialectOp<string mnemonic, list<Trait> traits = []>
25 : Op<LLZKDialect, mnemonic, traits>;
26
27def LLZK_NonDetOp
28 : LLZKDialectOp<"nondet", [ConstantLike, Pure,
29 DeclareOpInterfaceMethods<
30 OpAsmOpInterface, ["getAsmResultNames"]>]> {
31 let summary = "uninitialized variable";
32 let description = [{
33 This operation produces an SSA variable of the specified type but with
34 nondeterministic value.
35
36 This op can be used in `@constrain()` functions in place of expressions that
37 cannot be included in constraints. It may also be generated for a frontend
38 language that supports uninitialized variables and can also be introduced by
39 the `llzk-array-to-scalar` pass if there is a read from an array index
40 that was not dominated by an earlier write to that same index.
41
42 Example:
43
44 ```llzk
45 %0 = llzk.nondet : !felt.type
46 ```
47 }];
48
49 let results = (outs AnyLLZKType:$res);
50 let assemblyFormat = [{ `:` type($res) attr-dict }];
51}
52
53#endif // LLZK_OPS