25static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SMTInfoOps1(
26 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
27 if (attr && !((::llvm::isa<::llzk::smt_info::KeywordAttr>(attr))))
28 return emitError() <<
"attribute '" << attrName
29 <<
"' failed to satisfy constraint: an SMT-LIB keyword";
30 return ::mlir::success();
32static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SMTInfoOps1(
33 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
34 return __mlir_ods_local_attr_constraint_SMTInfoOps1(attr, attrName, [op]() {
35 return op->emitOpError();
39static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SMTInfoOps2(
40 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
41 if (attr && !((
true)))
42 return emitError() <<
"attribute '" << attrName
43 <<
"' failed to satisfy constraint: any attribute";
44 return ::mlir::success();
46static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_SMTInfoOps2(
47 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
48 return __mlir_ods_local_attr_constraint_SMTInfoOps2(attr, attrName, [op]() {
49 return op->emitOpError();
65 return ::llvm::cast<::llzk::smt_info::KeywordAttr>(attr);
79 if (!tblgen_key)
return emitError(loc,
"'smt_info.set' op requires attribute 'key'");
81 if (!tblgen_value)
return emitError(loc,
"'smt_info.set' op requires attribute 'value'");
83 if (tblgen_key && !((::llvm::isa<::llzk::smt_info::KeywordAttr>(tblgen_key))))
84 return emitError(loc,
"'smt_info.set' op attribute 'key' failed to satisfy constraint: an SMT-LIB keyword");
86 if (tblgen_value && !((
true)))
87 return emitError(loc,
"'smt_info.set' op attribute 'value' failed to satisfy constraint: any attribute");
88 return ::mlir::success();
92 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
94 emitError() <<
"expected DictionaryAttr to set properties";
95 return ::mlir::failure();
99 auto &propStorage = prop.
key;
100 auto attr = dict.get(
"key");
102 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
104 propStorage = convertedAttr;
106 emitError() <<
"Invalid attribute `key` in property conversion: " << attr;
107 return ::mlir::failure();
113 auto &propStorage = prop.
value;
114 auto attr = dict.get(
"value");
116 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
118 propStorage = convertedAttr;
120 emitError() <<
"Invalid attribute `value` in property conversion: " << attr;
121 return ::mlir::failure();
125 return ::mlir::success();
129 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
130 ::mlir::Builder odsBuilder{ctx};
133 const auto &propStorage = prop.
key;
135 attrs.push_back(odsBuilder.getNamedAttr(
"key",
140 const auto &propStorage = prop.
value;
142 attrs.push_back(odsBuilder.getNamedAttr(
"value",
147 return odsBuilder.getDictionaryAttr(attrs);
152 using llvm::hash_value;
153 return llvm::hash_combine(
154 llvm::hash_value(prop.
key.getAsOpaquePointer()),
155 llvm::hash_value(prop.
value.getAsOpaquePointer()));
169 prop.
key = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
key)>>(value);
173 if (name ==
"value") {
174 prop.
value = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
value)>>(value);
180 if (prop.
key) attrs.append(
"key", prop.
key);
182 if (prop.
value) attrs.append(
"value", prop.
value);
185::llvm::LogicalResult
SMTInfoSetOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
188 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SMTInfoOps1(attr,
"key", emitError)))
189 return ::mlir::failure();
194 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_SMTInfoOps2(attr,
"value", emitError)))
195 return ::mlir::failure();
197 return ::mlir::success();
201 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
202 if (::mlir::failed(reader.readAttribute(prop.
key)))
203 return ::mlir::failure();
205 if (::mlir::failed(reader.readAttribute(prop.
value)))
206 return ::mlir::failure();
207 return ::mlir::success();
211 auto &prop = getProperties(); (void)prop;
212 writer.writeAttribute(prop.
key);
213 writer.writeAttribute(prop.
value);
218 return ::llvm::cast<::llzk::smt_info::KeywordAttr>(attr);
226void SMTInfoSetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::smt_info::KeywordAttr key, ::mlir::Attribute value) {
227 odsState.getOrAddProperties<
Properties>().key = key;
228 odsState.getOrAddProperties<
Properties>().value = value;
233 build(builder, __state__, std::forward<
decltype(key)>(key), std::forward<
decltype(value)>(value));
234 auto __res__ = ::llvm::dyn_cast<SMTInfoSetOp>(builder.create(__state__));
235 assert(__res__ &&
"builder didn't return the right type");
240 return create(builder, builder.getLoc(), std::forward<
decltype(key)>(key), std::forward<
decltype(value)>(value));
243void SMTInfoSetOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llzk::smt_info::KeywordAttr key, ::mlir::Attribute value) {
244 odsState.getOrAddProperties<
Properties>().key = key;
245 odsState.getOrAddProperties<
Properties>().value = value;
246 assert(resultTypes.size() == 0u &&
"mismatched number of results");
247 odsState.addTypes(resultTypes);
250SMTInfoSetOp SMTInfoSetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llzk::smt_info::KeywordAttr key, ::mlir::Attribute value) {
252 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(key)>(key), std::forward<
decltype(value)>(value));
253 auto __res__ = ::llvm::dyn_cast<SMTInfoSetOp>(builder.create(__state__));
254 assert(__res__ &&
"builder didn't return the right type");
259 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(key)>(key), std::forward<
decltype(value)>(value));
262void SMTInfoSetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
263 assert(operands.size() == 0u &&
"mismatched number of parameters");
264 odsState.addOperands(operands);
265 odsState.addAttributes(attributes);
266 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
267 odsState.addTypes(resultTypes);
269 if (!attributes.empty()) {
271 ::mlir::PropertyRef properties = odsState.getRawProperties();
272 std::optional<::mlir::RegisteredOperationName> info =
273 odsState.name.getRegisteredInfo();
274 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
275 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
276 ::llvm::report_fatal_error(
"Property conversion failed.");
280SMTInfoSetOp SMTInfoSetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
282 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
283 auto __res__ = ::llvm::dyn_cast<SMTInfoSetOp>(builder.create(__state__));
284 assert(__res__ &&
"builder didn't return the right type");
288SMTInfoSetOp SMTInfoSetOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
289 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
292void SMTInfoSetOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
293 assert(operands.size() == 0u &&
"mismatched number of parameters");
294 odsState.addOperands(operands);
295 odsState.useProperties(
const_cast<Properties&
>(properties));
296 odsState.addAttributes(discardableAttributes);
297 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
298 odsState.addTypes(resultTypes);
301SMTInfoSetOp SMTInfoSetOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
303 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
304 auto __res__ = ::llvm::dyn_cast<SMTInfoSetOp>(builder.create(__state__));
305 assert(__res__ &&
"builder didn't return the right type");
309SMTInfoSetOp SMTInfoSetOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
310 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
314 auto tblgen_key = getProperties().key; (void)tblgen_key;
315 if (!tblgen_key)
return emitOpError(
"requires attribute 'key'");
316 auto tblgen_value = getProperties().value; (void)tblgen_value;
317 if (!tblgen_value)
return emitOpError(
"requires attribute 'value'");
319 if (::mlir::failed(__mlir_ods_local_attr_constraint_SMTInfoOps1(*
this, tblgen_key,
"key")))
320 return ::mlir::failure();
322 if (::mlir::failed(__mlir_ods_local_attr_constraint_SMTInfoOps2(*
this, tblgen_value,
"value")))
323 return ::mlir::failure();
324 return ::mlir::success();
329 return ::mlir::success();
330 return ::mlir::failure();
334 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
336 emitError() <<
"expected DictionaryAttr to set properties";
337 return ::mlir::failure();
341 ::mlir::DenseSet<::mlir::StringAttr> usedKeys;
342 ::mlir::MLIRContext *ctx = dict.getContext();
346 auto &propStorage = prop.
key;
347 auto keyAttrName = ::mlir::StringAttr::get(ctx,
"key");
348 auto attr = dict.get(keyAttrName);
349 usedKeys.insert(keyAttrName);
352 emitError() <<
"expected key entry for key in DictionaryAttr to set "
354 return ::mlir::failure();
356 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
358 propStorage = convertedAttr;
360 emitError() <<
"Invalid attribute `key` in property conversion: " << attr;
361 return ::mlir::failure();
367 auto &propStorage = prop.
value;
368 auto valueAttrName = ::mlir::StringAttr::get(ctx,
"value");
369 auto attr = dict.get(valueAttrName);
370 usedKeys.insert(valueAttrName);
373 emitError() <<
"expected key entry for value in DictionaryAttr to set "
375 return ::mlir::failure();
377 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
379 propStorage = convertedAttr;
381 emitError() <<
"Invalid attribute `value` in property conversion: " << attr;
382 return ::mlir::failure();
387 for (::mlir::NamedAttribute attr : dict) {
388 if (!usedKeys.contains(attr.getName()))
389 return emitError() <<
"unknown key '" << attr.getName() <<
390 "' when parsing properties dictionary";
392 return ::mlir::success();
SMTInfoSetOpAdaptor(SMTInfoSetOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
SMTInfoSetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
static SMTInfoSetOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llzk::smt_info::KeywordAttr key, ::mlir::Attribute value)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
FoldAdaptor::Properties Properties
::mlir::StringAttr getValueAttrName()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::Attribute getValueAttr()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verify()
::llvm::LogicalResult verifyInvariantsImpl()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::Attribute getValue()
static constexpr ::llvm::StringLiteral getOperationName()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::smt_info::KeywordAttr key, ::mlir::Attribute value)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::llzk::smt_info::KeywordAttr getKeyAttr()
::llzk::smt_info::KeywordAttr getKey()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::StringAttr getKeyAttrName()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::Attribute getValue()
const Properties & getProperties()
::mlir::Attribute getValueAttr()
::std::optional<::mlir::OperationName > odsOpName
::mlir::RegionRange odsRegions
::llzk::smt_info::KeywordAttr getKeyAttr()
SMTInfoSetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::llzk::smt_info::KeywordAttr getKey()