1//===-- AttributeHelper.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//===----------------------------------------------------------------------===//
10#ifndef LLZK_ATTRIBUTE_HELPER
11#define LLZK_ATTRIBUTE_HELPER
13include "mlir/IR/AttrTypeBase.td"
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";
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> {
27 "$_lhs.getBitWidth() == $_rhs.getBitWidth() && $_lhs == $_rhs";
30#endif // LLZK_ATTRIBUTE_HELPER