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 WidthSensitiveAPIntParameter<"">:$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;
64def KeywordAttr : AttrDef<SMTDialect, "Keyword"> {
65 let mnemonic = "keyword";
66 let summary = "an SMT-LIB keyword";
68 Represents a bare SMT-LIB keyword such as `:status` or `:produce-models`.
69 These values are used by operations such as `smt.set_info` that need the
70 structured surface syntax of the SMT-LIB language rather than quoted
74 let parameters = (ins StringRefParameter<"The keyword text">:$value);
76 let hasCustomAssemblyFormat = 1;
77 let genVerifyDecl = 1;
80def SymbolAttr : AttrDef<SMTDialect, "Symbol"> {
81 let mnemonic = "symbol";
82 let summary = "an SMT-LIB bare symbol";
84 Represents a bare SMT-LIB symbol, for example `sat`, `unknown`, or a
85 user-defined identifier used inside an SMT-LIB `set-info` payload.
88 let parameters = (ins StringRefParameter<"The symbol text">:$value);
90 let hasCustomAssemblyFormat = 1;
91 let genVerifyDecl = 1;
94#endif // MLIR_DIALECT_SMT_IR_SMTATTRIBUTES_TD