Files
gps/tools/local/circt/include/mlir/Dialect/SMT/IR/SMTAttributes.cpp.inc
T
2026-07-12 11:01:51 +03:00

121 lines
4.2 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* AttrDef Definitions *|
|* *|
|* Automatically generated file, do not edit! *|
|* *|
\*===----------------------------------------------------------------------===*/
#ifdef GET_ATTRDEF_LIST
#undef GET_ATTRDEF_LIST
mlir::smt::BitVectorAttr
#endif // GET_ATTRDEF_LIST
#ifdef GET_ATTRDEF_CLASSES
#undef GET_ATTRDEF_CLASSES
static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
.Case(mlir::smt::BitVectorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
value = mlir::smt::BitVectorAttr::parse(parser, type);
return ::mlir::success(!!value);
})
.Default([&](llvm::StringRef keyword, llvm::SMLoc) {
*mnemonic = keyword;
return std::nullopt;
});
}
static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<mlir::smt::BitVectorAttr>([&](auto t) {
printer << mlir::smt::BitVectorAttr::getMnemonic();
t.print(printer);
return ::mlir::success();
})
.Default([](auto) { return ::mlir::failure(); });
}
namespace mlir::smt {
namespace detail {
struct BitVectorAttrStorage : public ::mlir::AttributeStorage {
using KeyTy = std::tuple<::llvm::APInt>;
BitVectorAttrStorage(::llvm::APInt value) : value(std::move(value)) {}
KeyTy getAsKey() const {
return KeyTy(value);
}
bool operator==(const KeyTy &tblgenKey) const {
return (value.getBitWidth() == std::get<0>(tblgenKey).getBitWidth() && value == std::get<0>(tblgenKey));
}
static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
return ::llvm::hash_combine(std::get<0>(tblgenKey));
}
static BitVectorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
auto value = std::move(std::get<0>(tblgenKey));
return new (allocator.allocate<BitVectorAttrStorage>()) BitVectorAttrStorage(std::move(value));
}
::llvm::APInt value;
};
} // namespace detail
BitVectorAttr BitVectorAttr::get(::mlir::MLIRContext *context, ::llvm::APInt value) {
return Base::get(context, std::move(value));
}
BitVectorAttr BitVectorAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::APInt value) {
return Base::getChecked(emitError, context, std::move(value));
}
::llvm::LogicalResult BitVectorAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::APInt value) {
if (::mlir::failed(verify(emitError, value)))
return ::mlir::failure();
return ::mlir::success();
}
const ::llvm::APInt &BitVectorAttr::getValue() const {
return getImpl()->value;
}
} // namespace mlir::smt
MLIR_DEFINE_EXPLICIT_TYPE_ID(mlir::smt::BitVectorAttr)
namespace mlir::smt {
/// Parse an attribute registered to this dialect.
::mlir::Attribute SMTDialect::parseAttribute(::mlir::DialectAsmParser &parser,
::mlir::Type type) const {
::llvm::SMLoc typeLoc = parser.getCurrentLocation();
::llvm::StringRef attrTag;
{
::mlir::Attribute attr;
auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
if (parseResult.has_value())
return attr;
}
parser.emitError(typeLoc) << "unknown attribute `"
<< attrTag << "` in dialect `" << getNamespace() << "`";
return {};
}
/// Print an attribute registered to this dialect.
void SMTDialect::printAttribute(::mlir::Attribute attr,
::mlir::DialectAsmPrinter &printer) const {
if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
return;
}
} // namespace mlir::smt
#endif // GET_ATTRDEF_CLASSES