LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
AttributeHelper.td
Go to the documentation of this file.
1//===-- AttributeHelper.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_ATTRIBUTE_HELPER
11#define LLZK_ATTRIBUTE_HELPER
12
13include "mlir/IR/AttrTypeBase.td"
14
15// APInts whose numeric value is independent of bitwidth.
16class APIntParameter<string desc = "">
17 : AttrOrTypeParameter<"::llzk::APIntValue", desc, "const ::llvm::APInt &"> {
18 let parser = "::llzk::parseAPIntValue($_parser)";
19 let printer = "$_printer << $_self";
20}
21
22// APInts whose bitwidth is part of their identity. Check it before operator==,
23// which requires equal widths.
24class WidthSensitiveAPIntParameter<string desc = "">
25 : AttrOrTypeParameter<"::llvm::APInt", desc> {
26 let comparator =
27 "$_lhs.getBitWidth() == $_rhs.getBitWidth() && $_lhs == $_rhs";
28}
29
30#endif // LLZK_ATTRIBUTE_HELPER