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 a type as public";
31 struct.field @field_name : !felt.type {llzk.pub}
33 function.def @func_name(%0: !felt.type {llzk.pub})
38def LLZK_LoopBoundsAttr : LLZKDialectAttr<"LoopBounds", "loopbounds"> {
39 let summary = "Annotation with the bounds of a loop";
41 This attribute holds information useful for the analysis of loops.
42 Holds the bounds of the loop and the step size.
51 } attributes { llzk.loopbounds = #llzk.loopbounds<0 to 10 step 1> }
56 (ins APIntParameter<"Loop variable lower bound (inclusive)">:$lower,
57 APIntParameter<"Loop variable upper bound (exclusive)">:$upper,
58 APIntParameter<"Loop variable step/increment">:$step);
60 let assemblyFormat = "`<` $lower `to` $upper `step` $step `>`";