1//===-- Attrs.td -------------------------------------------*- tablegen -*-===//
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
8//===----------------------------------------------------------------------===//
13include "llzk/Dialect/LLZK/IR/Dialect.td"
14include "llzk/Dialect/LLZK/IR/AttributeHelper.td"
16include "mlir/IR/AttrTypeBase.td"
17include "mlir/IR/BuiltinAttributeInterfaces.td"
18include "mlir/IR/EnumAttr.td"
20class LLZKDialectAttr<string name, string attrMnemonic, list<Trait> traits = []>
21 : AttrDef<LLZKDialect, name, traits> {
22 let mnemonic = attrMnemonic;
25def LLZK_PublicAttr : LLZKDialectAttr<"Public", "pub"> {
26 let summary = "A unit attribute to mark an input/output as public";
28 This attribute is used on parameters of `compute()` and `constrain()` functions
29 within a `struct.def` to denote the public inputs of the circuit and on
30 `struct.member` ops to denote public output of the circuit.
35 struct.member @member_name : !felt.type {llzk.pub}
37 function.def @compute(%0: !felt.type {llzk.pub})
42def LLZK_LoopBoundsAttr : LLZKDialectAttr<"LoopBounds", "loopbounds"> {
43 let summary = "Annotation with the bounds of a loop";
45 This attribute holds information useful for the analysis of loops.
46 Holds the bounds of the loop and the step size.
55 } attributes { llzk.loopbounds = #llzk.loopbounds<0 to 10 step 1> }
60 (ins APIntParameter<"Loop variable lower bound (inclusive)">:$lower,
61 APIntParameter<"Loop variable upper bound (exclusive)">:$upper,
62 APIntParameter<"Loop variable step/increment">:$step);
64 let assemblyFormat = "`<` $lower `to` $upper `step` $step `>`";