1//===- SMTAttributes.td - Attributes for SMT dialect -------*- tablegen -*-===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//===----------------------------------------------------------------------===//
9// This file defines SMT dialect specific attributes.
11//===----------------------------------------------------------------------===//
13#ifndef MLIR_DIALECT_SMT_IR_SMTATTRIBUTES_TD
14#define MLIR_DIALECT_SMT_IR_SMTATTRIBUTES_TD
16include "llzk/Dialect/SMT/IR/SMTDialect.td"
17include "llzk/Dialect/LLZK/IR/AttributeHelper.td"
18include "mlir/IR/EnumAttr.td"
19include "mlir/IR/BuiltinAttributeInterfaces.td"
23 "BitVector", [DeclareAttrInterfaceMethods<TypedAttrInterface>]> {
26 This attribute represents a constant value of the `(_ BitVec width)` sort as
27 described in the [SMT bit-vector
28 theory](https://smtlib.cs.uiowa.edu/theories-FixedSizeBitVectors.shtml).
30 The constant is as #bX (binary) or #xX (hexadecimal) in SMT-LIB
31 where X is the value in the corresponding format without any further
32 prefixing. Here, the bit-vector constant is given as a regular non-negative
33 integer literal and the associated bit-vector type indicating the bit-width.
37 #smt.bv<5> : !smt.bv<4>
38 #smt.bv<92> : !smt.bv<8>
41 The explicit type-suffix is mandatory to uniquely represent the attribute,
42 i.e., this attribute should always be used in the extended form (using the
43 `quantified` keyword in the operation assembly format string).
45 The bit-width must be greater than zero (i.e., at least one digit has to be
49 let parameters = (ins APIntParameter<"">:$value);
51 let hasCustomAssemblyFormat = true;
52 let genVerifyDecl = true;
54 let builders = [AttrBuilder<(ins "llvm::StringRef":$value)>,
55 AttrBuilder<(ins "uint64_t":$value, "unsigned":$width)>,
58 let extraClassDeclaration = [{
59 /// Return the bit-vector constant as a SMT-LIB formatted string.
60 std::string getValueAsString(bool prefix = true) const;
64#endif // MLIR_DIALECT_SMT_IR_SMTATTRIBUTES_TD