#ifdef GET_OP_DEFS_0
#undef GET_OP_DEFS_0
void ::test::registerTestDialectOperations(::test::TestDialect *dialect) {
::test::registerTestDialectOperations0(dialect);
::test::registerTestDialectOperations1(dialect);
::test::registerTestDialectOperations2(dialect);
::test::registerTestDialectOperations3(dialect);
::test::registerTestDialectOperations4(dialect);
::test::registerTestDialectOperations5(dialect);
::test::registerTestDialectOperations6(dialect);
::test::registerTestDialectOperations7(dialect);
::test::registerTestDialectOperations8(dialect);
::test::registerTestDialectOperations9(dialect);
::test::registerTestDialectOperations10(dialect);
::test::registerTestDialectOperations11(dialect);
::test::registerTestDialectOperations12(dialect);
::test::registerTestDialectOperations13(dialect);
::test::registerTestDialectOperations14(dialect);
::test::registerTestDialectOperations15(dialect);
::test::registerTestDialectOperations16(dialect);
::test::registerTestDialectOperations17(dialect);
::test::registerTestDialectOperations18(dialect);
::test::registerTestDialectOperations19(dialect);
}
void ::test::registerTestDialectOperations0(::test::TestDialect *dialect) {
::mlir::RegisteredOperationName::insert<::test::AffineScopeOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AllocaScopeRegionOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AnotherThreeResultOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AnotherTwoResultOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AnyAttrOfOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AnyCondOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ArgAndResHaveFixedElementTypesOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ArrayOfAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AsmBlockNameOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AsmDialectInterfaceOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AsmInterfaceOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AttrSizedOperandOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AttrSizedResultCompileTestOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AttrSizedResultOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::AttrWithTraitOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::BlackHoleOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::BroadcastableOp>(*dialect);
}
namespace test {
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps1(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps2(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isF32()))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit float, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps3(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps4(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::ShapedType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be shaped of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps5(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps6(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of 32-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps7(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of tensor of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_0TestOps8(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be tensor of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps1(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::MultiResultOpEnumAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: Multi-result op kinds";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps1(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_0TestOps1(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps2(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))) || ((::llvm::isa<::mlir::StringAttr>(attr)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit signless integer attribute or string attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps2(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_0TestOps2(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps3(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::test::ArrayOfUglyAttrsAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: ";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps3(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_0TestOps3(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps4(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::test::ArrayOfIntsAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: ";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps4(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_0TestOps4(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps5(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::test::ArrayOfEnumsAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: ";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps5(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_0TestOps5(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps6(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((true)))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: any attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_0TestOps6(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_0TestOps6(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_0TestOps1(
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((::llvm::hasNItems(region, 1)))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: region with 1 blocks";
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_0TestOps2(
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((true))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: any region";
}
return ::mlir::success();
}
}
namespace test {
namespace detail {
}
AffineScopeOpAdaptor::AffineScopeOpAdaptor(AffineScopeOp op) : AffineScopeOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AffineScopeOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AffineScopeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
(void)odsState.addRegion();
}
void AffineScopeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AffineScopeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult AffineScopeOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_0TestOps1(*this, region, "region", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AffineScopeOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AffineScopeOp)
namespace test {
namespace detail {
}
AllocaScopeRegionOpAdaptor::AllocaScopeRegionOpAdaptor(AllocaScopeRegionOp op) : AllocaScopeRegionOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AllocaScopeRegionOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AllocaScopeRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
(void)odsState.addRegion();
}
void AllocaScopeRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AllocaScopeRegionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult AllocaScopeRegionOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_0TestOps2(*this, region, "region", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AllocaScopeRegionOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult AllocaScopeRegionOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
return ::mlir::failure();
}
if (parser.parseRegion(*regionRegion))
return ::mlir::failure();
result.addRegion(std::move(regionRegion));
return ::mlir::success();
}
void AllocaScopeRegionOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ';
_odsPrinter.printRegion(getRegion());
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AllocaScopeRegionOp)
namespace test {
namespace detail {
AnotherThreeResultOpGenericAdaptorBase::AnotherThreeResultOpGenericAdaptorBase(AnotherThreeResultOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::MultiResultOpEnum AnotherThreeResultOpGenericAdaptorBase::getKind() {
auto attr = getKindAttr();
return attr.getValue();
}
}
AnotherThreeResultOpAdaptor::AnotherThreeResultOpAdaptor(AnotherThreeResultOp op) : AnotherThreeResultOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AnotherThreeResultOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_kind = getProperties().kind; (void)tblgen_kind;
if (!tblgen_kind) return emitError(loc, "'test.another_three_result' op ""requires attribute 'kind'");
if (tblgen_kind && !((::llvm::isa<::MultiResultOpEnumAttr>(tblgen_kind))))
return emitError(loc, "'test.another_three_result' op ""attribute 'kind' failed to satisfy constraint: Multi-result op kinds");
return ::mlir::success();
}
void AnotherThreeResultOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "result1");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "result2");
auto resultGroup2 = getODSResults(2);
if (!resultGroup2.empty())
setNameFn(*resultGroup2.begin(), "result3");
}
::llvm::LogicalResult AnotherThreeResultOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.kind;
auto attr = dict.get("kind");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `kind` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute AnotherThreeResultOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.kind;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("kind",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AnotherThreeResultOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.kind.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> AnotherThreeResultOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "kind")
return prop.kind;
return std::nullopt;
}
void AnotherThreeResultOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "kind") {
prop.kind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.kind)>>(value);
return;
}
}
void AnotherThreeResultOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.kind) attrs.append("kind", prop.kind);
}
::llvm::LogicalResult AnotherThreeResultOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getKindAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps1(attr, "kind", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AnotherThreeResultOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.kind)))
return ::mlir::failure();
return ::mlir::success();
}
void AnotherThreeResultOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.kind);
}
::MultiResultOpEnum AnotherThreeResultOp::getKind() {
auto attr = getKindAttr();
return attr.getValue();
}
void AnotherThreeResultOp::setKind(::MultiResultOpEnum attrValue) {
getProperties().kind = ::MultiResultOpEnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result1, ::mlir::Type result2, ::mlir::Type result3, ::MultiResultOpEnumAttr kind) {
odsState.getOrAddProperties<Properties>().kind = kind;
odsState.addTypes(result1);
odsState.addTypes(result2);
odsState.addTypes(result3);
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::MultiResultOpEnumAttr kind) {
odsState.getOrAddProperties<Properties>().kind = kind;
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(AnotherThreeResultOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::MultiResultOpEnumAttr kind) {
odsState.getOrAddProperties<Properties>().kind = kind;
assert(resultTypes.size() == 3u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result1, ::mlir::Type result2, ::mlir::Type result3, ::MultiResultOpEnum kind) {
odsState.getOrAddProperties<Properties>().kind = ::MultiResultOpEnumAttr::get(odsBuilder.getContext(), kind);
odsState.addTypes(result1);
odsState.addTypes(result2);
odsState.addTypes(result3);
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::MultiResultOpEnum kind) {
odsState.getOrAddProperties<Properties>().kind = ::MultiResultOpEnumAttr::get(odsBuilder.getContext(), kind);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(AnotherThreeResultOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::MultiResultOpEnum kind) {
odsState.getOrAddProperties<Properties>().kind = ::MultiResultOpEnumAttr::get(odsBuilder.getContext(), kind);
assert(resultTypes.size() == 3u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 3u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AnotherThreeResultOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
void AnotherThreeResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AnotherThreeResultOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(AnotherThreeResultOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 3u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult AnotherThreeResultOp::verifyInvariantsImpl() {
auto tblgen_kind = getProperties().kind; (void)tblgen_kind;
if (!tblgen_kind) return emitOpError("requires attribute 'kind'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps1(*this, tblgen_kind, "kind")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSResults(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AnotherThreeResultOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult AnotherThreeResultOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(3);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
::mlir::Type odsInferredType1 = odsBuilder.getF32Type();
::mlir::Type odsInferredType2 = odsBuilder.getF32Type();
inferredReturnTypes[0] = odsInferredType0;
inferredReturnTypes[1] = odsInferredType1;
inferredReturnTypes[2] = odsInferredType2;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AnotherThreeResultOp)
namespace test {
namespace detail {
AnotherTwoResultOpGenericAdaptorBase::AnotherTwoResultOpGenericAdaptorBase(AnotherTwoResultOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::MultiResultOpEnum AnotherTwoResultOpGenericAdaptorBase::getKind() {
auto attr = getKindAttr();
return attr.getValue();
}
}
AnotherTwoResultOpAdaptor::AnotherTwoResultOpAdaptor(AnotherTwoResultOp op) : AnotherTwoResultOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AnotherTwoResultOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_kind = getProperties().kind; (void)tblgen_kind;
if (!tblgen_kind) return emitError(loc, "'test.another_two_result' op ""requires attribute 'kind'");
if (tblgen_kind && !((::llvm::isa<::MultiResultOpEnumAttr>(tblgen_kind))))
return emitError(loc, "'test.another_two_result' op ""attribute 'kind' failed to satisfy constraint: Multi-result op kinds");
return ::mlir::success();
}
void AnotherTwoResultOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "result1");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "result2");
}
::llvm::LogicalResult AnotherTwoResultOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.kind;
auto attr = dict.get("kind");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `kind` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute AnotherTwoResultOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.kind;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("kind",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AnotherTwoResultOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.kind.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> AnotherTwoResultOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "kind")
return prop.kind;
return std::nullopt;
}
void AnotherTwoResultOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "kind") {
prop.kind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.kind)>>(value);
return;
}
}
void AnotherTwoResultOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.kind) attrs.append("kind", prop.kind);
}
::llvm::LogicalResult AnotherTwoResultOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getKindAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps1(attr, "kind", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AnotherTwoResultOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.kind)))
return ::mlir::failure();
return ::mlir::success();
}
void AnotherTwoResultOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.kind);
}
::MultiResultOpEnum AnotherTwoResultOp::getKind() {
auto attr = getKindAttr();
return attr.getValue();
}
void AnotherTwoResultOp::setKind(::MultiResultOpEnum attrValue) {
getProperties().kind = ::MultiResultOpEnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result1, ::mlir::Type result2, ::MultiResultOpEnumAttr kind) {
odsState.getOrAddProperties<Properties>().kind = kind;
odsState.addTypes(result1);
odsState.addTypes(result2);
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::MultiResultOpEnumAttr kind) {
odsState.getOrAddProperties<Properties>().kind = kind;
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(AnotherTwoResultOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::MultiResultOpEnumAttr kind) {
odsState.getOrAddProperties<Properties>().kind = kind;
assert(resultTypes.size() == 2u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result1, ::mlir::Type result2, ::MultiResultOpEnum kind) {
odsState.getOrAddProperties<Properties>().kind = ::MultiResultOpEnumAttr::get(odsBuilder.getContext(), kind);
odsState.addTypes(result1);
odsState.addTypes(result2);
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::MultiResultOpEnum kind) {
odsState.getOrAddProperties<Properties>().kind = ::MultiResultOpEnumAttr::get(odsBuilder.getContext(), kind);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(AnotherTwoResultOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::MultiResultOpEnum kind) {
odsState.getOrAddProperties<Properties>().kind = ::MultiResultOpEnumAttr::get(odsBuilder.getContext(), kind);
assert(resultTypes.size() == 2u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 2u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AnotherTwoResultOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
void AnotherTwoResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AnotherTwoResultOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(AnotherTwoResultOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 2u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult AnotherTwoResultOp::verifyInvariantsImpl() {
auto tblgen_kind = getProperties().kind; (void)tblgen_kind;
if (!tblgen_kind) return emitOpError("requires attribute 'kind'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps1(*this, tblgen_kind, "kind")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AnotherTwoResultOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult AnotherTwoResultOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(2);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getF32Type();
::mlir::Type odsInferredType1 = odsBuilder.getF32Type();
inferredReturnTypes[0] = odsInferredType0;
inferredReturnTypes[1] = odsInferredType1;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AnotherTwoResultOp)
namespace test {
namespace detail {
AnyAttrOfOpGenericAdaptorBase::AnyAttrOfOpGenericAdaptorBase(AnyAttrOfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::Attribute AnyAttrOfOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return attr;
}
}
AnyAttrOfOpAdaptor::AnyAttrOfOpAdaptor(AnyAttrOfOp op) : AnyAttrOfOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AnyAttrOfOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.any_attr_of_i32_str' op ""requires attribute 'attr'");
if (tblgen_attr && !((((::llvm::isa<::mlir::IntegerAttr>(tblgen_attr))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_attr).getType().isSignlessInteger(32)))) || ((::llvm::isa<::mlir::StringAttr>(tblgen_attr)))))
return emitError(loc, "'test.any_attr_of_i32_str' op ""attribute 'attr' failed to satisfy constraint: 32-bit signless integer attribute or string attribute");
return ::mlir::success();
}
::llvm::LogicalResult AnyAttrOfOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute AnyAttrOfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AnyAttrOfOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> AnyAttrOfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void AnyAttrOfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void AnyAttrOfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult AnyAttrOfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps2(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AnyAttrOfOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void AnyAttrOfOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::mlir::Attribute AnyAttrOfOp::getAttr() {
auto attr = getAttrAttr();
return attr;
}
void AnyAttrOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
}
void AnyAttrOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AnyAttrOfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AnyAttrOfOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult AnyAttrOfOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps2(*this, tblgen_attr, "attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult AnyAttrOfOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AnyAttrOfOp)
namespace test {
namespace detail {
}
AnyCondOpAdaptor::AnyCondOpAdaptor(AnyCondOp op) : AnyCondOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AnyCondOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> AnyCondOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
void AnyCondOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results) {
(void)odsState.addRegion();
odsState.addTypes(results);
}
void AnyCondOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult AnyCondOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_0TestOps2(*this, region, "region", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AnyCondOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AnyCondOp)
namespace test {
namespace detail {
}
ArgAndResHaveFixedElementTypesOpAdaptor::ArgAndResHaveFixedElementTypesOpAdaptor(ArgAndResHaveFixedElementTypesOp op) : ArgAndResHaveFixedElementTypesOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ArgAndResHaveFixedElementTypesOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ArgAndResHaveFixedElementTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value x, ::mlir::Value y) {
odsState.addOperands(x);
odsState.addOperands(y);
odsState.addTypes(res);
}
void ArgAndResHaveFixedElementTypesOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y) {
odsState.addOperands(x);
odsState.addOperands(y);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ArgAndResHaveFixedElementTypesOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult ArgAndResHaveFixedElementTypesOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps4(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
if (!((((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(0).begin())).isSignlessInteger(32)))) && (((::llvm::isa<::mlir::ShapedType>((*this->getODSOperands(1).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSOperands(1).begin())).isF32())))))
return emitOpError("failed to verify that fixed type combination");
if (!(((::llvm::isa<::mlir::ShapedType>((*this->getODSResults(0).begin()).getType()))) && ((getElementTypeOrSelf((*this->getODSResults(0).begin())).isSignlessInteger(16)))))
return emitOpError("failed to verify that 'res' is 16-bit signless integer");
return ::mlir::success();
}
::llvm::LogicalResult ArgAndResHaveFixedElementTypesOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArgAndResHaveFixedElementTypesOp)
namespace test {
namespace detail {
ArrayOfAttrOpGenericAdaptorBase::ArrayOfAttrOpGenericAdaptorBase(ArrayOfAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<TestAttrUglyAttr> ArrayOfAttrOpGenericAdaptorBase::getA() {
auto attr = getAAttr();
return attr.getValue();
}
::llvm::ArrayRef<int32_t> ArrayOfAttrOpGenericAdaptorBase::getB() {
auto attr = getBAttr();
return attr.getValue();
}
::llvm::ArrayRef<SimpleEnumAttr> ArrayOfAttrOpGenericAdaptorBase::getC() {
auto attr = getCAttr();
return attr.getValue();
}
}
ArrayOfAttrOpAdaptor::ArrayOfAttrOpAdaptor(ArrayOfAttrOp op) : ArrayOfAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ArrayOfAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_a = getProperties().a; (void)tblgen_a;
if (!tblgen_a) return emitError(loc, "'test.array_of_attr_op' op ""requires attribute 'a'");
auto tblgen_b = getProperties().b; (void)tblgen_b;
if (!tblgen_b) return emitError(loc, "'test.array_of_attr_op' op ""requires attribute 'b'");
auto tblgen_c = getProperties().c; (void)tblgen_c;
if (!tblgen_c) return emitError(loc, "'test.array_of_attr_op' op ""requires attribute 'c'");
if (tblgen_a && !((::llvm::isa<::test::ArrayOfUglyAttrsAttr>(tblgen_a))))
return emitError(loc, "'test.array_of_attr_op' op ""attribute 'a' failed to satisfy constraint: ");
if (tblgen_b && !((::llvm::isa<::test::ArrayOfIntsAttr>(tblgen_b))))
return emitError(loc, "'test.array_of_attr_op' op ""attribute 'b' failed to satisfy constraint: ");
if (tblgen_c && !((::llvm::isa<::test::ArrayOfEnumsAttr>(tblgen_c))))
return emitError(loc, "'test.array_of_attr_op' op ""attribute 'c' failed to satisfy constraint: ");
return ::mlir::success();
}
::llvm::LogicalResult ArrayOfAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.a;
auto attr = dict.get("a");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `a` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.b;
auto attr = dict.get("b");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `b` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.c;
auto attr = dict.get("c");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `c` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ArrayOfAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.a;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("a",
propStorage));
}
{
const auto &propStorage = prop.b;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("b",
propStorage));
}
{
const auto &propStorage = prop.c;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("c",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ArrayOfAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.a.getAsOpaquePointer()),
llvm::hash_value(prop.b.getAsOpaquePointer()),
llvm::hash_value(prop.c.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ArrayOfAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "a")
return prop.a;
if (name == "b")
return prop.b;
if (name == "c")
return prop.c;
return std::nullopt;
}
void ArrayOfAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "a") {
prop.a = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.a)>>(value);
return;
}
if (name == "b") {
prop.b = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.b)>>(value);
return;
}
if (name == "c") {
prop.c = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.c)>>(value);
return;
}
}
void ArrayOfAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.a) attrs.append("a", prop.a);
if (prop.b) attrs.append("b", prop.b);
if (prop.c) attrs.append("c", prop.c);
}
::llvm::LogicalResult ArrayOfAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps3(attr, "a", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getBAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps4(attr, "b", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getCAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps5(attr, "c", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ArrayOfAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.a)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.b)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.c)))
return ::mlir::failure();
return ::mlir::success();
}
void ArrayOfAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.a);
writer.writeAttribute(prop.b);
writer.writeAttribute(prop.c);
}
::llvm::ArrayRef<TestAttrUglyAttr> ArrayOfAttrOp::getA() {
auto attr = getAAttr();
return attr.getValue();
}
::llvm::ArrayRef<int32_t> ArrayOfAttrOp::getB() {
auto attr = getBAttr();
return attr.getValue();
}
::llvm::ArrayRef<SimpleEnumAttr> ArrayOfAttrOp::getC() {
auto attr = getCAttr();
return attr.getValue();
}
void ArrayOfAttrOp::setA(::llvm::ArrayRef<TestAttrUglyAttr> attrValue) {
getProperties().a = ::mlir::Builder((*this)->getContext()).getAttr<ArrayOfUglyAttrsAttr>(attrValue);
}
void ArrayOfAttrOp::setB(::llvm::ArrayRef<int32_t> attrValue) {
getProperties().b = ::mlir::Builder((*this)->getContext()).getAttr<ArrayOfIntsAttr>(attrValue);
}
void ArrayOfAttrOp::setC(::llvm::ArrayRef<SimpleEnumAttr> attrValue) {
getProperties().c = ::mlir::Builder((*this)->getContext()).getAttr<ArrayOfEnumsAttr>(attrValue);
}
void ArrayOfAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::test::ArrayOfUglyAttrsAttr a, ::test::ArrayOfIntsAttr b, ::test::ArrayOfEnumsAttr c) {
odsState.getOrAddProperties<Properties>().a = a;
odsState.getOrAddProperties<Properties>().b = b;
odsState.getOrAddProperties<Properties>().c = c;
}
void ArrayOfAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::test::ArrayOfUglyAttrsAttr a, ::test::ArrayOfIntsAttr b, ::test::ArrayOfEnumsAttr c) {
odsState.getOrAddProperties<Properties>().a = a;
odsState.getOrAddProperties<Properties>().b = b;
odsState.getOrAddProperties<Properties>().c = c;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ArrayOfAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<TestAttrUglyAttr> a, ::llvm::ArrayRef<int32_t> b, ::llvm::ArrayRef<SimpleEnumAttr> c) {
odsState.getOrAddProperties<Properties>().a = odsBuilder.getAttr<ArrayOfUglyAttrsAttr>(a);
odsState.getOrAddProperties<Properties>().b = odsBuilder.getAttr<ArrayOfIntsAttr>(b);
odsState.getOrAddProperties<Properties>().c = odsBuilder.getAttr<ArrayOfEnumsAttr>(c);
}
void ArrayOfAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::ArrayRef<TestAttrUglyAttr> a, ::llvm::ArrayRef<int32_t> b, ::llvm::ArrayRef<SimpleEnumAttr> c) {
odsState.getOrAddProperties<Properties>().a = odsBuilder.getAttr<ArrayOfUglyAttrsAttr>(a);
odsState.getOrAddProperties<Properties>().b = odsBuilder.getAttr<ArrayOfIntsAttr>(b);
odsState.getOrAddProperties<Properties>().c = odsBuilder.getAttr<ArrayOfEnumsAttr>(c);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ArrayOfAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<ArrayOfAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult ArrayOfAttrOp::verifyInvariantsImpl() {
auto tblgen_a = getProperties().a; (void)tblgen_a;
if (!tblgen_a) return emitOpError("requires attribute 'a'");
auto tblgen_b = getProperties().b; (void)tblgen_b;
if (!tblgen_b) return emitOpError("requires attribute 'b'");
auto tblgen_c = getProperties().c; (void)tblgen_c;
if (!tblgen_c) return emitOpError("requires attribute 'c'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps3(*this, tblgen_a, "a")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps4(*this, tblgen_b, "b")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps5(*this, tblgen_c, "c")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult ArrayOfAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ArrayOfAttrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::test::ArrayOfUglyAttrsAttr aAttr;
::test::ArrayOfIntsAttr bAttr;
::test::ArrayOfEnumsAttr cAttr;
if (parser.parseKeyword("a"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(aAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (aAttr) result.getOrAddProperties<ArrayOfAttrOp::Properties>().a = aAttr;
if (parser.parseComma())
return ::mlir::failure();
if (parser.parseKeyword("b"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(bAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (bAttr) result.getOrAddProperties<ArrayOfAttrOp::Properties>().b = bAttr;
if (parser.parseComma())
return ::mlir::failure();
if (parser.parseKeyword("c"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(cAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (cAttr) result.getOrAddProperties<ArrayOfAttrOp::Properties>().c = cAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
return ::mlir::success();
}
void ArrayOfAttrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ' << "a";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getAAttr());
_odsPrinter << ",";
_odsPrinter << ' ' << "b";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getBAttr());
_odsPrinter << ",";
_odsPrinter << ' ' << "c";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getCAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("a");
elidedAttrs.push_back("b");
elidedAttrs.push_back("c");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ArrayOfAttrOp)
namespace test {
namespace detail {
}
AsmBlockNameOpAdaptor::AsmBlockNameOpAdaptor(AsmBlockNameOp op) : AsmBlockNameOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AsmBlockNameOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AsmBlockNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
(void)odsState.addRegion();
}
void AsmBlockNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AsmBlockNameOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult AsmBlockNameOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_0TestOps2(*this, region, "body", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AsmBlockNameOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult AsmBlockNameOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<std::unique_ptr<::mlir::Region>, 2> fullRegions;
{
std::unique_ptr<::mlir::Region> region;
auto firstRegionResult = parser.parseOptionalRegion(region);
if (firstRegionResult.has_value()) {
if (failed(*firstRegionResult))
return ::mlir::failure();
fullRegions.emplace_back(std::move(region));
while (succeeded(parser.parseOptionalComma())) {
region = std::make_unique<::mlir::Region>();
if (parser.parseRegion(*region))
return ::mlir::failure();
fullRegions.emplace_back(std::move(region));
}
}
}
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
return ::mlir::failure();
}
result.addRegions(fullRegions);
return ::mlir::success();
}
void AsmBlockNameOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
llvm::interleaveComma(getOperation()->getRegions(), _odsPrinter, [&](::mlir::Region ®ion) {
_odsPrinter.printRegion(region);
});
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AsmBlockNameOp)
namespace test {
namespace detail {
}
AsmDialectInterfaceOpAdaptor::AsmDialectInterfaceOpAdaptor(AsmDialectInterfaceOp op) : AsmDialectInterfaceOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AsmDialectInterfaceOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AsmDialectInterfaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void AsmDialectInterfaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AsmDialectInterfaceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult AsmDialectInterfaceOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps5(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AsmDialectInterfaceOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AsmDialectInterfaceOp)
namespace test {
namespace detail {
}
AsmInterfaceOpAdaptor::AsmInterfaceOpAdaptor(AsmInterfaceOp op) : AsmInterfaceOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AsmInterfaceOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AsmInterfaceOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "first");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "middle_results");
auto resultGroup2 = getODSResults(2);
if (!resultGroup2.empty())
setNameFn(*resultGroup2.begin(), "");
}
std::pair<unsigned, unsigned> AsmInterfaceOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {false, true, false};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumResults() - 2) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
void AsmInterfaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type first, ::mlir::TypeRange middle_results, ::mlir::Type resultType2) {
odsState.addTypes(first);
odsState.addTypes(middle_results);
odsState.addTypes(resultType2);
}
void AsmInterfaceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() >= 2u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AsmInterfaceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 2u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult AsmInterfaceOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps5(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSResults(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps5(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AsmInterfaceOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AsmInterfaceOp)
namespace test {
namespace detail {
AttrSizedOperandOpGenericAdaptorBase::AttrSizedOperandOpGenericAdaptorBase(AttrSizedOperandOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> AttrSizedOperandOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
unsigned start = 0;
for (unsigned i = 0; i < index; ++i)
start += sizeAttr[i];
return {start, sizeAttr[index]};
}
}
AttrSizedOperandOpAdaptor::AttrSizedOperandOpAdaptor(AttrSizedOperandOp op) : AttrSizedOperandOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AttrSizedOperandOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> AttrSizedOperandOp::getODSOperandIndexAndLength(unsigned index) {
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
unsigned start = 0;
for (unsigned i = 0; i < index; ++i)
start += sizeAttr[i];
return {start, sizeAttr[index]};
}
::mlir::MutableOperandRange AttrSizedOperandOp::getAMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
return mutableRange;
}
::mlir::MutableOperandRange AttrSizedOperandOp::getBMutable() {
auto range = getODSOperandIndexAndLength(1);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
return mutableRange;
}
::mlir::MutableOperandRange AttrSizedOperandOp::getDMutable() {
auto range = getODSOperandIndexAndLength(3);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(3u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
return mutableRange;
}
::llvm::LogicalResult AttrSizedOperandOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
return convertFromAttribute(propStorage, propAttr, emitError);
};
auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
;
if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute AttrSizedOperandOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.operandSegmentSizes;
auto attr = [&]() -> ::mlir::Attribute {
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
}();
attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AttrSizedOperandOp::computePropertiesHash(const Properties &prop) {
auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
};
return llvm::hash_combine(
hash_operandSegmentSizes(prop.operandSegmentSizes));
}
std::optional<mlir::Attribute> AttrSizedOperandOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
return std::nullopt;
}
void AttrSizedOperandOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
if (!arrAttr) return;
if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
return;
llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
return;
}
}
void AttrSizedOperandOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
}
::llvm::LogicalResult AttrSizedOperandOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
::llvm::LogicalResult AttrSizedOperandOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (reader.getBytecodeVersion() < 6) {
auto &propStorage = prop.operandSegmentSizes;
::mlir::DenseI32ArrayAttr attr;
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
reader.emitError("size mismatch for operand/result_segment_size");
return ::mlir::failure();
}
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
}
{
auto &propStorage = prop.operandSegmentSizes;
auto readProp = [&]() {
if (reader.getBytecodeVersion() >= 6)
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
;
return ::mlir::success();
};
if (::mlir::failed(readProp()))
return ::mlir::failure();
}
return ::mlir::success();
}
void AttrSizedOperandOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
if (writer.getBytecodeVersion() < 6) {
auto &propStorage = prop.operandSegmentSizes;
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
}
{
auto &propStorage = prop.operandSegmentSizes;
if (writer.getBytecodeVersion() >= 6)
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
;
}
}
void AttrSizedOperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange a, ::mlir::ValueRange b, ::mlir::Value c, ::mlir::ValueRange d) {
odsState.addOperands(a);
odsState.addOperands(b);
odsState.addOperands(c);
odsState.addOperands(d);
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(a.size()), static_cast<int32_t>(b.size()), 1, static_cast<int32_t>(d.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
}
void AttrSizedOperandOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange a, ::mlir::ValueRange b, ::mlir::Value c, ::mlir::ValueRange d) {
odsState.addOperands(a);
odsState.addOperands(b);
odsState.addOperands(c);
odsState.addOperands(d);
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(a.size()), static_cast<int32_t>(b.size()), 1, static_cast<int32_t>(d.size())}), odsState.getOrAddProperties<Properties>().operandSegmentSizes.begin());
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AttrSizedOperandOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() >= 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AttrSizedOperandOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult AttrSizedOperandOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup3 = getODSOperands(3);
for (auto v : valueGroup3) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AttrSizedOperandOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrSizedOperandOp)
namespace test {
namespace detail {
AttrSizedResultCompileTestOpGenericAdaptorBase::AttrSizedResultCompileTestOpGenericAdaptorBase(AttrSizedResultCompileTestOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
}
AttrSizedResultCompileTestOpAdaptor::AttrSizedResultCompileTestOpAdaptor(AttrSizedResultCompileTestOp op) : AttrSizedResultCompileTestOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AttrSizedResultCompileTestOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AttrSizedResultCompileTestOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "a");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "b");
auto resultGroup2 = getODSResults(2);
if (!resultGroup2.empty())
setNameFn(*resultGroup2.begin(), "c");
}
std::pair<unsigned, unsigned> AttrSizedResultCompileTestOp::getODSResultIndexAndLength(unsigned index) {
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().resultSegmentSizes;
unsigned start = 0;
for (unsigned i = 0; i < index; ++i)
start += sizeAttr[i];
return {start, sizeAttr[index]};
}
::llvm::LogicalResult AttrSizedResultCompileTestOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
return convertFromAttribute(propStorage, propAttr, emitError);
};
auto attr = dict.get("resultSegmentSizes"); if (!attr) attr = dict.get("result_segment_sizes");;
;
if (attr && ::mlir::failed(setFromAttr(prop.resultSegmentSizes, attr, emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute AttrSizedResultCompileTestOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.resultSegmentSizes;
auto attr = [&]() -> ::mlir::Attribute {
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
}();
attrs.push_back(odsBuilder.getNamedAttr("resultSegmentSizes", attr));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AttrSizedResultCompileTestOp::computePropertiesHash(const Properties &prop) {
auto hash_resultSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
};
return llvm::hash_combine(
hash_resultSegmentSizes(prop.resultSegmentSizes));
}
std::optional<mlir::Attribute> AttrSizedResultCompileTestOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "result_segment_sizes" || name == "resultSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.resultSegmentSizes); }();
return std::nullopt;
}
void AttrSizedResultCompileTestOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "result_segment_sizes" || name == "resultSegmentSizes") {
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
if (!arrAttr) return;
if (arrAttr.size() != sizeof(prop.resultSegmentSizes) / sizeof(int32_t))
return;
llvm::copy(arrAttr.asArrayRef(), prop.resultSegmentSizes.begin());
return;
}
}
void AttrSizedResultCompileTestOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
attrs.append("resultSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.resultSegmentSizes); }());
}
::llvm::LogicalResult AttrSizedResultCompileTestOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
::llvm::LogicalResult AttrSizedResultCompileTestOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (reader.getBytecodeVersion() < 6) {
auto &propStorage = prop.resultSegmentSizes;
::mlir::DenseI32ArrayAttr attr;
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
reader.emitError("size mismatch for operand/result_segment_size");
return ::mlir::failure();
}
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
}
{
auto &propStorage = prop.resultSegmentSizes;
auto readProp = [&]() {
if (reader.getBytecodeVersion() >= 6)
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
;
return ::mlir::success();
};
if (::mlir::failed(readProp()))
return ::mlir::failure();
}
return ::mlir::success();
}
void AttrSizedResultCompileTestOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
if (writer.getBytecodeVersion() < 6) {
auto &propStorage = prop.resultSegmentSizes;
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
}
{
auto &propStorage = prop.resultSegmentSizes;
if (writer.getBytecodeVersion() >= 6)
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
;
}
}
void AttrSizedResultCompileTestOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange a, ::mlir::Type b, ::mlir::Type c) {
odsState.addTypes(a);
odsState.addTypes(b);
if (c)
odsState.addTypes(c);
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(a.size()), 1, (c ? 1 : 0)}), odsState.getOrAddProperties<Properties>().resultSegmentSizes.begin());
}
void AttrSizedResultCompileTestOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AttrSizedResultCompileTestOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AttrSizedResultCompileTestOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult AttrSizedResultCompileTestOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSResults(2);
if (valueGroup2.size() > 1) {
return emitOpError("result group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup2.size();
}
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AttrSizedResultCompileTestOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrSizedResultCompileTestOp)
namespace test {
namespace detail {
AttrSizedResultOpGenericAdaptorBase::AttrSizedResultOpGenericAdaptorBase(AttrSizedResultOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
}
AttrSizedResultOpAdaptor::AttrSizedResultOpAdaptor(AttrSizedResultOp op) : AttrSizedResultOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AttrSizedResultOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void AttrSizedResultOp::getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn) {
auto resultGroup0 = getODSResults(0);
if (!resultGroup0.empty())
setNameFn(*resultGroup0.begin(), "a");
auto resultGroup1 = getODSResults(1);
if (!resultGroup1.empty())
setNameFn(*resultGroup1.begin(), "b");
auto resultGroup2 = getODSResults(2);
if (!resultGroup2.empty())
setNameFn(*resultGroup2.begin(), "c");
auto resultGroup3 = getODSResults(3);
if (!resultGroup3.empty())
setNameFn(*resultGroup3.begin(), "d");
}
std::pair<unsigned, unsigned> AttrSizedResultOp::getODSResultIndexAndLength(unsigned index) {
::llvm::ArrayRef<int32_t> sizeAttr = getProperties().resultSegmentSizes;
unsigned start = 0;
for (unsigned i = 0; i < index; ++i)
start += sizeAttr[i];
return {start, sizeAttr[index]};
}
::llvm::LogicalResult AttrSizedResultOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
return convertFromAttribute(propStorage, propAttr, emitError);
};
auto attr = dict.get("resultSegmentSizes"); if (!attr) attr = dict.get("result_segment_sizes");;
;
if (attr && ::mlir::failed(setFromAttr(prop.resultSegmentSizes, attr, emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::mlir::Attribute AttrSizedResultOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.resultSegmentSizes;
auto attr = [&]() -> ::mlir::Attribute {
return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
}();
attrs.push_back(odsBuilder.getNamedAttr("resultSegmentSizes", attr));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AttrSizedResultOp::computePropertiesHash(const Properties &prop) {
auto hash_resultSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
};
return llvm::hash_combine(
hash_resultSegmentSizes(prop.resultSegmentSizes));
}
std::optional<mlir::Attribute> AttrSizedResultOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "result_segment_sizes" || name == "resultSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.resultSegmentSizes); }();
return std::nullopt;
}
void AttrSizedResultOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "result_segment_sizes" || name == "resultSegmentSizes") {
auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
if (!arrAttr) return;
if (arrAttr.size() != sizeof(prop.resultSegmentSizes) / sizeof(int32_t))
return;
llvm::copy(arrAttr.asArrayRef(), prop.resultSegmentSizes.begin());
return;
}
}
void AttrSizedResultOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
attrs.append("resultSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.resultSegmentSizes); }());
}
::llvm::LogicalResult AttrSizedResultOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
::llvm::LogicalResult AttrSizedResultOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (reader.getBytecodeVersion() < 6) {
auto &propStorage = prop.resultSegmentSizes;
::mlir::DenseI32ArrayAttr attr;
if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
reader.emitError("size mismatch for operand/result_segment_size");
return ::mlir::failure();
}
::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
}
{
auto &propStorage = prop.resultSegmentSizes;
auto readProp = [&]() {
if (reader.getBytecodeVersion() >= 6)
return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
;
return ::mlir::success();
};
if (::mlir::failed(readProp()))
return ::mlir::failure();
}
return ::mlir::success();
}
void AttrSizedResultOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
if (writer.getBytecodeVersion() < 6) {
auto &propStorage = prop.resultSegmentSizes;
writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
}
{
auto &propStorage = prop.resultSegmentSizes;
if (writer.getBytecodeVersion() >= 6)
writer.writeSparseArray(::llvm::ArrayRef(propStorage));
;
}
}
void AttrSizedResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange a, ::mlir::TypeRange b, ::mlir::Type c, ::mlir::TypeRange d) {
odsState.addTypes(a);
odsState.addTypes(b);
odsState.addTypes(c);
odsState.addTypes(d);
::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(a.size()), static_cast<int32_t>(b.size()), 1, static_cast<int32_t>(d.size())}), odsState.getOrAddProperties<Properties>().resultSegmentSizes.begin());
}
void AttrSizedResultOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() >= 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AttrSizedResultOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() >= 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AttrSizedResultOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult AttrSizedResultOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSResults(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSResults(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
auto valueGroup3 = getODSResults(3);
for (auto v : valueGroup3) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AttrSizedResultOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrSizedResultOp)
namespace test {
namespace detail {
AttrWithTraitOpGenericAdaptorBase::AttrWithTraitOpGenericAdaptorBase(AttrWithTraitOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::Attribute AttrWithTraitOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return attr;
}
}
AttrWithTraitOpAdaptor::AttrWithTraitOpAdaptor(AttrWithTraitOp op) : AttrWithTraitOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AttrWithTraitOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.attr_with_trait' op ""requires attribute 'attr'");
if (tblgen_attr && !((true)))
return emitError(loc, "'test.attr_with_trait' op ""attribute 'attr' failed to satisfy constraint: any attribute");
return ::mlir::success();
}
::llvm::LogicalResult AttrWithTraitOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute AttrWithTraitOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AttrWithTraitOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> AttrWithTraitOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void AttrWithTraitOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void AttrWithTraitOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult AttrWithTraitOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps6(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult AttrWithTraitOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void AttrWithTraitOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::mlir::Attribute AttrWithTraitOp::getAttr() {
auto attr = getAttrAttr();
return attr;
}
void AttrWithTraitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
}
void AttrWithTraitOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void AttrWithTraitOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<AttrWithTraitOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult AttrWithTraitOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_0TestOps6(*this, tblgen_attr, "attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult AttrWithTraitOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::AttrWithTraitOp)
namespace test {
namespace detail {
}
BlackHoleOpAdaptor::BlackHoleOpAdaptor(BlackHoleOp op) : BlackHoleOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BlackHoleOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void BlackHoleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
}
void BlackHoleOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void BlackHoleOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult BlackHoleOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps5(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BlackHoleOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::BlackHoleOp)
namespace test {
namespace detail {
std::pair<unsigned, unsigned> BroadcastableOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (odsOperandsSize - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
}
BroadcastableOpAdaptor::BroadcastableOpAdaptor(BroadcastableOp op) : BroadcastableOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BroadcastableOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> BroadcastableOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
void BroadcastableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange odsArg_0) {
odsState.addOperands(odsArg_0);
odsState.addTypes(resultType0);
}
void BroadcastableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult BroadcastableOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps7(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_0TestOps8(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BroadcastableOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::BroadcastableOp)
#endif
#ifdef GET_OP_DEFS_1
#undef GET_OP_DEFS_1
void ::test::registerTestDialectOperations1(::test::TestDialect *dialect) {
::mlir::RegisteredOperationName::insert<::test::BufferBasedOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ChildOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ChildWithParentOneOf>(*dialect);
::mlir::RegisteredOperationName::insert<::test::CompareOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ComplexOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ComplexTensorOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ConditionallySpeculatableOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ConfinedDenseArrayAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ContainingIntPolynomialAttr2Op>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ContainingIntPolynomialAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ConversionCallOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ConversionFuncOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::CopyOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::CustomDimensionListAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::CustomResultsNameOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::DataLayoutQueryOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::DefaultDialectOp>(*dialect);
}
namespace test {
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps1(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be ranked or unranked memref of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps2(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::IndexType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of index, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps3(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::ComplexType>(type))) && ((::llvm::cast<::mlir::ComplexType>(type).getElementType().isF64())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be complex type with 64-bit float elements, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps4(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return ((::llvm::isa<::mlir::ComplexType>(elementType))) && ((::llvm::cast<::mlir::ComplexType>(elementType).getElementType().isF64())); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be tensor of complex type with 64-bit float elements values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps5(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps6(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps7(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::IntegerType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_1TestOps8(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps1(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: string attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps1(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps1(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps2(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::AffineMapAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: AffineMap attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps2(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps2(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps3(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: unit attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps3(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps3(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps4(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(attr))) && (((llvm::is_sorted(::llvm::cast<DenseI16ArrayAttr>(attr).asArrayRef()))) && (([](::llvm::ArrayRef<int16_t> a) {
return std::adjacent_find(std::begin(a), std::end(a)) == std::end(a);
}(::llvm::cast<DenseI16ArrayAttr>(attr).asArrayRef()))))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i16 dense array attribute should be in increasing order";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps4(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps4(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps5(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))) && ((llvm::is_sorted(::llvm::cast<DenseI32ArrayAttr>(attr).asArrayRef())))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i32 dense array attribute should be in non-decreasing order";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps5(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps5(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps6(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))) && (((llvm::is_sorted(::llvm::cast<DenseI64ArrayAttr>(attr).asArrayRef()))) && (([](::llvm::ArrayRef<int64_t> a) {
return std::adjacent_find(std::begin(a), std::end(a)) == std::end(a);
}(::llvm::cast<DenseI64ArrayAttr>(attr).asArrayRef()))))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i64 dense array attribute should be in increasing order";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps6(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps6(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps7(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::test::NestedPolynomialAttr2Attr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: ";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps7(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps7(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps8(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::test::NestedPolynomialAttrAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: ";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps8(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps8(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps9(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: symbol reference attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps9(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps9(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps10(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: type attribute of function type";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps10(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps10(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps11(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: Array of dictionary attributes";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps11(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps11(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps12(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i64 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps12(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps12(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps13(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: string array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_1TestOps13(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_1TestOps13(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_1TestOps1(
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((true))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: any region";
}
return ::mlir::success();
}
}
namespace test {
namespace detail {
}
BufferBasedOpAdaptor::BufferBasedOpAdaptor(BufferBasedOp op) : BufferBasedOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BufferBasedOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void BufferBasedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output) {
odsState.addOperands(input);
odsState.addOperands(output);
}
void BufferBasedOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output) {
odsState.addOperands(input);
odsState.addOperands(output);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void BufferBasedOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult BufferBasedOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BufferBasedOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BufferBasedOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc;
(void)inputOperandsLoc;
::mlir::Type inputRawType{};
::llvm::ArrayRef<::mlir::Type> inputTypes(&inputRawType, 1);
::mlir::OpAsmParser::UnresolvedOperand outputRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> outputOperands(&outputRawOperand, 1); ::llvm::SMLoc outputOperandsLoc;
(void)outputOperandsLoc;
::mlir::Type outputRawType{};
::llvm::ArrayRef<::mlir::Type> outputTypes(&outputRawType, 1);
if (parser.parseKeyword("in"))
return ::mlir::failure();
if (parser.parseLParen())
return ::mlir::failure();
inputOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(inputRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::BaseMemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
inputRawType = type;
}
if (parser.parseRParen())
return ::mlir::failure();
if (parser.parseKeyword("out"))
return ::mlir::failure();
if (parser.parseLParen())
return ::mlir::failure();
outputOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(outputRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::BaseMemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
outputRawType = type;
}
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
}
if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(outputOperands, outputTypes, outputOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BufferBasedOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ' << "in";
_odsPrinter << "(";
_odsPrinter << getInput();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getInput().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ")";
_odsPrinter << ' ' << "out";
_odsPrinter << "(";
_odsPrinter << getOutput();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getOutput().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
void BufferBasedOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
{
auto valueRange = getODSOperandIndexAndLength(1);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::BufferBasedOp)
namespace test {
namespace detail {
}
ChildOpAdaptor::ChildOpAdaptor(ChildOp op) : ChildOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ChildOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ChildOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}
void ChildOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ChildOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult ChildOp::verifyInvariantsImpl() {
return ::mlir::success();
}
::llvm::LogicalResult ChildOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ChildOp)
namespace test {
namespace detail {
}
ChildWithParentOneOfAdaptor::ChildWithParentOneOfAdaptor(ChildWithParentOneOf op) : ChildWithParentOneOfGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ChildWithParentOneOfAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ChildWithParentOneOf::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}
void ChildWithParentOneOf::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ChildWithParentOneOf::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult ChildWithParentOneOf::verifyInvariantsImpl() {
return ::mlir::success();
}
::llvm::LogicalResult ChildWithParentOneOf::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ChildWithParentOneOf)
namespace test {
namespace detail {
CompareOpGenericAdaptorBase::CompareOpGenericAdaptorBase(CompareOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> CompareOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (odsOperandsSize - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::StringAttr CompareOpGenericAdaptorBase::getCmpAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().cmp);
return attr;
}
::llvm::StringRef CompareOpGenericAdaptorBase::getCmp() {
auto attr = getCmpAttr();
return attr.getValue();
}
::std::optional< ::mlir::AffineMap > CompareOpGenericAdaptorBase::getLhsMap() {
auto attr = getLhsMapAttr();
return attr ? ::std::optional< ::mlir::AffineMap >(attr.getValue()) : (::std::nullopt);
}
::std::optional< ::mlir::AffineMap > CompareOpGenericAdaptorBase::getRhsMap() {
auto attr = getRhsMapAttr();
return attr ? ::std::optional< ::mlir::AffineMap >(attr.getValue()) : (::std::nullopt);
}
::mlir::UnitAttr CompareOpGenericAdaptorBase::getComposeAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().compose);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool CompareOpGenericAdaptorBase::getCompose() {
auto attr = getComposeAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
}
CompareOpAdaptor::CompareOpAdaptor(CompareOp op) : CompareOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CompareOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_cmp = getProperties().cmp; (void)tblgen_cmp;
auto tblgen_compose = getProperties().compose; (void)tblgen_compose;
auto tblgen_lhs_map = getProperties().lhs_map; (void)tblgen_lhs_map;
auto tblgen_rhs_map = getProperties().rhs_map; (void)tblgen_rhs_map;
if (tblgen_cmp && !((::llvm::isa<::mlir::StringAttr>(tblgen_cmp))))
return emitError(loc, "'test.compare' op ""attribute 'cmp' failed to satisfy constraint: string attribute");
if (tblgen_lhs_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_lhs_map))))
return emitError(loc, "'test.compare' op ""attribute 'lhs_map' failed to satisfy constraint: AffineMap attribute");
if (tblgen_rhs_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_rhs_map))))
return emitError(loc, "'test.compare' op ""attribute 'rhs_map' failed to satisfy constraint: AffineMap attribute");
if (tblgen_compose && !((::llvm::isa<::mlir::UnitAttr>(tblgen_compose))))
return emitError(loc, "'test.compare' op ""attribute 'compose' failed to satisfy constraint: unit attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> CompareOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange CompareOp::getVarOperandsMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
::llvm::LogicalResult CompareOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.cmp;
auto attr = dict.get("cmp");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `cmp` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.compose;
auto attr = dict.get("compose");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `compose` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.lhs_map;
auto attr = dict.get("lhs_map");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `lhs_map` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.rhs_map;
auto attr = dict.get("rhs_map");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `rhs_map` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CompareOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.cmp;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("cmp",
propStorage));
}
{
const auto &propStorage = prop.compose;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("compose",
propStorage));
}
{
const auto &propStorage = prop.lhs_map;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("lhs_map",
propStorage));
}
{
const auto &propStorage = prop.rhs_map;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("rhs_map",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CompareOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.cmp.getAsOpaquePointer()),
llvm::hash_value(prop.compose.getAsOpaquePointer()),
llvm::hash_value(prop.lhs_map.getAsOpaquePointer()),
llvm::hash_value(prop.rhs_map.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CompareOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "cmp")
return prop.cmp;
if (name == "compose")
return prop.compose;
if (name == "lhs_map")
return prop.lhs_map;
if (name == "rhs_map")
return prop.rhs_map;
return std::nullopt;
}
void CompareOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "cmp") {
prop.cmp = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cmp)>>(value);
return;
}
if (name == "compose") {
prop.compose = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.compose)>>(value);
return;
}
if (name == "lhs_map") {
prop.lhs_map = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.lhs_map)>>(value);
return;
}
if (name == "rhs_map") {
prop.rhs_map = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.rhs_map)>>(value);
return;
}
}
void CompareOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.cmp) attrs.append("cmp", prop.cmp);
if (prop.compose) attrs.append("compose", prop.compose);
if (prop.lhs_map) attrs.append("lhs_map", prop.lhs_map);
if (prop.rhs_map) attrs.append("rhs_map", prop.rhs_map);
}
::llvm::LogicalResult CompareOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getCmpAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps1(attr, "cmp", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getComposeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps3(attr, "compose", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getLhsMapAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps2(attr, "lhs_map", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getRhsMapAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps2(attr, "rhs_map", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CompareOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.cmp)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.compose)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.lhs_map)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.rhs_map)))
return ::mlir::failure();
return ::mlir::success();
}
void CompareOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.cmp);
writer.writeOptionalAttribute(prop.compose);
writer.writeOptionalAttribute(prop.lhs_map);
writer.writeOptionalAttribute(prop.rhs_map);
}
::llvm::StringRef CompareOp::getCmp() {
auto attr = getCmpAttr();
return attr.getValue();
}
::std::optional< ::mlir::AffineMap > CompareOp::getLhsMap() {
auto attr = getLhsMapAttr();
return attr ? ::std::optional< ::mlir::AffineMap >(attr.getValue()) : (::std::nullopt);
}
::std::optional< ::mlir::AffineMap > CompareOp::getRhsMap() {
auto attr = getRhsMapAttr();
return attr ? ::std::optional< ::mlir::AffineMap >(attr.getValue()) : (::std::nullopt);
}
bool CompareOp::getCompose() {
auto attr = getComposeAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
void CompareOp::setCmp(::llvm::StringRef attrValue) {
getProperties().cmp = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void CompareOp::setLhsMap(::std::optional<::mlir::AffineMap> attrValue) {
auto &odsProp = getProperties().lhs_map;
if (attrValue)
odsProp = ::mlir::AffineMapAttr::get(*attrValue);
else
odsProp = nullptr;
}
void CompareOp::setRhsMap(::std::optional<::mlir::AffineMap> attrValue) {
auto &odsProp = getProperties().rhs_map;
if (attrValue)
odsProp = ::mlir::AffineMapAttr::get(*attrValue);
else
odsProp = nullptr;
}
void CompareOp::setCompose(bool attrValue) {
auto &odsProp = getProperties().compose;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void CompareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange var_operands, ::mlir::StringAttr cmp, ::mlir::AffineMapAttr lhs_map, ::mlir::AffineMapAttr rhs_map, ::mlir::UnitAttr compose) {
odsState.addOperands(var_operands);
if (cmp) {
odsState.getOrAddProperties<Properties>().cmp = cmp;
}
if (lhs_map) {
odsState.getOrAddProperties<Properties>().lhs_map = lhs_map;
}
if (rhs_map) {
odsState.getOrAddProperties<Properties>().rhs_map = rhs_map;
}
if (compose) {
odsState.getOrAddProperties<Properties>().compose = compose;
}
}
void CompareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange var_operands, ::mlir::StringAttr cmp, ::mlir::AffineMapAttr lhs_map, ::mlir::AffineMapAttr rhs_map, ::mlir::UnitAttr compose) {
odsState.addOperands(var_operands);
if (cmp) {
odsState.getOrAddProperties<Properties>().cmp = cmp;
}
if (lhs_map) {
odsState.getOrAddProperties<Properties>().lhs_map = lhs_map;
}
if (rhs_map) {
odsState.getOrAddProperties<Properties>().rhs_map = rhs_map;
}
if (compose) {
odsState.getOrAddProperties<Properties>().compose = compose;
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void CompareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange var_operands, ::llvm::StringRef cmp, ::mlir::AffineMapAttr lhs_map, ::mlir::AffineMapAttr rhs_map, bool compose) {
odsState.addOperands(var_operands);
odsState.getOrAddProperties<Properties>().cmp = odsBuilder.getStringAttr(cmp);
if (lhs_map) {
odsState.getOrAddProperties<Properties>().lhs_map = lhs_map;
}
if (rhs_map) {
odsState.getOrAddProperties<Properties>().rhs_map = rhs_map;
}
if (compose) {
odsState.getOrAddProperties<Properties>().compose = ((compose) ? odsBuilder.getUnitAttr() : nullptr);
}
}
void CompareOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange var_operands, ::llvm::StringRef cmp, ::mlir::AffineMapAttr lhs_map, ::mlir::AffineMapAttr rhs_map, bool compose) {
odsState.addOperands(var_operands);
odsState.getOrAddProperties<Properties>().cmp = odsBuilder.getStringAttr(cmp);
if (lhs_map) {
odsState.getOrAddProperties<Properties>().lhs_map = lhs_map;
}
if (rhs_map) {
odsState.getOrAddProperties<Properties>().rhs_map = rhs_map;
}
if (compose) {
odsState.getOrAddProperties<Properties>().compose = ((compose) ? odsBuilder.getUnitAttr() : nullptr);
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void CompareOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<CompareOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
void CompareOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
::mlir::Builder odsBuilder(opName.getContext());
if (!properties.cmp)
properties.cmp = odsBuilder.getStringAttr("EQ");
}
::llvm::LogicalResult CompareOp::verifyInvariantsImpl() {
auto tblgen_cmp = getProperties().cmp; (void)tblgen_cmp;
auto tblgen_compose = getProperties().compose; (void)tblgen_compose;
auto tblgen_lhs_map = getProperties().lhs_map; (void)tblgen_lhs_map;
auto tblgen_rhs_map = getProperties().rhs_map; (void)tblgen_rhs_map;
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps1(*this, tblgen_cmp, "cmp")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps2(*this, tblgen_lhs_map, "lhs_map")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps2(*this, tblgen_rhs_map, "rhs_map")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps3(*this, tblgen_compose, "compose")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CompareOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CompareOp)
namespace test {
namespace detail {
}
ComplexOpAdaptor::ComplexOpAdaptor(ComplexOp op) : ComplexOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ComplexOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ComplexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ComplexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ComplexOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ComplexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ComplexOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ComplexOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ComplexOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ComplexOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ComplexOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ComplexOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = ::mlir::ComplexType::get(odsBuilder.getF64Type());
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ComplexOp)
namespace test {
namespace detail {
}
ComplexTensorOpAdaptor::ComplexTensorOpAdaptor(ComplexTensorOp op) : ComplexTensorOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ComplexTensorOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ComplexTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ComplexTensorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ComplexTensorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult ComplexTensorOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ComplexTensorOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ComplexTensorOp)
namespace test {
namespace detail {
}
ConditionallySpeculatableOpAdaptor::ConditionallySpeculatableOpAdaptor(ConditionallySpeculatableOp op) : ConditionallySpeculatableOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ConditionallySpeculatableOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ConditionallySpeculatableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value input) {
odsState.addOperands(input);
odsState.addTypes(result);
}
void ConditionallySpeculatableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input) {
odsState.addOperands(input);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ConditionallySpeculatableOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ConditionallySpeculatableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) {
odsState.addOperands(input);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ConditionallySpeculatableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ConditionallySpeculatableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ConditionallySpeculatableOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ConditionallySpeculatableOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps5(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps5(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ConditionallySpeculatableOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ConditionallySpeculatableOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
void ConditionallySpeculatableOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
::mlir::Speculation::Speculatability
ConditionallySpeculatableOp::getSpeculatability() {
Operation* definingOp = getInput().getDefiningOp();
return definingOp && isa<::mlir::arith::ConstantOp>(definingOp) ?
::mlir::Speculation::Speculatable : ::mlir::Speculation::NotSpeculatable;
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ConditionallySpeculatableOp)
namespace test {
namespace detail {
ConfinedDenseArrayAttrOpGenericAdaptorBase::ConfinedDenseArrayAttrOpGenericAdaptorBase(ConfinedDenseArrayAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<int16_t> ConfinedDenseArrayAttrOpGenericAdaptorBase::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> ConfinedDenseArrayAttrOpGenericAdaptorBase::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> ConfinedDenseArrayAttrOpGenericAdaptorBase::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
}
ConfinedDenseArrayAttrOpAdaptor::ConfinedDenseArrayAttrOpAdaptor(ConfinedDenseArrayAttrOp op) : ConfinedDenseArrayAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ConfinedDenseArrayAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitError(loc, "'test.confined_dense_array_attr' op ""requires attribute 'emptyattr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitError(loc, "'test.confined_dense_array_attr' op ""requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitError(loc, "'test.confined_dense_array_attr' op ""requires attribute 'i64attr'");
if (tblgen_emptyattr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(tblgen_emptyattr))) && (((llvm::is_sorted(::llvm::cast<DenseI16ArrayAttr>(tblgen_emptyattr).asArrayRef()))) && (([](::llvm::ArrayRef<int16_t> a) {
return std::adjacent_find(std::begin(a), std::end(a)) == std::end(a);
}(::llvm::cast<DenseI16ArrayAttr>(tblgen_emptyattr).asArrayRef()))))))
return emitError(loc, "'test.confined_dense_array_attr' op ""attribute 'emptyattr' failed to satisfy constraint: i16 dense array attribute should be in increasing order");
if (tblgen_i32attr && !(((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_i32attr))) && ((llvm::is_sorted(::llvm::cast<DenseI32ArrayAttr>(tblgen_i32attr).asArrayRef())))))
return emitError(loc, "'test.confined_dense_array_attr' op ""attribute 'i32attr' failed to satisfy constraint: i32 dense array attribute should be in non-decreasing order");
if (tblgen_i64attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_i64attr))) && (((llvm::is_sorted(::llvm::cast<DenseI64ArrayAttr>(tblgen_i64attr).asArrayRef()))) && (([](::llvm::ArrayRef<int64_t> a) {
return std::adjacent_find(std::begin(a), std::end(a)) == std::end(a);
}(::llvm::cast<DenseI64ArrayAttr>(tblgen_i64attr).asArrayRef()))))))
return emitError(loc, "'test.confined_dense_array_attr' op ""attribute 'i64attr' failed to satisfy constraint: i64 dense array attribute should be in increasing order");
return ::mlir::success();
}
::llvm::LogicalResult ConfinedDenseArrayAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.emptyattr;
auto attr = dict.get("emptyattr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `emptyattr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i32attr;
auto attr = dict.get("i32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i64attr;
auto attr = dict.get("i64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ConfinedDenseArrayAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.emptyattr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("emptyattr",
propStorage));
}
{
const auto &propStorage = prop.i32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i32attr",
propStorage));
}
{
const auto &propStorage = prop.i64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i64attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ConfinedDenseArrayAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.emptyattr.getAsOpaquePointer()),
llvm::hash_value(prop.i32attr.getAsOpaquePointer()),
llvm::hash_value(prop.i64attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ConfinedDenseArrayAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "emptyattr")
return prop.emptyattr;
if (name == "i32attr")
return prop.i32attr;
if (name == "i64attr")
return prop.i64attr;
return std::nullopt;
}
void ConfinedDenseArrayAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "emptyattr") {
prop.emptyattr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.emptyattr)>>(value);
return;
}
if (name == "i32attr") {
prop.i32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i32attr)>>(value);
return;
}
if (name == "i64attr") {
prop.i64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i64attr)>>(value);
return;
}
}
void ConfinedDenseArrayAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.emptyattr) attrs.append("emptyattr", prop.emptyattr);
if (prop.i32attr) attrs.append("i32attr", prop.i32attr);
if (prop.i64attr) attrs.append("i64attr", prop.i64attr);
}
::llvm::LogicalResult ConfinedDenseArrayAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getEmptyattrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps4(attr, "emptyattr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps5(attr, "i32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps6(attr, "i64attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ConfinedDenseArrayAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.emptyattr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i64attr)))
return ::mlir::failure();
return ::mlir::success();
}
void ConfinedDenseArrayAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.emptyattr);
writer.writeAttribute(prop.i32attr);
writer.writeAttribute(prop.i64attr);
}
::llvm::ArrayRef<int16_t> ConfinedDenseArrayAttrOp::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> ConfinedDenseArrayAttrOp::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> ConfinedDenseArrayAttrOp::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
void ConfinedDenseArrayAttrOp::setEmptyattr(::llvm::ArrayRef<int16_t> attrValue) {
getProperties().emptyattr = ::mlir::Builder((*this)->getContext()).getDenseI16ArrayAttr(attrValue);
}
void ConfinedDenseArrayAttrOp::setI32attr(::llvm::ArrayRef<int32_t> attrValue) {
getProperties().i32attr = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
}
void ConfinedDenseArrayAttrOp::setI64attr(::llvm::ArrayRef<int64_t> attrValue) {
getProperties().i64attr = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}
void ConfinedDenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseI16ArrayAttr emptyattr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr) {
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
}
void ConfinedDenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseI16ArrayAttr emptyattr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr) {
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ConfinedDenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<int16_t> emptyattr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr) {
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI16ArrayAttr(emptyattr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
}
void ConfinedDenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::ArrayRef<int16_t> emptyattr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr) {
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI16ArrayAttr(emptyattr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ConfinedDenseArrayAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<ConfinedDenseArrayAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult ConfinedDenseArrayAttrOp::verifyInvariantsImpl() {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitOpError("requires attribute 'emptyattr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitOpError("requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitOpError("requires attribute 'i64attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps4(*this, tblgen_emptyattr, "emptyattr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps5(*this, tblgen_i32attr, "i32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps6(*this, tblgen_i64attr, "i64attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult ConfinedDenseArrayAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ConfinedDenseArrayAttrOp)
namespace test {
namespace detail {
ContainingIntPolynomialAttr2OpGenericAdaptorBase::ContainingIntPolynomialAttr2OpGenericAdaptorBase(ContainingIntPolynomialAttr2Op op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::test::NestedPolynomialAttr2Attr ContainingIntPolynomialAttr2OpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return ::llvm::cast<::test::NestedPolynomialAttr2Attr>(attr);
}
}
ContainingIntPolynomialAttr2OpAdaptor::ContainingIntPolynomialAttr2OpAdaptor(ContainingIntPolynomialAttr2Op op) : ContainingIntPolynomialAttr2OpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ContainingIntPolynomialAttr2OpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.containing_int_polynomial_attr2' op ""requires attribute 'attr'");
if (tblgen_attr && !((::llvm::isa<::test::NestedPolynomialAttr2Attr>(tblgen_attr))))
return emitError(loc, "'test.containing_int_polynomial_attr2' op ""attribute 'attr' failed to satisfy constraint: ");
return ::mlir::success();
}
::llvm::LogicalResult ContainingIntPolynomialAttr2Op::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ContainingIntPolynomialAttr2Op::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ContainingIntPolynomialAttr2Op::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ContainingIntPolynomialAttr2Op::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void ContainingIntPolynomialAttr2Op::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void ContainingIntPolynomialAttr2Op::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult ContainingIntPolynomialAttr2Op::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps7(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ContainingIntPolynomialAttr2Op::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void ContainingIntPolynomialAttr2Op::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::test::NestedPolynomialAttr2Attr ContainingIntPolynomialAttr2Op::getAttr() {
auto attr = getAttrAttr();
return ::llvm::cast<::test::NestedPolynomialAttr2Attr>(attr);
}
void ContainingIntPolynomialAttr2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::test::NestedPolynomialAttr2Attr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
}
void ContainingIntPolynomialAttr2Op::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::test::NestedPolynomialAttr2Attr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ContainingIntPolynomialAttr2Op::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<ContainingIntPolynomialAttr2Op::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult ContainingIntPolynomialAttr2Op::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps7(*this, tblgen_attr, "attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult ContainingIntPolynomialAttr2Op::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ContainingIntPolynomialAttr2Op::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::test::NestedPolynomialAttr2Attr attrAttr;
if (parser.parseCustomAttributeWithFallback(attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (attrAttr) result.getOrAddProperties<ContainingIntPolynomialAttr2Op::Properties>().attr = attrAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
return ::mlir::success();
}
void ContainingIntPolynomialAttr2Op::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getAttrAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("attr");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ContainingIntPolynomialAttr2Op)
namespace test {
namespace detail {
ContainingIntPolynomialAttrOpGenericAdaptorBase::ContainingIntPolynomialAttrOpGenericAdaptorBase(ContainingIntPolynomialAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::test::NestedPolynomialAttrAttr ContainingIntPolynomialAttrOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return ::llvm::cast<::test::NestedPolynomialAttrAttr>(attr);
}
}
ContainingIntPolynomialAttrOpAdaptor::ContainingIntPolynomialAttrOpAdaptor(ContainingIntPolynomialAttrOp op) : ContainingIntPolynomialAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ContainingIntPolynomialAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.containing_int_polynomial_attr' op ""requires attribute 'attr'");
if (tblgen_attr && !((::llvm::isa<::test::NestedPolynomialAttrAttr>(tblgen_attr))))
return emitError(loc, "'test.containing_int_polynomial_attr' op ""attribute 'attr' failed to satisfy constraint: ");
return ::mlir::success();
}
::llvm::LogicalResult ContainingIntPolynomialAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ContainingIntPolynomialAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ContainingIntPolynomialAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ContainingIntPolynomialAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void ContainingIntPolynomialAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void ContainingIntPolynomialAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult ContainingIntPolynomialAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps8(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ContainingIntPolynomialAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void ContainingIntPolynomialAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::test::NestedPolynomialAttrAttr ContainingIntPolynomialAttrOp::getAttr() {
auto attr = getAttrAttr();
return ::llvm::cast<::test::NestedPolynomialAttrAttr>(attr);
}
void ContainingIntPolynomialAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::test::NestedPolynomialAttrAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
}
void ContainingIntPolynomialAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::test::NestedPolynomialAttrAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ContainingIntPolynomialAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<ContainingIntPolynomialAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult ContainingIntPolynomialAttrOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps8(*this, tblgen_attr, "attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult ContainingIntPolynomialAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ContainingIntPolynomialAttrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::test::NestedPolynomialAttrAttr attrAttr;
if (parser.parseCustomAttributeWithFallback(attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (attrAttr) result.getOrAddProperties<ContainingIntPolynomialAttrOp::Properties>().attr = attrAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
return ::mlir::success();
}
void ContainingIntPolynomialAttrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getAttrAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("attr");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ContainingIntPolynomialAttrOp)
namespace test {
namespace detail {
ConversionCallOpGenericAdaptorBase::ConversionCallOpGenericAdaptorBase(ConversionCallOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> ConversionCallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (odsOperandsSize - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::SymbolRefAttr ConversionCallOpGenericAdaptorBase::getCallee() {
auto attr = getCalleeAttr();
return attr;
}
}
ConversionCallOpAdaptor::ConversionCallOpAdaptor(ConversionCallOp op) : ConversionCallOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ConversionCallOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitError(loc, "'test.conversion_call_op' op ""requires attribute 'callee'");
if (tblgen_callee && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_callee))))
return emitError(loc, "'test.conversion_call_op' op ""attribute 'callee' failed to satisfy constraint: symbol reference attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> ConversionCallOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange ConversionCallOp::getArgOperandsMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
std::pair<unsigned, unsigned> ConversionCallOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult ConversionCallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.callee;
auto attr = dict.get("callee");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `callee` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ConversionCallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.callee;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("callee",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ConversionCallOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.callee.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ConversionCallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "callee")
return prop.callee;
return std::nullopt;
}
void ConversionCallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "callee") {
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
return;
}
}
void ConversionCallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.callee) attrs.append("callee", prop.callee);
}
::llvm::LogicalResult ConversionCallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps9(attr, "callee", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ConversionCallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.callee)))
return ::mlir::failure();
return ::mlir::success();
}
void ConversionCallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.callee);
}
::mlir::SymbolRefAttr ConversionCallOp::getCallee() {
auto attr = getCalleeAttr();
return attr;
}
void ConversionCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange arg_operands, ::mlir::SymbolRefAttr callee) {
odsState.addOperands(arg_operands);
odsState.getOrAddProperties<Properties>().callee = callee;
odsState.addTypes(resultType0);
}
void ConversionCallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<ConversionCallOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult ConversionCallOp::verifyInvariantsImpl() {
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps9(*this, tblgen_callee, "callee")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ConversionCallOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::CallInterfaceCallable ConversionCallOp::getCallableForCallee() {
return (*this)->getAttrOfType<::mlir::SymbolRefAttr>("callee");
}
void ConversionCallOp::setCalleeFromCallable(::mlir::CallInterfaceCallable callee) {
(*this)->setAttr("callee", callee.get<SymbolRefAttr>());
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ConversionCallOp)
namespace test {
namespace detail {
ConversionFuncOpGenericAdaptorBase::ConversionFuncOpGenericAdaptorBase(ConversionFuncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef ConversionFuncOpGenericAdaptorBase::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::FunctionType ConversionFuncOpGenericAdaptorBase::getFunctionType() {
auto attr = getFunctionTypeAttr();
return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
}
::std::optional< ::mlir::ArrayAttr > ConversionFuncOpGenericAdaptorBase::getArgAttrs() {
auto attr = getArgAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > ConversionFuncOpGenericAdaptorBase::getResAttrs() {
auto attr = getResAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::llvm::StringRef > ConversionFuncOpGenericAdaptorBase::getSymVisibility() {
auto attr = getSymVisibilityAttr();
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
}
}
ConversionFuncOpAdaptor::ConversionFuncOpAdaptor(ConversionFuncOp op) : ConversionFuncOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ConversionFuncOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
if (!tblgen_function_type) return emitError(loc, "'test.conversion_func_op' op ""requires attribute 'function_type'");
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitError(loc, "'test.conversion_func_op' op ""requires attribute 'sym_name'");
auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility;
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
return emitError(loc, "'test.conversion_func_op' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue())))))
return emitError(loc, "'test.conversion_func_op' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type");
if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
return emitError(loc, "'test.conversion_func_op' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
return emitError(loc, "'test.conversion_func_op' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
if (tblgen_sym_visibility && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_visibility))))
return emitError(loc, "'test.conversion_func_op' op ""attribute 'sym_visibility' failed to satisfy constraint: string attribute");
return ::mlir::success();
}
::llvm::LogicalResult ConversionFuncOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.arg_attrs;
auto attr = dict.get("arg_attrs");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.function_type;
auto attr = dict.get("function_type");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `function_type` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.res_attrs;
auto attr = dict.get("res_attrs");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.sym_name;
auto attr = dict.get("sym_name");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.sym_visibility;
auto attr = dict.get("sym_visibility");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `sym_visibility` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ConversionFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.arg_attrs;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
propStorage));
}
{
const auto &propStorage = prop.function_type;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("function_type",
propStorage));
}
{
const auto &propStorage = prop.res_attrs;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
propStorage));
}
{
const auto &propStorage = prop.sym_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
propStorage));
}
{
const auto &propStorage = prop.sym_visibility;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_visibility",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ConversionFuncOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
llvm::hash_value(prop.function_type.getAsOpaquePointer()),
llvm::hash_value(prop.res_attrs.getAsOpaquePointer()),
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
llvm::hash_value(prop.sym_visibility.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ConversionFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "arg_attrs")
return prop.arg_attrs;
if (name == "function_type")
return prop.function_type;
if (name == "res_attrs")
return prop.res_attrs;
if (name == "sym_name")
return prop.sym_name;
if (name == "sym_visibility")
return prop.sym_visibility;
return std::nullopt;
}
void ConversionFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "arg_attrs") {
prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
return;
}
if (name == "function_type") {
prop.function_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.function_type)>>(value);
return;
}
if (name == "res_attrs") {
prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
return;
}
if (name == "sym_name") {
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
return;
}
if (name == "sym_visibility") {
prop.sym_visibility = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_visibility)>>(value);
return;
}
}
void ConversionFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
if (prop.function_type) attrs.append("function_type", prop.function_type);
if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
if (prop.sym_visibility) attrs.append("sym_visibility", prop.sym_visibility);
}
::llvm::LogicalResult ConversionFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps11(attr, "arg_attrs", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps10(attr, "function_type", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps11(attr, "res_attrs", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps1(attr, "sym_name", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSymVisibilityAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps1(attr, "sym_visibility", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ConversionFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.function_type)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.sym_visibility)))
return ::mlir::failure();
return ::mlir::success();
}
void ConversionFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.arg_attrs);
writer.writeAttribute(prop.function_type);
writer.writeOptionalAttribute(prop.res_attrs);
writer.writeAttribute(prop.sym_name);
writer.writeOptionalAttribute(prop.sym_visibility);
}
::llvm::StringRef ConversionFuncOp::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::FunctionType ConversionFuncOp::getFunctionType() {
auto attr = getFunctionTypeAttr();
return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
}
::std::optional< ::mlir::ArrayAttr > ConversionFuncOp::getArgAttrs() {
auto attr = getArgAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > ConversionFuncOp::getResAttrs() {
auto attr = getResAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::llvm::StringRef > ConversionFuncOp::getSymVisibility() {
auto attr = getSymVisibilityAttr();
return attr ? ::std::optional< ::llvm::StringRef >(attr.getValue()) : (::std::nullopt);
}
void ConversionFuncOp::setSymName(::llvm::StringRef attrValue) {
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void ConversionFuncOp::setFunctionType(::mlir::FunctionType attrValue) {
getProperties().function_type = ::mlir::TypeAttr::get(attrValue);
}
void ConversionFuncOp::setSymVisibility(::std::optional<::llvm::StringRef> attrValue) {
auto &odsProp = getProperties().sym_visibility;
if (attrValue)
odsProp = ::mlir::Builder((*this)->getContext()).getStringAttr(*attrValue);
else
odsProp = nullptr;
}
void ConversionFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, ::mlir::ArrayAttr arg_attrs, ::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().function_type = function_type;
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
if (sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_visibility = sym_visibility;
}
(void)odsState.addRegion();
}
void ConversionFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, ::mlir::ArrayAttr arg_attrs, ::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().function_type = function_type;
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
if (sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_visibility = sym_visibility;
}
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ConversionFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, ::mlir::ArrayAttr arg_attrs, ::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
if (sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_visibility = sym_visibility;
}
(void)odsState.addRegion();
}
void ConversionFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, ::mlir::ArrayAttr arg_attrs, ::mlir::ArrayAttr res_attrs, ::mlir::StringAttr sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
if (sym_visibility) {
odsState.getOrAddProperties<Properties>().sym_visibility = sym_visibility;
}
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ConversionFuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<ConversionFuncOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult ConversionFuncOp::verifyInvariantsImpl() {
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'");
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
auto tblgen_sym_visibility = getProperties().sym_visibility; (void)tblgen_sym_visibility;
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps1(*this, tblgen_sym_name, "sym_name")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps10(*this, tblgen_function_type, "function_type")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps11(*this, tblgen_arg_attrs, "arg_attrs")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps11(*this, tblgen_res_attrs, "res_attrs")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps1(*this, tblgen_sym_visibility, "sym_visibility")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_1TestOps1(*this, region, "body", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ConversionFuncOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ConversionFuncOp)
namespace test {
namespace detail {
}
CopyOpAdaptor::CopyOpAdaptor(CopyOp op) : CopyOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CopyOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value source, ::mlir::Value target) {
odsState.addOperands(source);
odsState.addOperands(target);
}
void CopyOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, ::mlir::Value target) {
odsState.addOperands(source);
odsState.addOperands(target);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void CopyOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult CopyOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CopyOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CopyOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand sourceRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> sourceOperands(&sourceRawOperand, 1); ::llvm::SMLoc sourceOperandsLoc;
(void)sourceOperandsLoc;
::mlir::OpAsmParser::UnresolvedOperand targetRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> targetOperands(&targetRawOperand, 1); ::llvm::SMLoc targetOperandsLoc;
(void)targetOperandsLoc;
::mlir::Type sourceRawType{};
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
::mlir::Type targetRawType{};
::llvm::ArrayRef<::mlir::Type> targetTypes(&targetRawType, 1);
if (parser.parseLParen())
return ::mlir::failure();
sourceOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sourceRawOperand))
return ::mlir::failure();
if (parser.parseComma())
return ::mlir::failure();
targetOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(targetRawOperand))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseLParen())
return ::mlir::failure();
{
::mlir::BaseMemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sourceRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
{
::mlir::BaseMemRefType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
targetRawType = type;
}
if (parser.parseRParen())
return ::mlir::failure();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
}
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(targetOperands, targetTypes, targetOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CopyOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << "(";
_odsPrinter << getSource();
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getTarget();
_odsPrinter << ")";
_odsPrinter << ' ' << ":";
_odsPrinter << ' ' << "(";
{
auto type = getSource().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
{
auto type = getTarget().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::BaseMemRefType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
void CopyOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
{
auto valueRange = getODSOperandIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Read::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
{
auto valueRange = getODSOperandIndexAndLength(1);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Write::get(), &getOperation()->getOpOperand(idx), 0, false, ::mlir::SideEffects::DefaultResource::get());
}
}
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CopyOp)
namespace test {
namespace detail {
CustomDimensionListAttrOpGenericAdaptorBase::CustomDimensionListAttrOpGenericAdaptorBase(CustomDimensionListAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<int64_t> CustomDimensionListAttrOpGenericAdaptorBase::getDimensionList() {
auto attr = getDimensionListAttr();
return attr;
}
}
CustomDimensionListAttrOpAdaptor::CustomDimensionListAttrOpAdaptor(CustomDimensionListAttrOp op) : CustomDimensionListAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CustomDimensionListAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_dimension_list = getProperties().dimension_list; (void)tblgen_dimension_list;
if (!tblgen_dimension_list) return emitError(loc, "'test.custom_dimension_list_attr' op ""requires attribute 'dimension_list'");
if (tblgen_dimension_list && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_dimension_list))))
return emitError(loc, "'test.custom_dimension_list_attr' op ""attribute 'dimension_list' failed to satisfy constraint: i64 dense array attribute");
return ::mlir::success();
}
::llvm::LogicalResult CustomDimensionListAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.dimension_list;
auto attr = dict.get("dimension_list");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `dimension_list` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CustomDimensionListAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.dimension_list;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("dimension_list",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CustomDimensionListAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.dimension_list.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CustomDimensionListAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "dimension_list")
return prop.dimension_list;
return std::nullopt;
}
void CustomDimensionListAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "dimension_list") {
prop.dimension_list = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.dimension_list)>>(value);
return;
}
}
void CustomDimensionListAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.dimension_list) attrs.append("dimension_list", prop.dimension_list);
}
::llvm::LogicalResult CustomDimensionListAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getDimensionListAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps12(attr, "dimension_list", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CustomDimensionListAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.dimension_list)))
return ::mlir::failure();
return ::mlir::success();
}
void CustomDimensionListAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.dimension_list);
}
::llvm::ArrayRef<int64_t> CustomDimensionListAttrOp::getDimensionList() {
auto attr = getDimensionListAttr();
return attr;
}
void CustomDimensionListAttrOp::setDimensionList(::llvm::ArrayRef<int64_t> attrValue) {
getProperties().dimension_list = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}
void CustomDimensionListAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseI64ArrayAttr dimension_list) {
odsState.getOrAddProperties<Properties>().dimension_list = dimension_list;
}
void CustomDimensionListAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseI64ArrayAttr dimension_list) {
odsState.getOrAddProperties<Properties>().dimension_list = dimension_list;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void CustomDimensionListAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<int64_t> dimension_list) {
odsState.getOrAddProperties<Properties>().dimension_list = odsBuilder.getDenseI64ArrayAttr(dimension_list);
}
void CustomDimensionListAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::ArrayRef<int64_t> dimension_list) {
odsState.getOrAddProperties<Properties>().dimension_list = odsBuilder.getDenseI64ArrayAttr(dimension_list);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void CustomDimensionListAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<CustomDimensionListAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult CustomDimensionListAttrOp::verifyInvariantsImpl() {
auto tblgen_dimension_list = getProperties().dimension_list; (void)tblgen_dimension_list;
if (!tblgen_dimension_list) return emitOpError("requires attribute 'dimension_list'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps12(*this, tblgen_dimension_list, "dimension_list")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult CustomDimensionListAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CustomDimensionListAttrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::DenseI64ArrayAttr dimension_listAttr;
if (parser.parseKeyword("dimension_list"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
{
auto odsResult = parseDimensionList(parser, dimension_listAttr);
if (odsResult) return ::mlir::failure();
result.getOrAddProperties<CustomDimensionListAttrOp::Properties>().dimension_list = dimension_listAttr;
}
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
return ::mlir::success();
}
void CustomDimensionListAttrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ' << "dimension_list";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
printDimensionList(_odsPrinter, *this, getDimensionListAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("dimension_list");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CustomDimensionListAttrOp)
namespace test {
namespace detail {
CustomResultsNameOpGenericAdaptorBase::CustomResultsNameOpGenericAdaptorBase(CustomResultsNameOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> CustomResultsNameOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (odsOperandsSize - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::ArrayAttr CustomResultsNameOpGenericAdaptorBase::getNames() {
auto attr = getNamesAttr();
return attr;
}
}
CustomResultsNameOpAdaptor::CustomResultsNameOpAdaptor(CustomResultsNameOp op) : CustomResultsNameOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CustomResultsNameOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_names = getProperties().names; (void)tblgen_names;
if (!tblgen_names) return emitError(loc, "'test.custom_result_name' op ""requires attribute 'names'");
if (tblgen_names && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_names))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_names), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
return emitError(loc, "'test.custom_result_name' op ""attribute 'names' failed to satisfy constraint: string array attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> CustomResultsNameOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange CustomResultsNameOp::getOptionalMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
std::pair<unsigned, unsigned> CustomResultsNameOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult CustomResultsNameOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.names;
auto attr = dict.get("names");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `names` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CustomResultsNameOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.names;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("names",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CustomResultsNameOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.names.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CustomResultsNameOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "names")
return prop.names;
return std::nullopt;
}
void CustomResultsNameOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "names") {
prop.names = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.names)>>(value);
return;
}
}
void CustomResultsNameOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.names) attrs.append("names", prop.names);
}
::llvm::LogicalResult CustomResultsNameOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getNamesAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps13(attr, "names", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CustomResultsNameOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.names)))
return ::mlir::failure();
return ::mlir::success();
}
void CustomResultsNameOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.names);
}
::mlir::ArrayAttr CustomResultsNameOp::getNames() {
auto attr = getNamesAttr();
return attr;
}
void CustomResultsNameOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange r, ::mlir::ValueRange optional, ::mlir::ArrayAttr names) {
odsState.addOperands(optional);
odsState.getOrAddProperties<Properties>().names = names;
odsState.addTypes(r);
}
void CustomResultsNameOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<CustomResultsNameOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult CustomResultsNameOp::verifyInvariantsImpl() {
auto tblgen_names = getProperties().names; (void)tblgen_names;
if (!tblgen_names) return emitOpError("requires attribute 'names'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_1TestOps13(*this, tblgen_names, "names")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps7(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CustomResultsNameOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::CustomResultsNameOp)
namespace test {
namespace detail {
}
DataLayoutQueryOpAdaptor::DataLayoutQueryOpAdaptor(DataLayoutQueryOp op) : DataLayoutQueryOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DataLayoutQueryOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void DataLayoutQueryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
odsState.addTypes(res);
}
void DataLayoutQueryOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DataLayoutQueryOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult DataLayoutQueryOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_1TestOps8(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult DataLayoutQueryOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::DataLayoutQueryOp)
namespace test {
namespace detail {
}
DefaultDialectOpAdaptor::DefaultDialectOpAdaptor(DefaultDialectOp op) : DefaultDialectOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DefaultDialectOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void DefaultDialectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
(void)odsState.addRegion();
}
void DefaultDialectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DefaultDialectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult DefaultDialectOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_1TestOps1(*this, region, "body", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult DefaultDialectOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult DefaultDialectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<std::unique_ptr<::mlir::Region>, 2> fullRegions;
{
std::unique_ptr<::mlir::Region> region;
auto firstRegionResult = parser.parseOptionalRegion(region);
if (firstRegionResult.has_value()) {
if (failed(*firstRegionResult))
return ::mlir::failure();
fullRegions.emplace_back(std::move(region));
while (succeeded(parser.parseOptionalComma())) {
region = std::make_unique<::mlir::Region>();
if (parser.parseRegion(*region))
return ::mlir::failure();
fullRegions.emplace_back(std::move(region));
}
}
}
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
return ::mlir::failure();
}
result.addRegions(fullRegions);
return ::mlir::success();
}
void DefaultDialectOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
llvm::interleaveComma(getOperation()->getRegions(), _odsPrinter, [&](::mlir::Region ®ion) {
_odsPrinter.printRegion(region);
});
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::DefaultDialectOp)
#endif
#ifdef GET_OP_DEFS_2
#undef GET_OP_DEFS_2
void ::test::registerTestDialectOperations2(::test::TestDialect *dialect) {
::mlir::RegisteredOperationName::insert<::test::DenseArrayAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::DenseArrayNonNegativeOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::DenseArrayStrictlyPositiveAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::DerivedTypeAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ElementwiseMappableOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::FloatAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::FloatElementsAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::FoldToCallOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ForwardBufferOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::FourEqualsFive>(*dialect);
::mlir::RegisteredOperationName::insert<::test::FunctionalRegionOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::GetTupleElementOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::GraphRegionOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::I32ElementsAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::I32EnumAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::I64EnumAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ILLegalOpA>(*dialect);
}
namespace test {
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps1(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be tensor of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps2(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps3(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::BaseMemRefType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be ranked or unranked memref of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps4(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::FunctionType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be function type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps5(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::TupleType>(type))) && (::llvm::all_of(::llvm::cast<::mlir::TupleType>(type).getTypes(), [](::mlir::Type t) { return t && ((true)); })))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be tuple with any combination of any type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps6(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_2TestOps7(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps1(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseBoolArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i1 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps1(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps1(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps2(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseI8ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i8 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps2(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps2(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps3(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseI16ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i16 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps3(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps3(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps4(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i32 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps4(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps4(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps5(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i64 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps5(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps5(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps6(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseF32ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: f32 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps6(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps6(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps7(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseF64ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: f64 dense array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps7(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps7(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps8(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI8ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI8ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i8 dense array attribute whose value is non-negative";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps8(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps8(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps9(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI16ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i16 dense array attribute whose value is non-negative";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps9(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps9(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps10(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI32ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i32 dense array attribute whose value is non-negative";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps10(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps10(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps11(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI64ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i64 dense array attribute whose value is non-negative";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps11(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps11(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps12(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseF32ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseF32ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: f32 dense array attribute whose value is non-negative";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps12(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps12(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps13(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseF64ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseF64ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: f64 dense array attribute whose value is non-negative";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps13(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps13(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps14(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI8ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI8ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i8 dense array attribute whose value is positive";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps14(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps14(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps15(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI16ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i16 dense array attribute whose value is positive";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps15(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps15(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps16(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI32ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i32 dense array attribute whose value is positive";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps16(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps16(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps17(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseI64ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: i64 dense array attribute whose value is positive";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps17(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps17(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps18(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseF32ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseF32ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: f32 dense array attribute whose value is positive";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps18(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps18(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps19(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseF64ArrayAttr>(attr))) && ((::llvm::all_of(::llvm::cast<DenseF64ArrayAttr>(attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: f64 dense array attribute whose value is positive";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps19(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps19(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps20(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((true)))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: any attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps20(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps20(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps21(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseFPElementsAttr>(attr) &&::llvm::cast<::mlir::DenseFPElementsAttr>(attr).getType().getElementType().isF32() && ::llvm::cast<::mlir::DenseFPElementsAttr>(attr).getType().hasRank() && ::llvm::cast<::mlir::DenseFPElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef<int64_t>({2}))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit float elements attribute of shape [2]";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps21(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps21(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps22(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::DenseFPElementsAttr>(attr) &&::llvm::cast<::mlir::DenseFPElementsAttr>(attr).getType().getElementType().isF64() && ::llvm::cast<::mlir::DenseFPElementsAttr>(attr).getType().hasRank() && ::llvm::cast<::mlir::DenseFPElementsAttr>(attr).getType().getShape() == ::mlir::ArrayRef<int64_t>({4, 8}))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 64-bit float elements attribute of shape [4, 8]";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps22(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps22(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps23(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: flat symbol reference attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps23(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps23(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps24(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignlessInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit signless integer attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps24(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps24(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps25(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit signless integer elements attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps25(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps25(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps26(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::SomeI32EnumAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: allowed 32-bit signless integer cases: 5, 10";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps26(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps26(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps27(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::SomeI64EnumAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: allowed 64-bit signless integer cases: 5, 10";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_2TestOps27(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_2TestOps27(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_2TestOps1(
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((true))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: any region";
}
return ::mlir::success();
}
}
namespace test {
namespace detail {
DenseArrayAttrOpGenericAdaptorBase::DenseArrayAttrOpGenericAdaptorBase(DenseArrayAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<bool> DenseArrayAttrOpGenericAdaptorBase::getI1attr() {
auto attr = getI1attrAttr();
return attr;
}
::llvm::ArrayRef<int8_t> DenseArrayAttrOpGenericAdaptorBase::getI8attr() {
auto attr = getI8attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayAttrOpGenericAdaptorBase::getI16attr() {
auto attr = getI16attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayAttrOpGenericAdaptorBase::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> DenseArrayAttrOpGenericAdaptorBase::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
::llvm::ArrayRef<float> DenseArrayAttrOpGenericAdaptorBase::getF32attr() {
auto attr = getF32attrAttr();
return attr;
}
::llvm::ArrayRef<double> DenseArrayAttrOpGenericAdaptorBase::getF64attr() {
auto attr = getF64attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayAttrOpGenericAdaptorBase::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
}
DenseArrayAttrOpAdaptor::DenseArrayAttrOpAdaptor(DenseArrayAttrOp op) : DenseArrayAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DenseArrayAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'emptyattr'");
auto tblgen_f32attr = getProperties().f32attr; (void)tblgen_f32attr;
if (!tblgen_f32attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'f32attr'");
auto tblgen_f64attr = getProperties().f64attr; (void)tblgen_f64attr;
if (!tblgen_f64attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'f64attr'");
auto tblgen_i16attr = getProperties().i16attr; (void)tblgen_i16attr;
if (!tblgen_i16attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'i16attr'");
auto tblgen_i1attr = getProperties().i1attr; (void)tblgen_i1attr;
if (!tblgen_i1attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'i1attr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'i64attr'");
auto tblgen_i8attr = getProperties().i8attr; (void)tblgen_i8attr;
if (!tblgen_i8attr) return emitError(loc, "'test.dense_array_attr' op ""requires attribute 'i8attr'");
if (tblgen_i1attr && !((::llvm::isa<::mlir::DenseBoolArrayAttr>(tblgen_i1attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'i1attr' failed to satisfy constraint: i1 dense array attribute");
if (tblgen_i8attr && !((::llvm::isa<::mlir::DenseI8ArrayAttr>(tblgen_i8attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'i8attr' failed to satisfy constraint: i8 dense array attribute");
if (tblgen_i16attr && !((::llvm::isa<::mlir::DenseI16ArrayAttr>(tblgen_i16attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'i16attr' failed to satisfy constraint: i16 dense array attribute");
if (tblgen_i32attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_i32attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'i32attr' failed to satisfy constraint: i32 dense array attribute");
if (tblgen_i64attr && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_i64attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'i64attr' failed to satisfy constraint: i64 dense array attribute");
if (tblgen_f32attr && !((::llvm::isa<::mlir::DenseF32ArrayAttr>(tblgen_f32attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'f32attr' failed to satisfy constraint: f32 dense array attribute");
if (tblgen_f64attr && !((::llvm::isa<::mlir::DenseF64ArrayAttr>(tblgen_f64attr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'f64attr' failed to satisfy constraint: f64 dense array attribute");
if (tblgen_emptyattr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_emptyattr))))
return emitError(loc, "'test.dense_array_attr' op ""attribute 'emptyattr' failed to satisfy constraint: i32 dense array attribute");
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.emptyattr;
auto attr = dict.get("emptyattr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `emptyattr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.f32attr;
auto attr = dict.get("f32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `f32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.f64attr;
auto attr = dict.get("f64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `f64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i16attr;
auto attr = dict.get("i16attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i16attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i1attr;
auto attr = dict.get("i1attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i1attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i32attr;
auto attr = dict.get("i32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i64attr;
auto attr = dict.get("i64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i8attr;
auto attr = dict.get("i8attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i8attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute DenseArrayAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.emptyattr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("emptyattr",
propStorage));
}
{
const auto &propStorage = prop.f32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("f32attr",
propStorage));
}
{
const auto &propStorage = prop.f64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("f64attr",
propStorage));
}
{
const auto &propStorage = prop.i16attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i16attr",
propStorage));
}
{
const auto &propStorage = prop.i1attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i1attr",
propStorage));
}
{
const auto &propStorage = prop.i32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i32attr",
propStorage));
}
{
const auto &propStorage = prop.i64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i64attr",
propStorage));
}
{
const auto &propStorage = prop.i8attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i8attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DenseArrayAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.emptyattr.getAsOpaquePointer()),
llvm::hash_value(prop.f32attr.getAsOpaquePointer()),
llvm::hash_value(prop.f64attr.getAsOpaquePointer()),
llvm::hash_value(prop.i16attr.getAsOpaquePointer()),
llvm::hash_value(prop.i1attr.getAsOpaquePointer()),
llvm::hash_value(prop.i32attr.getAsOpaquePointer()),
llvm::hash_value(prop.i64attr.getAsOpaquePointer()),
llvm::hash_value(prop.i8attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> DenseArrayAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "emptyattr")
return prop.emptyattr;
if (name == "f32attr")
return prop.f32attr;
if (name == "f64attr")
return prop.f64attr;
if (name == "i16attr")
return prop.i16attr;
if (name == "i1attr")
return prop.i1attr;
if (name == "i32attr")
return prop.i32attr;
if (name == "i64attr")
return prop.i64attr;
if (name == "i8attr")
return prop.i8attr;
return std::nullopt;
}
void DenseArrayAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "emptyattr") {
prop.emptyattr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.emptyattr)>>(value);
return;
}
if (name == "f32attr") {
prop.f32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.f32attr)>>(value);
return;
}
if (name == "f64attr") {
prop.f64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.f64attr)>>(value);
return;
}
if (name == "i16attr") {
prop.i16attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i16attr)>>(value);
return;
}
if (name == "i1attr") {
prop.i1attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i1attr)>>(value);
return;
}
if (name == "i32attr") {
prop.i32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i32attr)>>(value);
return;
}
if (name == "i64attr") {
prop.i64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i64attr)>>(value);
return;
}
if (name == "i8attr") {
prop.i8attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i8attr)>>(value);
return;
}
}
void DenseArrayAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.emptyattr) attrs.append("emptyattr", prop.emptyattr);
if (prop.f32attr) attrs.append("f32attr", prop.f32attr);
if (prop.f64attr) attrs.append("f64attr", prop.f64attr);
if (prop.i16attr) attrs.append("i16attr", prop.i16attr);
if (prop.i1attr) attrs.append("i1attr", prop.i1attr);
if (prop.i32attr) attrs.append("i32attr", prop.i32attr);
if (prop.i64attr) attrs.append("i64attr", prop.i64attr);
if (prop.i8attr) attrs.append("i8attr", prop.i8attr);
}
::llvm::LogicalResult DenseArrayAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getEmptyattrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps4(attr, "emptyattr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getF32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps6(attr, "f32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getF64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps7(attr, "f64attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI16attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps3(attr, "i16attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI1attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps1(attr, "i1attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps4(attr, "i32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps5(attr, "i64attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI8attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps2(attr, "i8attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.emptyattr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.f32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.f64attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i16attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i1attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i64attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i8attr)))
return ::mlir::failure();
return ::mlir::success();
}
void DenseArrayAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.emptyattr);
writer.writeAttribute(prop.f32attr);
writer.writeAttribute(prop.f64attr);
writer.writeAttribute(prop.i16attr);
writer.writeAttribute(prop.i1attr);
writer.writeAttribute(prop.i32attr);
writer.writeAttribute(prop.i64attr);
writer.writeAttribute(prop.i8attr);
}
::llvm::ArrayRef<bool> DenseArrayAttrOp::getI1attr() {
auto attr = getI1attrAttr();
return attr;
}
::llvm::ArrayRef<int8_t> DenseArrayAttrOp::getI8attr() {
auto attr = getI8attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayAttrOp::getI16attr() {
auto attr = getI16attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayAttrOp::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> DenseArrayAttrOp::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
::llvm::ArrayRef<float> DenseArrayAttrOp::getF32attr() {
auto attr = getF32attrAttr();
return attr;
}
::llvm::ArrayRef<double> DenseArrayAttrOp::getF64attr() {
auto attr = getF64attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayAttrOp::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
void DenseArrayAttrOp::setI1attr(::llvm::ArrayRef<bool> attrValue) {
getProperties().i1attr = ::mlir::Builder((*this)->getContext()).getDenseBoolArrayAttr(attrValue);
}
void DenseArrayAttrOp::setI8attr(::llvm::ArrayRef<int8_t> attrValue) {
getProperties().i8attr = ::mlir::Builder((*this)->getContext()).getDenseI8ArrayAttr(attrValue);
}
void DenseArrayAttrOp::setI16attr(::llvm::ArrayRef<int16_t> attrValue) {
getProperties().i16attr = ::mlir::Builder((*this)->getContext()).getDenseI16ArrayAttr(attrValue);
}
void DenseArrayAttrOp::setI32attr(::llvm::ArrayRef<int32_t> attrValue) {
getProperties().i32attr = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
}
void DenseArrayAttrOp::setI64attr(::llvm::ArrayRef<int64_t> attrValue) {
getProperties().i64attr = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}
void DenseArrayAttrOp::setF32attr(::llvm::ArrayRef<float> attrValue) {
getProperties().f32attr = ::mlir::Builder((*this)->getContext()).getDenseF32ArrayAttr(attrValue);
}
void DenseArrayAttrOp::setF64attr(::llvm::ArrayRef<double> attrValue) {
getProperties().f64attr = ::mlir::Builder((*this)->getContext()).getDenseF64ArrayAttr(attrValue);
}
void DenseArrayAttrOp::setEmptyattr(::llvm::ArrayRef<int32_t> attrValue) {
getProperties().emptyattr = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
}
void DenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseBoolArrayAttr i1attr, ::mlir::DenseI8ArrayAttr i8attr, ::mlir::DenseI16ArrayAttr i16attr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr, ::mlir::DenseF32ArrayAttr f32attr, ::mlir::DenseF64ArrayAttr f64attr, ::mlir::DenseI32ArrayAttr emptyattr) {
odsState.getOrAddProperties<Properties>().i1attr = i1attr;
odsState.getOrAddProperties<Properties>().i8attr = i8attr;
odsState.getOrAddProperties<Properties>().i16attr = i16attr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
odsState.getOrAddProperties<Properties>().f32attr = f32attr;
odsState.getOrAddProperties<Properties>().f64attr = f64attr;
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
}
void DenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseBoolArrayAttr i1attr, ::mlir::DenseI8ArrayAttr i8attr, ::mlir::DenseI16ArrayAttr i16attr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr, ::mlir::DenseF32ArrayAttr f32attr, ::mlir::DenseF64ArrayAttr f64attr, ::mlir::DenseI32ArrayAttr emptyattr) {
odsState.getOrAddProperties<Properties>().i1attr = i1attr;
odsState.getOrAddProperties<Properties>().i8attr = i8attr;
odsState.getOrAddProperties<Properties>().i16attr = i16attr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
odsState.getOrAddProperties<Properties>().f32attr = f32attr;
odsState.getOrAddProperties<Properties>().f64attr = f64attr;
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<bool> i1attr, ::llvm::ArrayRef<int8_t> i8attr, ::llvm::ArrayRef<int16_t> i16attr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr, ::llvm::ArrayRef<float> f32attr, ::llvm::ArrayRef<double> f64attr, ::llvm::ArrayRef<int32_t> emptyattr) {
odsState.getOrAddProperties<Properties>().i1attr = odsBuilder.getDenseBoolArrayAttr(i1attr);
odsState.getOrAddProperties<Properties>().i8attr = odsBuilder.getDenseI8ArrayAttr(i8attr);
odsState.getOrAddProperties<Properties>().i16attr = odsBuilder.getDenseI16ArrayAttr(i16attr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
odsState.getOrAddProperties<Properties>().f32attr = odsBuilder.getDenseF32ArrayAttr(f32attr);
odsState.getOrAddProperties<Properties>().f64attr = odsBuilder.getDenseF64ArrayAttr(f64attr);
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI32ArrayAttr(emptyattr);
}
void DenseArrayAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::ArrayRef<bool> i1attr, ::llvm::ArrayRef<int8_t> i8attr, ::llvm::ArrayRef<int16_t> i16attr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr, ::llvm::ArrayRef<float> f32attr, ::llvm::ArrayRef<double> f64attr, ::llvm::ArrayRef<int32_t> emptyattr) {
odsState.getOrAddProperties<Properties>().i1attr = odsBuilder.getDenseBoolArrayAttr(i1attr);
odsState.getOrAddProperties<Properties>().i8attr = odsBuilder.getDenseI8ArrayAttr(i8attr);
odsState.getOrAddProperties<Properties>().i16attr = odsBuilder.getDenseI16ArrayAttr(i16attr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
odsState.getOrAddProperties<Properties>().f32attr = odsBuilder.getDenseF32ArrayAttr(f32attr);
odsState.getOrAddProperties<Properties>().f64attr = odsBuilder.getDenseF64ArrayAttr(f64attr);
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI32ArrayAttr(emptyattr);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DenseArrayAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<DenseArrayAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult DenseArrayAttrOp::verifyInvariantsImpl() {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitOpError("requires attribute 'emptyattr'");
auto tblgen_f32attr = getProperties().f32attr; (void)tblgen_f32attr;
if (!tblgen_f32attr) return emitOpError("requires attribute 'f32attr'");
auto tblgen_f64attr = getProperties().f64attr; (void)tblgen_f64attr;
if (!tblgen_f64attr) return emitOpError("requires attribute 'f64attr'");
auto tblgen_i16attr = getProperties().i16attr; (void)tblgen_i16attr;
if (!tblgen_i16attr) return emitOpError("requires attribute 'i16attr'");
auto tblgen_i1attr = getProperties().i1attr; (void)tblgen_i1attr;
if (!tblgen_i1attr) return emitOpError("requires attribute 'i1attr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitOpError("requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitOpError("requires attribute 'i64attr'");
auto tblgen_i8attr = getProperties().i8attr; (void)tblgen_i8attr;
if (!tblgen_i8attr) return emitOpError("requires attribute 'i8attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps1(*this, tblgen_i1attr, "i1attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps2(*this, tblgen_i8attr, "i8attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps3(*this, tblgen_i16attr, "i16attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps4(*this, tblgen_i32attr, "i32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps5(*this, tblgen_i64attr, "i64attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps6(*this, tblgen_f32attr, "f32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps7(*this, tblgen_f64attr, "f64attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps4(*this, tblgen_emptyattr, "emptyattr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult DenseArrayAttrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::DenseBoolArrayAttr i1attrAttr;
::mlir::DenseI8ArrayAttr i8attrAttr;
::mlir::DenseI16ArrayAttr i16attrAttr;
::mlir::DenseI32ArrayAttr i32attrAttr;
::mlir::DenseI64ArrayAttr i64attrAttr;
::mlir::DenseF32ArrayAttr f32attrAttr;
::mlir::DenseF64ArrayAttr f64attrAttr;
::mlir::DenseI32ArrayAttr emptyattrAttr;
if (parser.parseKeyword("i1attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(i1attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (i1attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().i1attr = i1attrAttr;
if (parser.parseKeyword("i8attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(i8attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (i8attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().i8attr = i8attrAttr;
if (parser.parseKeyword("i16attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(i16attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (i16attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().i16attr = i16attrAttr;
if (parser.parseKeyword("i32attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(i32attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (i32attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().i32attr = i32attrAttr;
if (parser.parseKeyword("i64attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(i64attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (i64attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().i64attr = i64attrAttr;
if (parser.parseKeyword("f32attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(f32attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (f32attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().f32attr = f32attrAttr;
if (parser.parseKeyword("f64attr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(f64attrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (f64attrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().f64attr = f64attrAttr;
if (parser.parseKeyword("emptyattr"))
return ::mlir::failure();
if (parser.parseEqual())
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(emptyattrAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (emptyattrAttr) result.getOrAddProperties<DenseArrayAttrOp::Properties>().emptyattr = emptyattrAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDict(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
return ::mlir::success();
}
void DenseArrayAttrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ' << "i1attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getI1attrAttr());
_odsPrinter << ' ' << "i8attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getI8attrAttr());
_odsPrinter << ' ' << "i16attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getI16attrAttr());
_odsPrinter << ' ' << "i32attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getI32attrAttr());
_odsPrinter << ' ' << "i64attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getI64attrAttr());
_odsPrinter << ' ' << "f32attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getF32attrAttr());
_odsPrinter << ' ' << "f64attr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getF64attrAttr());
_odsPrinter << ' ' << "emptyattr";
_odsPrinter << ' ' << "=";
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getEmptyattrAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("i1attr");
elidedAttrs.push_back("i8attr");
elidedAttrs.push_back("i16attr");
elidedAttrs.push_back("i32attr");
elidedAttrs.push_back("i64attr");
elidedAttrs.push_back("f32attr");
elidedAttrs.push_back("f64attr");
elidedAttrs.push_back("emptyattr");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::DenseArrayAttrOp)
namespace test {
namespace detail {
DenseArrayNonNegativeOpGenericAdaptorBase::DenseArrayNonNegativeOpGenericAdaptorBase(DenseArrayNonNegativeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<int8_t> DenseArrayNonNegativeOpGenericAdaptorBase::getI8attr() {
auto attr = getI8attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayNonNegativeOpGenericAdaptorBase::getI16attr() {
auto attr = getI16attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayNonNegativeOpGenericAdaptorBase::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> DenseArrayNonNegativeOpGenericAdaptorBase::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
::llvm::ArrayRef<float> DenseArrayNonNegativeOpGenericAdaptorBase::getF32attr() {
auto attr = getF32attrAttr();
return attr;
}
::llvm::ArrayRef<double> DenseArrayNonNegativeOpGenericAdaptorBase::getF64attr() {
auto attr = getF64attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayNonNegativeOpGenericAdaptorBase::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
}
DenseArrayNonNegativeOpAdaptor::DenseArrayNonNegativeOpAdaptor(DenseArrayNonNegativeOp op) : DenseArrayNonNegativeOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DenseArrayNonNegativeOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'emptyattr'");
auto tblgen_f32attr = getProperties().f32attr; (void)tblgen_f32attr;
if (!tblgen_f32attr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'f32attr'");
auto tblgen_f64attr = getProperties().f64attr; (void)tblgen_f64attr;
if (!tblgen_f64attr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'f64attr'");
auto tblgen_i16attr = getProperties().i16attr; (void)tblgen_i16attr;
if (!tblgen_i16attr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'i16attr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'i64attr'");
auto tblgen_i8attr = getProperties().i8attr; (void)tblgen_i8attr;
if (!tblgen_i8attr) return emitError(loc, "'test.confined_non_negative_attr' op ""requires attribute 'i8attr'");
if (tblgen_i8attr && !(((::llvm::isa<::mlir::DenseI8ArrayAttr>(tblgen_i8attr))) && ((::llvm::all_of(::llvm::cast<DenseI8ArrayAttr>(tblgen_i8attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'i8attr' failed to satisfy constraint: i8 dense array attribute whose value is non-negative");
if (tblgen_i16attr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(tblgen_i16attr))) && ((::llvm::all_of(::llvm::cast<DenseI16ArrayAttr>(tblgen_i16attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'i16attr' failed to satisfy constraint: i16 dense array attribute whose value is non-negative");
if (tblgen_i32attr && !(((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_i32attr))) && ((::llvm::all_of(::llvm::cast<DenseI32ArrayAttr>(tblgen_i32attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'i32attr' failed to satisfy constraint: i32 dense array attribute whose value is non-negative");
if (tblgen_i64attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_i64attr))) && ((::llvm::all_of(::llvm::cast<DenseI64ArrayAttr>(tblgen_i64attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'i64attr' failed to satisfy constraint: i64 dense array attribute whose value is non-negative");
if (tblgen_f32attr && !(((::llvm::isa<::mlir::DenseF32ArrayAttr>(tblgen_f32attr))) && ((::llvm::all_of(::llvm::cast<DenseF32ArrayAttr>(tblgen_f32attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'f32attr' failed to satisfy constraint: f32 dense array attribute whose value is non-negative");
if (tblgen_f64attr && !(((::llvm::isa<::mlir::DenseF64ArrayAttr>(tblgen_f64attr))) && ((::llvm::all_of(::llvm::cast<DenseF64ArrayAttr>(tblgen_f64attr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'f64attr' failed to satisfy constraint: f64 dense array attribute whose value is non-negative");
if (tblgen_emptyattr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(tblgen_emptyattr))) && ((::llvm::all_of(::llvm::cast<DenseI16ArrayAttr>(tblgen_emptyattr).asArrayRef(), [&](auto v) { return v >= 0; })))))
return emitError(loc, "'test.confined_non_negative_attr' op ""attribute 'emptyattr' failed to satisfy constraint: i16 dense array attribute whose value is non-negative");
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayNonNegativeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.emptyattr;
auto attr = dict.get("emptyattr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `emptyattr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.f32attr;
auto attr = dict.get("f32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `f32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.f64attr;
auto attr = dict.get("f64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `f64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i16attr;
auto attr = dict.get("i16attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i16attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i32attr;
auto attr = dict.get("i32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i64attr;
auto attr = dict.get("i64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i8attr;
auto attr = dict.get("i8attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i8attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute DenseArrayNonNegativeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.emptyattr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("emptyattr",
propStorage));
}
{
const auto &propStorage = prop.f32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("f32attr",
propStorage));
}
{
const auto &propStorage = prop.f64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("f64attr",
propStorage));
}
{
const auto &propStorage = prop.i16attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i16attr",
propStorage));
}
{
const auto &propStorage = prop.i32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i32attr",
propStorage));
}
{
const auto &propStorage = prop.i64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i64attr",
propStorage));
}
{
const auto &propStorage = prop.i8attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i8attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DenseArrayNonNegativeOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.emptyattr.getAsOpaquePointer()),
llvm::hash_value(prop.f32attr.getAsOpaquePointer()),
llvm::hash_value(prop.f64attr.getAsOpaquePointer()),
llvm::hash_value(prop.i16attr.getAsOpaquePointer()),
llvm::hash_value(prop.i32attr.getAsOpaquePointer()),
llvm::hash_value(prop.i64attr.getAsOpaquePointer()),
llvm::hash_value(prop.i8attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> DenseArrayNonNegativeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "emptyattr")
return prop.emptyattr;
if (name == "f32attr")
return prop.f32attr;
if (name == "f64attr")
return prop.f64attr;
if (name == "i16attr")
return prop.i16attr;
if (name == "i32attr")
return prop.i32attr;
if (name == "i64attr")
return prop.i64attr;
if (name == "i8attr")
return prop.i8attr;
return std::nullopt;
}
void DenseArrayNonNegativeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "emptyattr") {
prop.emptyattr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.emptyattr)>>(value);
return;
}
if (name == "f32attr") {
prop.f32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.f32attr)>>(value);
return;
}
if (name == "f64attr") {
prop.f64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.f64attr)>>(value);
return;
}
if (name == "i16attr") {
prop.i16attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i16attr)>>(value);
return;
}
if (name == "i32attr") {
prop.i32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i32attr)>>(value);
return;
}
if (name == "i64attr") {
prop.i64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i64attr)>>(value);
return;
}
if (name == "i8attr") {
prop.i8attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i8attr)>>(value);
return;
}
}
void DenseArrayNonNegativeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.emptyattr) attrs.append("emptyattr", prop.emptyattr);
if (prop.f32attr) attrs.append("f32attr", prop.f32attr);
if (prop.f64attr) attrs.append("f64attr", prop.f64attr);
if (prop.i16attr) attrs.append("i16attr", prop.i16attr);
if (prop.i32attr) attrs.append("i32attr", prop.i32attr);
if (prop.i64attr) attrs.append("i64attr", prop.i64attr);
if (prop.i8attr) attrs.append("i8attr", prop.i8attr);
}
::llvm::LogicalResult DenseArrayNonNegativeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getEmptyattrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps9(attr, "emptyattr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getF32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps12(attr, "f32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getF64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps13(attr, "f64attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI16attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps9(attr, "i16attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps10(attr, "i32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps11(attr, "i64attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI8attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps8(attr, "i8attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayNonNegativeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.emptyattr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.f32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.f64attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i16attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i64attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i8attr)))
return ::mlir::failure();
return ::mlir::success();
}
void DenseArrayNonNegativeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.emptyattr);
writer.writeAttribute(prop.f32attr);
writer.writeAttribute(prop.f64attr);
writer.writeAttribute(prop.i16attr);
writer.writeAttribute(prop.i32attr);
writer.writeAttribute(prop.i64attr);
writer.writeAttribute(prop.i8attr);
}
::llvm::ArrayRef<int8_t> DenseArrayNonNegativeOp::getI8attr() {
auto attr = getI8attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayNonNegativeOp::getI16attr() {
auto attr = getI16attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayNonNegativeOp::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> DenseArrayNonNegativeOp::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
::llvm::ArrayRef<float> DenseArrayNonNegativeOp::getF32attr() {
auto attr = getF32attrAttr();
return attr;
}
::llvm::ArrayRef<double> DenseArrayNonNegativeOp::getF64attr() {
auto attr = getF64attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayNonNegativeOp::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
void DenseArrayNonNegativeOp::setI8attr(::llvm::ArrayRef<int8_t> attrValue) {
getProperties().i8attr = ::mlir::Builder((*this)->getContext()).getDenseI8ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::setI16attr(::llvm::ArrayRef<int16_t> attrValue) {
getProperties().i16attr = ::mlir::Builder((*this)->getContext()).getDenseI16ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::setI32attr(::llvm::ArrayRef<int32_t> attrValue) {
getProperties().i32attr = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::setI64attr(::llvm::ArrayRef<int64_t> attrValue) {
getProperties().i64attr = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::setF32attr(::llvm::ArrayRef<float> attrValue) {
getProperties().f32attr = ::mlir::Builder((*this)->getContext()).getDenseF32ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::setF64attr(::llvm::ArrayRef<double> attrValue) {
getProperties().f64attr = ::mlir::Builder((*this)->getContext()).getDenseF64ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::setEmptyattr(::llvm::ArrayRef<int16_t> attrValue) {
getProperties().emptyattr = ::mlir::Builder((*this)->getContext()).getDenseI16ArrayAttr(attrValue);
}
void DenseArrayNonNegativeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseI8ArrayAttr i8attr, ::mlir::DenseI16ArrayAttr i16attr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr, ::mlir::DenseF32ArrayAttr f32attr, ::mlir::DenseF64ArrayAttr f64attr, ::mlir::DenseI16ArrayAttr emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = i8attr;
odsState.getOrAddProperties<Properties>().i16attr = i16attr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
odsState.getOrAddProperties<Properties>().f32attr = f32attr;
odsState.getOrAddProperties<Properties>().f64attr = f64attr;
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
}
void DenseArrayNonNegativeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseI8ArrayAttr i8attr, ::mlir::DenseI16ArrayAttr i16attr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr, ::mlir::DenseF32ArrayAttr f32attr, ::mlir::DenseF64ArrayAttr f64attr, ::mlir::DenseI16ArrayAttr emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = i8attr;
odsState.getOrAddProperties<Properties>().i16attr = i16attr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
odsState.getOrAddProperties<Properties>().f32attr = f32attr;
odsState.getOrAddProperties<Properties>().f64attr = f64attr;
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DenseArrayNonNegativeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<int8_t> i8attr, ::llvm::ArrayRef<int16_t> i16attr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr, ::llvm::ArrayRef<float> f32attr, ::llvm::ArrayRef<double> f64attr, ::llvm::ArrayRef<int16_t> emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = odsBuilder.getDenseI8ArrayAttr(i8attr);
odsState.getOrAddProperties<Properties>().i16attr = odsBuilder.getDenseI16ArrayAttr(i16attr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
odsState.getOrAddProperties<Properties>().f32attr = odsBuilder.getDenseF32ArrayAttr(f32attr);
odsState.getOrAddProperties<Properties>().f64attr = odsBuilder.getDenseF64ArrayAttr(f64attr);
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI16ArrayAttr(emptyattr);
}
void DenseArrayNonNegativeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::ArrayRef<int8_t> i8attr, ::llvm::ArrayRef<int16_t> i16attr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr, ::llvm::ArrayRef<float> f32attr, ::llvm::ArrayRef<double> f64attr, ::llvm::ArrayRef<int16_t> emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = odsBuilder.getDenseI8ArrayAttr(i8attr);
odsState.getOrAddProperties<Properties>().i16attr = odsBuilder.getDenseI16ArrayAttr(i16attr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
odsState.getOrAddProperties<Properties>().f32attr = odsBuilder.getDenseF32ArrayAttr(f32attr);
odsState.getOrAddProperties<Properties>().f64attr = odsBuilder.getDenseF64ArrayAttr(f64attr);
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI16ArrayAttr(emptyattr);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DenseArrayNonNegativeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<DenseArrayNonNegativeOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult DenseArrayNonNegativeOp::verifyInvariantsImpl() {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitOpError("requires attribute 'emptyattr'");
auto tblgen_f32attr = getProperties().f32attr; (void)tblgen_f32attr;
if (!tblgen_f32attr) return emitOpError("requires attribute 'f32attr'");
auto tblgen_f64attr = getProperties().f64attr; (void)tblgen_f64attr;
if (!tblgen_f64attr) return emitOpError("requires attribute 'f64attr'");
auto tblgen_i16attr = getProperties().i16attr; (void)tblgen_i16attr;
if (!tblgen_i16attr) return emitOpError("requires attribute 'i16attr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitOpError("requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitOpError("requires attribute 'i64attr'");
auto tblgen_i8attr = getProperties().i8attr; (void)tblgen_i8attr;
if (!tblgen_i8attr) return emitOpError("requires attribute 'i8attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps8(*this, tblgen_i8attr, "i8attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps9(*this, tblgen_i16attr, "i16attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps10(*this, tblgen_i32attr, "i32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps11(*this, tblgen_i64attr, "i64attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps12(*this, tblgen_f32attr, "f32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps13(*this, tblgen_f64attr, "f64attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps9(*this, tblgen_emptyattr, "emptyattr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayNonNegativeOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::DenseArrayNonNegativeOp)
namespace test {
namespace detail {
DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase(DenseArrayStrictlyPositiveAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<int8_t> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getI8attr() {
auto attr = getI8attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getI16attr() {
auto attr = getI16attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
::llvm::ArrayRef<float> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getF32attr() {
auto attr = getF32attrAttr();
return attr;
}
::llvm::ArrayRef<double> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getF64attr() {
auto attr = getF64attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayStrictlyPositiveAttrOpGenericAdaptorBase::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
}
DenseArrayStrictlyPositiveAttrOpAdaptor::DenseArrayStrictlyPositiveAttrOpAdaptor(DenseArrayStrictlyPositiveAttrOp op) : DenseArrayStrictlyPositiveAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DenseArrayStrictlyPositiveAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'emptyattr'");
auto tblgen_f32attr = getProperties().f32attr; (void)tblgen_f32attr;
if (!tblgen_f32attr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'f32attr'");
auto tblgen_f64attr = getProperties().f64attr; (void)tblgen_f64attr;
if (!tblgen_f64attr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'f64attr'");
auto tblgen_i16attr = getProperties().i16attr; (void)tblgen_i16attr;
if (!tblgen_i16attr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'i16attr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'i64attr'");
auto tblgen_i8attr = getProperties().i8attr; (void)tblgen_i8attr;
if (!tblgen_i8attr) return emitError(loc, "'test.confined_strictly_positive_attr' op ""requires attribute 'i8attr'");
if (tblgen_i8attr && !(((::llvm::isa<::mlir::DenseI8ArrayAttr>(tblgen_i8attr))) && ((::llvm::all_of(::llvm::cast<DenseI8ArrayAttr>(tblgen_i8attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'i8attr' failed to satisfy constraint: i8 dense array attribute whose value is positive");
if (tblgen_i16attr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(tblgen_i16attr))) && ((::llvm::all_of(::llvm::cast<DenseI16ArrayAttr>(tblgen_i16attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'i16attr' failed to satisfy constraint: i16 dense array attribute whose value is positive");
if (tblgen_i32attr && !(((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_i32attr))) && ((::llvm::all_of(::llvm::cast<DenseI32ArrayAttr>(tblgen_i32attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'i32attr' failed to satisfy constraint: i32 dense array attribute whose value is positive");
if (tblgen_i64attr && !(((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_i64attr))) && ((::llvm::all_of(::llvm::cast<DenseI64ArrayAttr>(tblgen_i64attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'i64attr' failed to satisfy constraint: i64 dense array attribute whose value is positive");
if (tblgen_f32attr && !(((::llvm::isa<::mlir::DenseF32ArrayAttr>(tblgen_f32attr))) && ((::llvm::all_of(::llvm::cast<DenseF32ArrayAttr>(tblgen_f32attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'f32attr' failed to satisfy constraint: f32 dense array attribute whose value is positive");
if (tblgen_f64attr && !(((::llvm::isa<::mlir::DenseF64ArrayAttr>(tblgen_f64attr))) && ((::llvm::all_of(::llvm::cast<DenseF64ArrayAttr>(tblgen_f64attr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'f64attr' failed to satisfy constraint: f64 dense array attribute whose value is positive");
if (tblgen_emptyattr && !(((::llvm::isa<::mlir::DenseI16ArrayAttr>(tblgen_emptyattr))) && ((::llvm::all_of(::llvm::cast<DenseI16ArrayAttr>(tblgen_emptyattr).asArrayRef(), [&](auto v) { return v > 0; })))))
return emitError(loc, "'test.confined_strictly_positive_attr' op ""attribute 'emptyattr' failed to satisfy constraint: i16 dense array attribute whose value is positive");
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayStrictlyPositiveAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.emptyattr;
auto attr = dict.get("emptyattr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `emptyattr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.f32attr;
auto attr = dict.get("f32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `f32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.f64attr;
auto attr = dict.get("f64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `f64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i16attr;
auto attr = dict.get("i16attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i16attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i32attr;
auto attr = dict.get("i32attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i32attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i64attr;
auto attr = dict.get("i64attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i64attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i8attr;
auto attr = dict.get("i8attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i8attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute DenseArrayStrictlyPositiveAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.emptyattr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("emptyattr",
propStorage));
}
{
const auto &propStorage = prop.f32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("f32attr",
propStorage));
}
{
const auto &propStorage = prop.f64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("f64attr",
propStorage));
}
{
const auto &propStorage = prop.i16attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i16attr",
propStorage));
}
{
const auto &propStorage = prop.i32attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i32attr",
propStorage));
}
{
const auto &propStorage = prop.i64attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i64attr",
propStorage));
}
{
const auto &propStorage = prop.i8attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i8attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DenseArrayStrictlyPositiveAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.emptyattr.getAsOpaquePointer()),
llvm::hash_value(prop.f32attr.getAsOpaquePointer()),
llvm::hash_value(prop.f64attr.getAsOpaquePointer()),
llvm::hash_value(prop.i16attr.getAsOpaquePointer()),
llvm::hash_value(prop.i32attr.getAsOpaquePointer()),
llvm::hash_value(prop.i64attr.getAsOpaquePointer()),
llvm::hash_value(prop.i8attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> DenseArrayStrictlyPositiveAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "emptyattr")
return prop.emptyattr;
if (name == "f32attr")
return prop.f32attr;
if (name == "f64attr")
return prop.f64attr;
if (name == "i16attr")
return prop.i16attr;
if (name == "i32attr")
return prop.i32attr;
if (name == "i64attr")
return prop.i64attr;
if (name == "i8attr")
return prop.i8attr;
return std::nullopt;
}
void DenseArrayStrictlyPositiveAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "emptyattr") {
prop.emptyattr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.emptyattr)>>(value);
return;
}
if (name == "f32attr") {
prop.f32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.f32attr)>>(value);
return;
}
if (name == "f64attr") {
prop.f64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.f64attr)>>(value);
return;
}
if (name == "i16attr") {
prop.i16attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i16attr)>>(value);
return;
}
if (name == "i32attr") {
prop.i32attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i32attr)>>(value);
return;
}
if (name == "i64attr") {
prop.i64attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i64attr)>>(value);
return;
}
if (name == "i8attr") {
prop.i8attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.i8attr)>>(value);
return;
}
}
void DenseArrayStrictlyPositiveAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.emptyattr) attrs.append("emptyattr", prop.emptyattr);
if (prop.f32attr) attrs.append("f32attr", prop.f32attr);
if (prop.f64attr) attrs.append("f64attr", prop.f64attr);
if (prop.i16attr) attrs.append("i16attr", prop.i16attr);
if (prop.i32attr) attrs.append("i32attr", prop.i32attr);
if (prop.i64attr) attrs.append("i64attr", prop.i64attr);
if (prop.i8attr) attrs.append("i8attr", prop.i8attr);
}
::llvm::LogicalResult DenseArrayStrictlyPositiveAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getEmptyattrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps15(attr, "emptyattr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getF32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps18(attr, "f32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getF64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps19(attr, "f64attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI16attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps15(attr, "i16attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI32attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps16(attr, "i32attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI64attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps17(attr, "i64attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getI8attrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps14(attr, "i8attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayStrictlyPositiveAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.emptyattr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.f32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.f64attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i16attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i32attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i64attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.i8attr)))
return ::mlir::failure();
return ::mlir::success();
}
void DenseArrayStrictlyPositiveAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.emptyattr);
writer.writeAttribute(prop.f32attr);
writer.writeAttribute(prop.f64attr);
writer.writeAttribute(prop.i16attr);
writer.writeAttribute(prop.i32attr);
writer.writeAttribute(prop.i64attr);
writer.writeAttribute(prop.i8attr);
}
::llvm::ArrayRef<int8_t> DenseArrayStrictlyPositiveAttrOp::getI8attr() {
auto attr = getI8attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayStrictlyPositiveAttrOp::getI16attr() {
auto attr = getI16attrAttr();
return attr;
}
::llvm::ArrayRef<int32_t> DenseArrayStrictlyPositiveAttrOp::getI32attr() {
auto attr = getI32attrAttr();
return attr;
}
::llvm::ArrayRef<int64_t> DenseArrayStrictlyPositiveAttrOp::getI64attr() {
auto attr = getI64attrAttr();
return attr;
}
::llvm::ArrayRef<float> DenseArrayStrictlyPositiveAttrOp::getF32attr() {
auto attr = getF32attrAttr();
return attr;
}
::llvm::ArrayRef<double> DenseArrayStrictlyPositiveAttrOp::getF64attr() {
auto attr = getF64attrAttr();
return attr;
}
::llvm::ArrayRef<int16_t> DenseArrayStrictlyPositiveAttrOp::getEmptyattr() {
auto attr = getEmptyattrAttr();
return attr;
}
void DenseArrayStrictlyPositiveAttrOp::setI8attr(::llvm::ArrayRef<int8_t> attrValue) {
getProperties().i8attr = ::mlir::Builder((*this)->getContext()).getDenseI8ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::setI16attr(::llvm::ArrayRef<int16_t> attrValue) {
getProperties().i16attr = ::mlir::Builder((*this)->getContext()).getDenseI16ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::setI32attr(::llvm::ArrayRef<int32_t> attrValue) {
getProperties().i32attr = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::setI64attr(::llvm::ArrayRef<int64_t> attrValue) {
getProperties().i64attr = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::setF32attr(::llvm::ArrayRef<float> attrValue) {
getProperties().f32attr = ::mlir::Builder((*this)->getContext()).getDenseF32ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::setF64attr(::llvm::ArrayRef<double> attrValue) {
getProperties().f64attr = ::mlir::Builder((*this)->getContext()).getDenseF64ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::setEmptyattr(::llvm::ArrayRef<int16_t> attrValue) {
getProperties().emptyattr = ::mlir::Builder((*this)->getContext()).getDenseI16ArrayAttr(attrValue);
}
void DenseArrayStrictlyPositiveAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseI8ArrayAttr i8attr, ::mlir::DenseI16ArrayAttr i16attr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr, ::mlir::DenseF32ArrayAttr f32attr, ::mlir::DenseF64ArrayAttr f64attr, ::mlir::DenseI16ArrayAttr emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = i8attr;
odsState.getOrAddProperties<Properties>().i16attr = i16attr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
odsState.getOrAddProperties<Properties>().f32attr = f32attr;
odsState.getOrAddProperties<Properties>().f64attr = f64attr;
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
}
void DenseArrayStrictlyPositiveAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseI8ArrayAttr i8attr, ::mlir::DenseI16ArrayAttr i16attr, ::mlir::DenseI32ArrayAttr i32attr, ::mlir::DenseI64ArrayAttr i64attr, ::mlir::DenseF32ArrayAttr f32attr, ::mlir::DenseF64ArrayAttr f64attr, ::mlir::DenseI16ArrayAttr emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = i8attr;
odsState.getOrAddProperties<Properties>().i16attr = i16attr;
odsState.getOrAddProperties<Properties>().i32attr = i32attr;
odsState.getOrAddProperties<Properties>().i64attr = i64attr;
odsState.getOrAddProperties<Properties>().f32attr = f32attr;
odsState.getOrAddProperties<Properties>().f64attr = f64attr;
odsState.getOrAddProperties<Properties>().emptyattr = emptyattr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DenseArrayStrictlyPositiveAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::ArrayRef<int8_t> i8attr, ::llvm::ArrayRef<int16_t> i16attr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr, ::llvm::ArrayRef<float> f32attr, ::llvm::ArrayRef<double> f64attr, ::llvm::ArrayRef<int16_t> emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = odsBuilder.getDenseI8ArrayAttr(i8attr);
odsState.getOrAddProperties<Properties>().i16attr = odsBuilder.getDenseI16ArrayAttr(i16attr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
odsState.getOrAddProperties<Properties>().f32attr = odsBuilder.getDenseF32ArrayAttr(f32attr);
odsState.getOrAddProperties<Properties>().f64attr = odsBuilder.getDenseF64ArrayAttr(f64attr);
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI16ArrayAttr(emptyattr);
}
void DenseArrayStrictlyPositiveAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::ArrayRef<int8_t> i8attr, ::llvm::ArrayRef<int16_t> i16attr, ::llvm::ArrayRef<int32_t> i32attr, ::llvm::ArrayRef<int64_t> i64attr, ::llvm::ArrayRef<float> f32attr, ::llvm::ArrayRef<double> f64attr, ::llvm::ArrayRef<int16_t> emptyattr) {
odsState.getOrAddProperties<Properties>().i8attr = odsBuilder.getDenseI8ArrayAttr(i8attr);
odsState.getOrAddProperties<Properties>().i16attr = odsBuilder.getDenseI16ArrayAttr(i16attr);
odsState.getOrAddProperties<Properties>().i32attr = odsBuilder.getDenseI32ArrayAttr(i32attr);
odsState.getOrAddProperties<Properties>().i64attr = odsBuilder.getDenseI64ArrayAttr(i64attr);
odsState.getOrAddProperties<Properties>().f32attr = odsBuilder.getDenseF32ArrayAttr(f32attr);
odsState.getOrAddProperties<Properties>().f64attr = odsBuilder.getDenseF64ArrayAttr(f64attr);
odsState.getOrAddProperties<Properties>().emptyattr = odsBuilder.getDenseI16ArrayAttr(emptyattr);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DenseArrayStrictlyPositiveAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<DenseArrayStrictlyPositiveAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult DenseArrayStrictlyPositiveAttrOp::verifyInvariantsImpl() {
auto tblgen_emptyattr = getProperties().emptyattr; (void)tblgen_emptyattr;
if (!tblgen_emptyattr) return emitOpError("requires attribute 'emptyattr'");
auto tblgen_f32attr = getProperties().f32attr; (void)tblgen_f32attr;
if (!tblgen_f32attr) return emitOpError("requires attribute 'f32attr'");
auto tblgen_f64attr = getProperties().f64attr; (void)tblgen_f64attr;
if (!tblgen_f64attr) return emitOpError("requires attribute 'f64attr'");
auto tblgen_i16attr = getProperties().i16attr; (void)tblgen_i16attr;
if (!tblgen_i16attr) return emitOpError("requires attribute 'i16attr'");
auto tblgen_i32attr = getProperties().i32attr; (void)tblgen_i32attr;
if (!tblgen_i32attr) return emitOpError("requires attribute 'i32attr'");
auto tblgen_i64attr = getProperties().i64attr; (void)tblgen_i64attr;
if (!tblgen_i64attr) return emitOpError("requires attribute 'i64attr'");
auto tblgen_i8attr = getProperties().i8attr; (void)tblgen_i8attr;
if (!tblgen_i8attr) return emitOpError("requires attribute 'i8attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps14(*this, tblgen_i8attr, "i8attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps15(*this, tblgen_i16attr, "i16attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps16(*this, tblgen_i32attr, "i32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps17(*this, tblgen_i64attr, "i64attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps18(*this, tblgen_f32attr, "f32attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps19(*this, tblgen_f64attr, "f64attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps15(*this, tblgen_emptyattr, "emptyattr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult DenseArrayStrictlyPositiveAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::DenseArrayStrictlyPositiveAttrOp)
namespace test {
namespace detail {
}
DerivedTypeAttrOpAdaptor::DerivedTypeAttrOpAdaptor(DerivedTypeAttrOp op) : DerivedTypeAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DerivedTypeAttrOpAdaptor::verify(::mlir::Location loc) {
auto namedAttrRange = odsAttrs;
auto namedAttrIt = namedAttrRange.begin();
::mlir::Attribute tblgen_element_dtype;
::mlir::Attribute tblgen_num_elements;
while (true) {
if (namedAttrIt == namedAttrRange.end()) {
break;
}
else if (namedAttrIt->getName() == DerivedTypeAttrOp::getElementDtypeAttrName(*odsOpName)) {
tblgen_element_dtype = namedAttrIt->getValue();
}
else if (namedAttrIt->getName() == DerivedTypeAttrOp::getNumElementsAttrName(*odsOpName)) {
tblgen_num_elements = namedAttrIt->getValue();
}
++namedAttrIt;
}
return ::mlir::success();
}
::mlir::Type DerivedTypeAttrOp::getElementDtype() {
return getElementTypeOrSelf(getOutput().getType());
}
int DerivedTypeAttrOp::getNumElements() {
return ::llvm::cast<ShapedType>(getOutput().getType()).getNumElements();
}
bool DerivedTypeAttrOp::isDerivedAttribute(::llvm::StringRef name) {
if (name == "element_dtype") return true;
if (name == "num_elements") return true;
return false;
}
::mlir::DictionaryAttr DerivedTypeAttrOp::materializeDerivedAttributes() {
::mlir::MLIRContext* ctx = getContext();
::mlir::Builder odsBuilder(ctx); (void)odsBuilder;
return ::mlir::DictionaryAttr::get( ctx, {
{getElementDtypeAttrName(),
::mlir::TypeAttr::get(getElementDtype())},
{getNumElementsAttrName(),
odsBuilder.getI32IntegerAttr(getNumElements())}});
}
void DerivedTypeAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output) {
odsState.addTypes(output);
}
void DerivedTypeAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void DerivedTypeAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult DerivedTypeAttrOp::verifyInvariantsImpl() {
auto namedAttrRange = (*this)->getAttrs();
auto namedAttrIt = namedAttrRange.begin();
::mlir::Attribute tblgen_element_dtype;
::mlir::Attribute tblgen_num_elements;
while (true) {
if (namedAttrIt == namedAttrRange.end()) {
break;
}
else if (namedAttrIt->getName() == getElementDtypeAttrName()) {
tblgen_element_dtype = namedAttrIt->getValue();
}
else if (namedAttrIt->getName() == getNumElementsAttrName()) {
tblgen_num_elements = namedAttrIt->getValue();
}
++namedAttrIt;
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult DerivedTypeAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::DerivedTypeAttrOp)
namespace test {
namespace detail {
std::pair<unsigned, unsigned> ElementwiseMappableOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (odsOperandsSize - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
}
ElementwiseMappableOpAdaptor::ElementwiseMappableOpAdaptor(ElementwiseMappableOp op) : ElementwiseMappableOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ElementwiseMappableOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> ElementwiseMappableOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
std::pair<unsigned, unsigned> ElementwiseMappableOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
void ElementwiseMappableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
odsState.addOperands(operands);
odsState.addAttributes(attributes);
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult ElementwiseMappableOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ElementwiseMappableOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ElementwiseMappableOp)
namespace test {
namespace detail {
FloatAttrOpGenericAdaptorBase::FloatAttrOpGenericAdaptorBase(FloatAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::Attribute FloatAttrOpGenericAdaptorBase::getFloatAttr() {
auto attr = getFloatAttrAttr();
return attr;
}
}
FloatAttrOpAdaptor::FloatAttrOpAdaptor(FloatAttrOp op) : FloatAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FloatAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_float_attr = getProperties().float_attr; (void)tblgen_float_attr;
if (!tblgen_float_attr) return emitError(loc, "'test.float_attrs' op ""requires attribute 'float_attr'");
if (tblgen_float_attr && !((true)))
return emitError(loc, "'test.float_attrs' op ""attribute 'float_attr' failed to satisfy constraint: any attribute");
return ::mlir::success();
}
::llvm::LogicalResult FloatAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.float_attr;
auto attr = dict.get("float_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `float_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute FloatAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.float_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("float_attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FloatAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.float_attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> FloatAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "float_attr")
return prop.float_attr;
return std::nullopt;
}
void FloatAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "float_attr") {
prop.float_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.float_attr)>>(value);
return;
}
}
void FloatAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.float_attr) attrs.append("float_attr", prop.float_attr);
}
::llvm::LogicalResult FloatAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getFloatAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps20(attr, "float_attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FloatAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.float_attr)))
return ::mlir::failure();
return ::mlir::success();
}
void FloatAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.float_attr);
}
::mlir::Attribute FloatAttrOp::getFloatAttr() {
auto attr = getFloatAttrAttr();
return attr;
}
void FloatAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute float_attr) {
odsState.getOrAddProperties<Properties>().float_attr = float_attr;
}
void FloatAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute float_attr) {
odsState.getOrAddProperties<Properties>().float_attr = float_attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void FloatAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<FloatAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult FloatAttrOp::verifyInvariantsImpl() {
auto tblgen_float_attr = getProperties().float_attr; (void)tblgen_float_attr;
if (!tblgen_float_attr) return emitOpError("requires attribute 'float_attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps20(*this, tblgen_float_attr, "float_attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult FloatAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::FloatAttrOp)
namespace test {
namespace detail {
FloatElementsAttrOpGenericAdaptorBase::FloatElementsAttrOpGenericAdaptorBase(FloatElementsAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::DenseFPElementsAttr FloatElementsAttrOpGenericAdaptorBase::getScalarF32Attr() {
auto attr = getScalarF32AttrAttr();
return attr;
}
::mlir::DenseFPElementsAttr FloatElementsAttrOpGenericAdaptorBase::getTensorF64Attr() {
auto attr = getTensorF64AttrAttr();
return attr;
}
}
FloatElementsAttrOpAdaptor::FloatElementsAttrOpAdaptor(FloatElementsAttrOp op) : FloatElementsAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FloatElementsAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_scalar_f32_attr = getProperties().scalar_f32_attr; (void)tblgen_scalar_f32_attr;
if (!tblgen_scalar_f32_attr) return emitError(loc, "'test.float_elements_attr' op ""requires attribute 'scalar_f32_attr'");
auto tblgen_tensor_f64_attr = getProperties().tensor_f64_attr; (void)tblgen_tensor_f64_attr;
if (!tblgen_tensor_f64_attr) return emitError(loc, "'test.float_elements_attr' op ""requires attribute 'tensor_f64_attr'");
if (tblgen_scalar_f32_attr && !((::llvm::isa<::mlir::DenseFPElementsAttr>(tblgen_scalar_f32_attr) &&::llvm::cast<::mlir::DenseFPElementsAttr>(tblgen_scalar_f32_attr).getType().getElementType().isF32() && ::llvm::cast<::mlir::DenseFPElementsAttr>(tblgen_scalar_f32_attr).getType().hasRank() && ::llvm::cast<::mlir::DenseFPElementsAttr>(tblgen_scalar_f32_attr).getType().getShape() == ::mlir::ArrayRef<int64_t>({2}))))
return emitError(loc, "'test.float_elements_attr' op ""attribute 'scalar_f32_attr' failed to satisfy constraint: 32-bit float elements attribute of shape [2]");
if (tblgen_tensor_f64_attr && !((::llvm::isa<::mlir::DenseFPElementsAttr>(tblgen_tensor_f64_attr) &&::llvm::cast<::mlir::DenseFPElementsAttr>(tblgen_tensor_f64_attr).getType().getElementType().isF64() && ::llvm::cast<::mlir::DenseFPElementsAttr>(tblgen_tensor_f64_attr).getType().hasRank() && ::llvm::cast<::mlir::DenseFPElementsAttr>(tblgen_tensor_f64_attr).getType().getShape() == ::mlir::ArrayRef<int64_t>({4, 8}))))
return emitError(loc, "'test.float_elements_attr' op ""attribute 'tensor_f64_attr' failed to satisfy constraint: 64-bit float elements attribute of shape [4, 8]");
return ::mlir::success();
}
::llvm::LogicalResult FloatElementsAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.scalar_f32_attr;
auto attr = dict.get("scalar_f32_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `scalar_f32_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.tensor_f64_attr;
auto attr = dict.get("tensor_f64_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `tensor_f64_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute FloatElementsAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.scalar_f32_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("scalar_f32_attr",
propStorage));
}
{
const auto &propStorage = prop.tensor_f64_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("tensor_f64_attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FloatElementsAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.scalar_f32_attr.getAsOpaquePointer()),
llvm::hash_value(prop.tensor_f64_attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> FloatElementsAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "scalar_f32_attr")
return prop.scalar_f32_attr;
if (name == "tensor_f64_attr")
return prop.tensor_f64_attr;
return std::nullopt;
}
void FloatElementsAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "scalar_f32_attr") {
prop.scalar_f32_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.scalar_f32_attr)>>(value);
return;
}
if (name == "tensor_f64_attr") {
prop.tensor_f64_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.tensor_f64_attr)>>(value);
return;
}
}
void FloatElementsAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.scalar_f32_attr) attrs.append("scalar_f32_attr", prop.scalar_f32_attr);
if (prop.tensor_f64_attr) attrs.append("tensor_f64_attr", prop.tensor_f64_attr);
}
::llvm::LogicalResult FloatElementsAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getScalarF32AttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps21(attr, "scalar_f32_attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getTensorF64AttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps22(attr, "tensor_f64_attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FloatElementsAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.scalar_f32_attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.tensor_f64_attr)))
return ::mlir::failure();
return ::mlir::success();
}
void FloatElementsAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.scalar_f32_attr);
writer.writeAttribute(prop.tensor_f64_attr);
}
::mlir::DenseFPElementsAttr FloatElementsAttrOp::getScalarF32Attr() {
auto attr = getScalarF32AttrAttr();
return attr;
}
::mlir::DenseFPElementsAttr FloatElementsAttrOp::getTensorF64Attr() {
auto attr = getTensorF64AttrAttr();
return attr;
}
void FloatElementsAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseFPElementsAttr scalar_f32_attr, ::mlir::DenseFPElementsAttr tensor_f64_attr) {
odsState.getOrAddProperties<Properties>().scalar_f32_attr = scalar_f32_attr;
odsState.getOrAddProperties<Properties>().tensor_f64_attr = tensor_f64_attr;
}
void FloatElementsAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseFPElementsAttr scalar_f32_attr, ::mlir::DenseFPElementsAttr tensor_f64_attr) {
odsState.getOrAddProperties<Properties>().scalar_f32_attr = scalar_f32_attr;
odsState.getOrAddProperties<Properties>().tensor_f64_attr = tensor_f64_attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void FloatElementsAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<FloatElementsAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult FloatElementsAttrOp::verifyInvariantsImpl() {
auto tblgen_scalar_f32_attr = getProperties().scalar_f32_attr; (void)tblgen_scalar_f32_attr;
if (!tblgen_scalar_f32_attr) return emitOpError("requires attribute 'scalar_f32_attr'");
auto tblgen_tensor_f64_attr = getProperties().tensor_f64_attr; (void)tblgen_tensor_f64_attr;
if (!tblgen_tensor_f64_attr) return emitOpError("requires attribute 'tensor_f64_attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps21(*this, tblgen_scalar_f32_attr, "scalar_f32_attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps22(*this, tblgen_tensor_f64_attr, "tensor_f64_attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult FloatElementsAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::FloatElementsAttrOp)
namespace test {
namespace detail {
FoldToCallOpGenericAdaptorBase::FoldToCallOpGenericAdaptorBase(FoldToCallOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef FoldToCallOpGenericAdaptorBase::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
}
FoldToCallOpAdaptor::FoldToCallOpAdaptor(FoldToCallOp op) : FoldToCallOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FoldToCallOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitError(loc, "'test.fold_to_call_op' op ""requires attribute 'callee'");
if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee))))
return emitError(loc, "'test.fold_to_call_op' op ""attribute 'callee' failed to satisfy constraint: flat symbol reference attribute");
return ::mlir::success();
}
::llvm::LogicalResult FoldToCallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.callee;
auto attr = dict.get("callee");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `callee` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute FoldToCallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.callee;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("callee",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FoldToCallOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.callee.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> FoldToCallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "callee")
return prop.callee;
return std::nullopt;
}
void FoldToCallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "callee") {
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
return;
}
}
void FoldToCallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.callee) attrs.append("callee", prop.callee);
}
::llvm::LogicalResult FoldToCallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps23(attr, "callee", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FoldToCallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.callee)))
return ::mlir::failure();
return ::mlir::success();
}
void FoldToCallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.callee);
}
::llvm::StringRef FoldToCallOp::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
void FoldToCallOp::setCallee(::llvm::StringRef attrValue) {
getProperties().callee = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void FoldToCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FlatSymbolRefAttr callee) {
odsState.getOrAddProperties<Properties>().callee = callee;
}
void FoldToCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr callee) {
odsState.getOrAddProperties<Properties>().callee = callee;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void FoldToCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef callee) {
odsState.getOrAddProperties<Properties>().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee);
}
void FoldToCallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee) {
odsState.getOrAddProperties<Properties>().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void FoldToCallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<FoldToCallOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult FoldToCallOp::verifyInvariantsImpl() {
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps23(*this, tblgen_callee, "callee")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult FoldToCallOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::FoldToCallOp)
namespace test {
namespace detail {
}
ForwardBufferOpAdaptor::ForwardBufferOpAdaptor(ForwardBufferOp op) : ForwardBufferOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ForwardBufferOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ForwardBufferOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value buffer) {
odsState.addOperands(buffer);
odsState.addTypes(result);
}
void ForwardBufferOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value buffer) {
odsState.addOperands(buffer);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ForwardBufferOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult ForwardBufferOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps3(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ForwardBufferOp::verifyInvariants() {
return verifyInvariantsImpl();
}
void ForwardBufferOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ForwardBufferOp)
namespace test {
namespace detail {
}
FourEqualsFiveAdaptor::FourEqualsFiveAdaptor(FourEqualsFive op) : FourEqualsFiveGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FourEqualsFiveAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void FourEqualsFive::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}
void FourEqualsFive::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void FourEqualsFive::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult FourEqualsFive::verifyInvariantsImpl() {
if (!(((5) == (4) && (4) == (5))))
return emitOpError("failed to verify that 4 equals 5");
return ::mlir::success();
}
::llvm::LogicalResult FourEqualsFive::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::FourEqualsFive)
namespace test {
namespace detail {
}
FunctionalRegionOpAdaptor::FunctionalRegionOpAdaptor(FunctionalRegionOp op) : FunctionalRegionOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FunctionalRegionOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void FunctionalRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
(void)odsState.addRegion();
odsState.addTypes(resultType0);
}
void FunctionalRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void FunctionalRegionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult FunctionalRegionOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_2TestOps1(*this, region, "body", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FunctionalRegionOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::FunctionalRegionOp)
namespace test {
namespace detail {
GetTupleElementOpGenericAdaptorBase::GetTupleElementOpGenericAdaptorBase(GetTupleElementOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
uint32_t GetTupleElementOpGenericAdaptorBase::getIndex() {
auto attr = getIndexAttr();
return attr.getValue().getZExtValue();
}
}
GetTupleElementOpAdaptor::GetTupleElementOpAdaptor(GetTupleElementOp op) : GetTupleElementOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult GetTupleElementOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_index = getProperties().index; (void)tblgen_index;
if (!tblgen_index) return emitError(loc, "'test.get_tuple_element' op ""requires attribute 'index'");
if (tblgen_index && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_index))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_index).getType().isSignlessInteger(32)))))
return emitError(loc, "'test.get_tuple_element' op ""attribute 'index' failed to satisfy constraint: 32-bit signless integer attribute");
return ::mlir::success();
}
::llvm::LogicalResult GetTupleElementOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.index;
auto attr = dict.get("index");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `index` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute GetTupleElementOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.index;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("index",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code GetTupleElementOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.index.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> GetTupleElementOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "index")
return prop.index;
return std::nullopt;
}
void GetTupleElementOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "index") {
prop.index = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.index)>>(value);
return;
}
}
void GetTupleElementOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.index) attrs.append("index", prop.index);
}
::llvm::LogicalResult GetTupleElementOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getIndexAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps24(attr, "index", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult GetTupleElementOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.index)))
return ::mlir::failure();
return ::mlir::success();
}
void GetTupleElementOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.index);
}
uint32_t GetTupleElementOp::getIndex() {
auto attr = getIndexAttr();
return attr.getValue().getZExtValue();
}
void GetTupleElementOp::setIndex(uint32_t attrValue) {
getProperties().index = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32), attrValue);
}
void GetTupleElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::IntegerAttr index) {
odsState.addOperands(odsArg_0);
odsState.getOrAddProperties<Properties>().index = index;
odsState.addTypes(resultType0);
}
void GetTupleElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::IntegerAttr index) {
odsState.addOperands(odsArg_0);
odsState.getOrAddProperties<Properties>().index = index;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void GetTupleElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0, uint32_t index) {
odsState.addOperands(odsArg_0);
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
odsState.addTypes(resultType0);
}
void GetTupleElementOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, uint32_t index) {
odsState.addOperands(odsArg_0);
odsState.getOrAddProperties<Properties>().index = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32), index);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void GetTupleElementOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<GetTupleElementOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult GetTupleElementOp::verifyInvariantsImpl() {
auto tblgen_index = getProperties().index; (void)tblgen_index;
if (!tblgen_index) return emitOpError("requires attribute 'index'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps24(*this, tblgen_index, "index")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps5(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult GetTupleElementOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::GetTupleElementOp)
namespace test {
namespace detail {
}
GraphRegionOpAdaptor::GraphRegionOpAdaptor(GraphRegionOp op) : GraphRegionOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult GraphRegionOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void GraphRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
(void)odsState.addRegion();
}
void GraphRegionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void GraphRegionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult GraphRegionOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_2TestOps1(*this, region, "region", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult GraphRegionOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult GraphRegionOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
std::unique_ptr<::mlir::Region> regionRegion = std::make_unique<::mlir::Region>();
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
return ::mlir::failure();
}
if (parser.parseRegion(*regionRegion))
return ::mlir::failure();
result.addRegion(std::move(regionRegion));
return ::mlir::success();
}
void GraphRegionOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ';
_odsPrinter.printRegion(getRegion());
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::GraphRegionOp)
namespace test {
namespace detail {
I32ElementsAttrOpGenericAdaptorBase::I32ElementsAttrOpGenericAdaptorBase(I32ElementsAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::DenseIntElementsAttr I32ElementsAttrOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return attr;
}
}
I32ElementsAttrOpAdaptor::I32ElementsAttrOpAdaptor(I32ElementsAttrOp op) : I32ElementsAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult I32ElementsAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.i32ElementsAttr' op ""requires attribute 'attr'");
if (tblgen_attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_attr).getType().getElementType().isSignlessInteger(32)))))
return emitError(loc, "'test.i32ElementsAttr' op ""attribute 'attr' failed to satisfy constraint: 32-bit signless integer elements attribute");
return ::mlir::success();
}
::llvm::LogicalResult I32ElementsAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute I32ElementsAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code I32ElementsAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> I32ElementsAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void I32ElementsAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void I32ElementsAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult I32ElementsAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps25(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult I32ElementsAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void I32ElementsAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::mlir::DenseIntElementsAttr I32ElementsAttrOp::getAttr() {
auto attr = getAttrAttr();
return attr;
}
void I32ElementsAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseIntElementsAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
}
void I32ElementsAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void I32ElementsAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<I32ElementsAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult I32ElementsAttrOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps25(*this, tblgen_attr, "attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult I32ElementsAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::I32ElementsAttrOp)
namespace test {
namespace detail {
I32EnumAttrOpGenericAdaptorBase::I32EnumAttrOpGenericAdaptorBase(I32EnumAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::SomeI32Enum I32EnumAttrOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return attr.getValue();
}
}
I32EnumAttrOpAdaptor::I32EnumAttrOpAdaptor(I32EnumAttrOp op) : I32EnumAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult I32EnumAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.i32_enum_attr' op ""requires attribute 'attr'");
if (tblgen_attr && !((::llvm::isa<::SomeI32EnumAttr>(tblgen_attr))))
return emitError(loc, "'test.i32_enum_attr' op ""attribute 'attr' failed to satisfy constraint: allowed 32-bit signless integer cases: 5, 10");
return ::mlir::success();
}
::llvm::LogicalResult I32EnumAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute I32EnumAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code I32EnumAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> I32EnumAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void I32EnumAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void I32EnumAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult I32EnumAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps26(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult I32EnumAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void I32EnumAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::SomeI32Enum I32EnumAttrOp::getAttr() {
auto attr = getAttrAttr();
return attr.getValue();
}
void I32EnumAttrOp::setAttr(::SomeI32Enum attrValue) {
getProperties().attr = ::SomeI32EnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::SomeI32EnumAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
odsState.addTypes(val);
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::SomeI32EnumAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(I32EnumAttrOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::SomeI32EnumAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::SomeI32Enum attr) {
odsState.getOrAddProperties<Properties>().attr = ::SomeI32EnumAttr::get(odsBuilder.getContext(), attr);
odsState.addTypes(val);
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::SomeI32Enum attr) {
odsState.getOrAddProperties<Properties>().attr = ::SomeI32EnumAttr::get(odsBuilder.getContext(), attr);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(I32EnumAttrOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::SomeI32Enum attr) {
odsState.getOrAddProperties<Properties>().attr = ::SomeI32EnumAttr::get(odsBuilder.getContext(), attr);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void I32EnumAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<I32EnumAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
void I32EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<I32EnumAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(I32EnumAttrOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult I32EnumAttrOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps26(*this, tblgen_attr, "attr")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult I32EnumAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult I32EnumAttrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::I32EnumAttrOp)
namespace test {
namespace detail {
I64EnumAttrOpGenericAdaptorBase::I64EnumAttrOpGenericAdaptorBase(I64EnumAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::SomeI64Enum I64EnumAttrOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return attr.getValue();
}
}
I64EnumAttrOpAdaptor::I64EnumAttrOpAdaptor(I64EnumAttrOp op) : I64EnumAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult I64EnumAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.i64_enum_attr' op ""requires attribute 'attr'");
if (tblgen_attr && !((::llvm::isa<::SomeI64EnumAttr>(tblgen_attr))))
return emitError(loc, "'test.i64_enum_attr' op ""attribute 'attr' failed to satisfy constraint: allowed 64-bit signless integer cases: 5, 10");
return ::mlir::success();
}
::llvm::LogicalResult I64EnumAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute I64EnumAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code I64EnumAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> I64EnumAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void I64EnumAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void I64EnumAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult I64EnumAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps27(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult I64EnumAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void I64EnumAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::SomeI64Enum I64EnumAttrOp::getAttr() {
auto attr = getAttrAttr();
return attr.getValue();
}
void I64EnumAttrOp::setAttr(::SomeI64Enum attrValue) {
getProperties().attr = ::SomeI64EnumAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::SomeI64EnumAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
odsState.addTypes(val);
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::SomeI64EnumAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(I64EnumAttrOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::SomeI64EnumAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::SomeI64Enum attr) {
odsState.getOrAddProperties<Properties>().attr = ::SomeI64EnumAttr::get(odsBuilder.getContext(), attr);
odsState.addTypes(val);
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::SomeI64Enum attr) {
odsState.getOrAddProperties<Properties>().attr = ::SomeI64EnumAttr::get(odsBuilder.getContext(), attr);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(I64EnumAttrOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::SomeI64Enum attr) {
odsState.getOrAddProperties<Properties>().attr = ::SomeI64EnumAttr::get(odsBuilder.getContext(), attr);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void I64EnumAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<I64EnumAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
void I64EnumAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<I64EnumAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(I64EnumAttrOp::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult I64EnumAttrOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_2TestOps27(*this, tblgen_attr, "attr")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult I64EnumAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult I64EnumAttrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::I64EnumAttrOp)
namespace test {
namespace detail {
}
ILLegalOpAAdaptor::ILLegalOpAAdaptor(ILLegalOpA op) : ILLegalOpAGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpAAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpA::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpA::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpA::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpA::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpA::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpA::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpA::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpA::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_2TestOps7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpA::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpA::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpA)
#endif
#ifdef GET_OP_DEFS_3
#undef GET_OP_DEFS_3
void ::test::registerTestDialectOperations3(::test::TestDialect *dialect) {
::mlir::RegisteredOperationName::insert<::test::ILLegalOpB>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ILLegalOpC>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ILLegalOpD>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ILLegalOpE>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ILLegalOpF>(*dialect);
::mlir::RegisteredOperationName::insert<::test::ILLegalOpG>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IfFirstOperandIsNoneThenSoIsSecond>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IllegalOpTerminator>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IllegalOpWithRegion>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IllegalOpWithRegionAnchor>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IndexElementsAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IntAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IntElementsAttrOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IntTypesOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IsolatedGraphRegionOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IsolatedOneRegionOp>(*dialect);
::mlir::RegisteredOperationName::insert<::test::IsolatedRegionOp>(*dialect);
}
namespace test {
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps1(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps2(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps3(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isInteger(16)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 16-bit integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps4(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignedInteger(32)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 32-bit signed integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps5(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isUnsignedInteger(64)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 64-bit unsigned integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps6(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::IntegerType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps7(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((true))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of any type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_3TestOps8(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::IndexType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be index, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps1(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr)
.getType()
.getElementType()
.isIndex()))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: index elements attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps1(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps1(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps2(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit integer attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps2(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps2(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps3(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType())))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: index attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps3(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps3(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps4(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isUnsignedInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit unsigned integer attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps4(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps4(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps5(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::cast<::mlir::IntegerAttr>(attr).getType().isSignedInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit signed integer attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps5(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps5(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps6(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit integer elements attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps6(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps6(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps7(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(attr).getType().getElementType().isSignlessInteger(32)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: 32-bit signless integer elements attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_3TestOps7(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_3TestOps7(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_3TestOps1(
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((true))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: any region";
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_3TestOps2(
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((::llvm::hasNItems(region, 1)))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: region with 1 blocks";
}
return ::mlir::success();
}
}
namespace test {
namespace detail {
}
ILLegalOpBAdaptor::ILLegalOpBAdaptor(ILLegalOpB op) : ILLegalOpBGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpBAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpB::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpB::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpB::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpB::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpB::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpB::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpB::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpB::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpB::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpB::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpB)
namespace test {
namespace detail {
}
ILLegalOpCAdaptor::ILLegalOpCAdaptor(ILLegalOpC op) : ILLegalOpCGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpCAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpC::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpC::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpC::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpC::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpC::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpC::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpC::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpC::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpC::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpC::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpC)
namespace test {
namespace detail {
}
ILLegalOpDAdaptor::ILLegalOpDAdaptor(ILLegalOpD op) : ILLegalOpDGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpDAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpD::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpD::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpD::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpD::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpD::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpD::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpD::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpD::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpD::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpD::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpD)
namespace test {
namespace detail {
}
ILLegalOpEAdaptor::ILLegalOpEAdaptor(ILLegalOpE op) : ILLegalOpEGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpEAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpE::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpE::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpE::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpE::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpE::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpE::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpE::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpE::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpE::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpE::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpE)
namespace test {
namespace detail {
}
ILLegalOpFAdaptor::ILLegalOpFAdaptor(ILLegalOpF op) : ILLegalOpFGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpFAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpF::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpF::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpF::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpF::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpF::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpF::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpF::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpF::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpF::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpF::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpF)
namespace test {
namespace detail {
}
ILLegalOpGAdaptor::ILLegalOpGAdaptor(ILLegalOpG op) : ILLegalOpGGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ILLegalOpGAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void ILLegalOpG::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0) {
odsState.addTypes(resultType0);
}
void ILLegalOpG::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpG::inferReturnTypes(odsBuilder.getContext(),
odsState.location, odsState.operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes)))
odsState.addTypes(inferredReturnTypes);
else
::llvm::report_fatal_error("Failed to infer result type(s).");
}
void ILLegalOpG::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void ILLegalOpG::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
void ILLegalOpG::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
if (::mlir::succeeded(ILLegalOpG::inferReturnTypes(odsBuilder.getContext(),
odsState.location, operands,
odsState.attributes.getDictionary(odsState.getContext()),
odsState.getRawProperties(),
odsState.regions, inferredReturnTypes))) {
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(inferredReturnTypes);
} else {
::llvm::report_fatal_error("Failed to infer result type(s).");
}
}
::llvm::LogicalResult ILLegalOpG::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ILLegalOpG::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ILLegalOpG::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
inferredReturnTypes.resize(1);
::mlir::Builder odsBuilder(context);
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(32);
inferredReturnTypes[0] = odsInferredType0;
return ::mlir::success();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::ILLegalOpG)
namespace test {
namespace detail {
}
IfFirstOperandIsNoneThenSoIsSecondAdaptor::IfFirstOperandIsNoneThenSoIsSecondAdaptor(IfFirstOperandIsNoneThenSoIsSecond op) : IfFirstOperandIsNoneThenSoIsSecondGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IfFirstOperandIsNoneThenSoIsSecondAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void IfFirstOperandIsNoneThenSoIsSecond::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::Value y) {
odsState.addOperands(x);
odsState.addOperands(y);
}
void IfFirstOperandIsNoneThenSoIsSecond::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y) {
odsState.addOperands(x);
odsState.addOperands(y);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void IfFirstOperandIsNoneThenSoIsSecond::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult IfFirstOperandIsNoneThenSoIsSecond::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_3TestOps2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
if (!((((::llvm::isa<::mlir::NoneType>((*this->getODSOperands(0).begin()).getType()))) && ((::llvm::isa<::mlir::NoneType>((*this->getODSOperands(1).begin()).getType())))) || (!((::llvm::isa<::mlir::NoneType>((*this->getODSOperands(0).begin()).getType()))))))
return emitOpError("failed to verify that has either both none type operands or first is not none");
return ::mlir::success();
}
::llvm::LogicalResult IfFirstOperandIsNoneThenSoIsSecond::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IfFirstOperandIsNoneThenSoIsSecond)
namespace test {
namespace detail {
}
IllegalOpTerminatorAdaptor::IllegalOpTerminatorAdaptor(IllegalOpTerminator op) : IllegalOpTerminatorGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IllegalOpTerminatorAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void IllegalOpTerminator::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}
void IllegalOpTerminator::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void IllegalOpTerminator::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult IllegalOpTerminator::verifyInvariantsImpl() {
return ::mlir::success();
}
::llvm::LogicalResult IllegalOpTerminator::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IllegalOpTerminator)
namespace test {
namespace detail {
}
IllegalOpWithRegionAdaptor::IllegalOpWithRegionAdaptor(IllegalOpWithRegion op) : IllegalOpWithRegionGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IllegalOpWithRegionAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void IllegalOpWithRegion::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
Region *bodyRegion = odsState.addRegion();
OpBuilder::InsertionGuard g(odsBuilder);
Block *body = odsBuilder.createBlock(bodyRegion);
odsBuilder.setInsertionPointToEnd(body);
odsBuilder.create<IllegalOpTerminator>(odsState.location);
}
::llvm::LogicalResult IllegalOpWithRegion::verifyInvariantsImpl() {
return ::mlir::success();
}
::llvm::LogicalResult IllegalOpWithRegion::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IllegalOpWithRegion)
namespace test {
namespace detail {
}
IllegalOpWithRegionAnchorAdaptor::IllegalOpWithRegionAnchorAdaptor(IllegalOpWithRegionAnchor op) : IllegalOpWithRegionAnchorGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IllegalOpWithRegionAnchorAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
void IllegalOpWithRegionAnchor::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
}
void IllegalOpWithRegionAnchor::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void IllegalOpWithRegionAnchor::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
::llvm::LogicalResult IllegalOpWithRegionAnchor::verifyInvariantsImpl() {
return ::mlir::success();
}
::llvm::LogicalResult IllegalOpWithRegionAnchor::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IllegalOpWithRegionAnchor)
namespace test {
namespace detail {
IndexElementsAttrOpGenericAdaptorBase::IndexElementsAttrOpGenericAdaptorBase(IndexElementsAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::DenseIntElementsAttr IndexElementsAttrOpGenericAdaptorBase::getAttr() {
auto attr = getAttrAttr();
return attr;
}
}
IndexElementsAttrOpAdaptor::IndexElementsAttrOpAdaptor(IndexElementsAttrOp op) : IndexElementsAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IndexElementsAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitError(loc, "'test.indexElementsAttr' op ""requires attribute 'attr'");
if (tblgen_attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_attr)
.getType()
.getElementType()
.isIndex()))))
return emitError(loc, "'test.indexElementsAttr' op ""attribute 'attr' failed to satisfy constraint: index elements attribute");
return ::mlir::success();
}
::llvm::LogicalResult IndexElementsAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.attr;
auto attr = dict.get("attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute IndexElementsAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code IndexElementsAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> IndexElementsAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "attr")
return prop.attr;
return std::nullopt;
}
void IndexElementsAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "attr") {
prop.attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.attr)>>(value);
return;
}
}
void IndexElementsAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.attr) attrs.append("attr", prop.attr);
}
::llvm::LogicalResult IndexElementsAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps1(attr, "attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult IndexElementsAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.attr)))
return ::mlir::failure();
return ::mlir::success();
}
void IndexElementsAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.attr);
}
::mlir::DenseIntElementsAttr IndexElementsAttrOp::getAttr() {
auto attr = getAttrAttr();
return attr;
}
void IndexElementsAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::DenseIntElementsAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
}
void IndexElementsAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::DenseIntElementsAttr attr) {
odsState.getOrAddProperties<Properties>().attr = attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void IndexElementsAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<IndexElementsAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult IndexElementsAttrOp::verifyInvariantsImpl() {
auto tblgen_attr = getProperties().attr; (void)tblgen_attr;
if (!tblgen_attr) return emitOpError("requires attribute 'attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps1(*this, tblgen_attr, "attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult IndexElementsAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IndexElementsAttrOp)
namespace test {
namespace detail {
IntAttrOpGenericAdaptorBase::IntAttrOpGenericAdaptorBase(IntAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::APInt IntAttrOpGenericAdaptorBase::getAnyI32Attr() {
auto attr = getAnyI32AttrAttr();
return attr.getValue();
}
::llvm::APInt IntAttrOpGenericAdaptorBase::getIndexAttr() {
auto attr = getIndexAttrAttr();
return attr.getValue();
}
uint32_t IntAttrOpGenericAdaptorBase::getUi32Attr() {
auto attr = getUi32AttrAttr();
return attr.getValue().getZExtValue();
}
int32_t IntAttrOpGenericAdaptorBase::getSi32Attr() {
auto attr = getSi32AttrAttr();
return attr.getValue().getSExtValue();
}
}
IntAttrOpAdaptor::IntAttrOpAdaptor(IntAttrOp op) : IntAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IntAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_any_i32_attr = getProperties().any_i32_attr; (void)tblgen_any_i32_attr;
if (!tblgen_any_i32_attr) return emitError(loc, "'test.int_attrs' op ""requires attribute 'any_i32_attr'");
auto tblgen_index_attr = getProperties().index_attr; (void)tblgen_index_attr;
if (!tblgen_index_attr) return emitError(loc, "'test.int_attrs' op ""requires attribute 'index_attr'");
auto tblgen_si32_attr = getProperties().si32_attr; (void)tblgen_si32_attr;
if (!tblgen_si32_attr) return emitError(loc, "'test.int_attrs' op ""requires attribute 'si32_attr'");
auto tblgen_ui32_attr = getProperties().ui32_attr; (void)tblgen_ui32_attr;
if (!tblgen_ui32_attr) return emitError(loc, "'test.int_attrs' op ""requires attribute 'ui32_attr'");
if (tblgen_any_i32_attr && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_any_i32_attr))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_any_i32_attr).getType().isInteger(32)))))
return emitError(loc, "'test.int_attrs' op ""attribute 'any_i32_attr' failed to satisfy constraint: 32-bit integer attribute");
if (tblgen_index_attr && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_index_attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_index_attr).getType())))))
return emitError(loc, "'test.int_attrs' op ""attribute 'index_attr' failed to satisfy constraint: index attribute");
if (tblgen_ui32_attr && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_ui32_attr))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_ui32_attr).getType().isUnsignedInteger(32)))))
return emitError(loc, "'test.int_attrs' op ""attribute 'ui32_attr' failed to satisfy constraint: 32-bit unsigned integer attribute");
if (tblgen_si32_attr && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_si32_attr))) && ((::llvm::cast<::mlir::IntegerAttr>(tblgen_si32_attr).getType().isSignedInteger(32)))))
return emitError(loc, "'test.int_attrs' op ""attribute 'si32_attr' failed to satisfy constraint: 32-bit signed integer attribute");
return ::mlir::success();
}
::llvm::LogicalResult IntAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.any_i32_attr;
auto attr = dict.get("any_i32_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `any_i32_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.index_attr;
auto attr = dict.get("index_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `index_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.si32_attr;
auto attr = dict.get("si32_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `si32_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.ui32_attr;
auto attr = dict.get("ui32_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `ui32_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute IntAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.any_i32_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("any_i32_attr",
propStorage));
}
{
const auto &propStorage = prop.index_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("index_attr",
propStorage));
}
{
const auto &propStorage = prop.si32_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("si32_attr",
propStorage));
}
{
const auto &propStorage = prop.ui32_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("ui32_attr",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code IntAttrOp::computePropertiesHash(const Properties &prop) {
return llvm::hash_combine(
llvm::hash_value(prop.any_i32_attr.getAsOpaquePointer()),
llvm::hash_value(prop.index_attr.getAsOpaquePointer()),
llvm::hash_value(prop.si32_attr.getAsOpaquePointer()),
llvm::hash_value(prop.ui32_attr.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> IntAttrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "any_i32_attr")
return prop.any_i32_attr;
if (name == "index_attr")
return prop.index_attr;
if (name == "si32_attr")
return prop.si32_attr;
if (name == "ui32_attr")
return prop.ui32_attr;
return std::nullopt;
}
void IntAttrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "any_i32_attr") {
prop.any_i32_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.any_i32_attr)>>(value);
return;
}
if (name == "index_attr") {
prop.index_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.index_attr)>>(value);
return;
}
if (name == "si32_attr") {
prop.si32_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.si32_attr)>>(value);
return;
}
if (name == "ui32_attr") {
prop.ui32_attr = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ui32_attr)>>(value);
return;
}
}
void IntAttrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.any_i32_attr) attrs.append("any_i32_attr", prop.any_i32_attr);
if (prop.index_attr) attrs.append("index_attr", prop.index_attr);
if (prop.si32_attr) attrs.append("si32_attr", prop.si32_attr);
if (prop.ui32_attr) attrs.append("ui32_attr", prop.ui32_attr);
}
::llvm::LogicalResult IntAttrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getAnyI32AttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps2(attr, "any_i32_attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getIndexAttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps3(attr, "index_attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSi32AttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps5(attr, "si32_attr", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getUi32AttrAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps4(attr, "ui32_attr", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult IntAttrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.any_i32_attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.index_attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.si32_attr)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.ui32_attr)))
return ::mlir::failure();
return ::mlir::success();
}
void IntAttrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.any_i32_attr);
writer.writeAttribute(prop.index_attr);
writer.writeAttribute(prop.si32_attr);
writer.writeAttribute(prop.ui32_attr);
}
::llvm::APInt IntAttrOp::getAnyI32Attr() {
auto attr = getAnyI32AttrAttr();
return attr.getValue();
}
::llvm::APInt IntAttrOp::getIndexAttr() {
auto attr = getIndexAttrAttr();
return attr.getValue();
}
uint32_t IntAttrOp::getUi32Attr() {
auto attr = getUi32AttrAttr();
return attr.getValue().getZExtValue();
}
int32_t IntAttrOp::getSi32Attr() {
auto attr = getSi32AttrAttr();
return attr.getValue().getSExtValue();
}
void IntAttrOp::setIndexAttr(::llvm::APInt attrValue) {
getProperties().index_attr = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue);
}
void IntAttrOp::setUi32Attr(uint32_t attrValue) {
getProperties().ui32_attr = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32, false), attrValue);
}
void IntAttrOp::setSi32Attr(int32_t attrValue) {
getProperties().si32_attr = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIntegerType(32, true), attrValue);
}
void IntAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr any_i32_attr, ::mlir::IntegerAttr index_attr, ::mlir::IntegerAttr ui32_attr, ::mlir::IntegerAttr si32_attr) {
odsState.getOrAddProperties<Properties>().any_i32_attr = any_i32_attr;
odsState.getOrAddProperties<Properties>().index_attr = index_attr;
odsState.getOrAddProperties<Properties>().ui32_attr = ui32_attr;
odsState.getOrAddProperties<Properties>().si32_attr = si32_attr;
}
void IntAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr any_i32_attr, ::mlir::IntegerAttr index_attr, ::mlir::IntegerAttr ui32_attr, ::mlir::IntegerAttr si32_attr) {
odsState.getOrAddProperties<Properties>().any_i32_attr = any_i32_attr;
odsState.getOrAddProperties<Properties>().index_attr = index_attr;
odsState.getOrAddProperties<Properties>().ui32_attr = ui32_attr;
odsState.getOrAddProperties<Properties>().si32_attr = si32_attr;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void IntAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr any_i32_attr, ::llvm::APInt index_attr, uint32_t ui32_attr, int32_t si32_attr) {
odsState.getOrAddProperties<Properties>().any_i32_attr = any_i32_attr;
odsState.getOrAddProperties<Properties>().index_attr = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), index_attr);
odsState.getOrAddProperties<Properties>().ui32_attr = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32, false), ui32_attr);
odsState.getOrAddProperties<Properties>().si32_attr = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32, true), si32_attr);
}
void IntAttrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr any_i32_attr, ::llvm::APInt index_attr, uint32_t ui32_attr, int32_t si32_attr) {
odsState.getOrAddProperties<Properties>().any_i32_attr = any_i32_attr;
odsState.getOrAddProperties<Properties>().index_attr = odsBuilder.getIntegerAttr(odsBuilder.getIndexType(), index_attr);
odsState.getOrAddProperties<Properties>().ui32_attr = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32, false), ui32_attr);
odsState.getOrAddProperties<Properties>().si32_attr = odsBuilder.getIntegerAttr(odsBuilder.getIntegerType(32, true), si32_attr);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
void IntAttrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
::mlir::OpaqueProperties properties =
&odsState.getOrAddProperties<IntAttrOp::Properties>();
std::optional<::mlir::RegisteredOperationName> info =
odsState.name.getRegisteredInfo();
if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
::llvm::report_fatal_error("Property conversion failed.");
}
}
::llvm::LogicalResult IntAttrOp::verifyInvariantsImpl() {
auto tblgen_any_i32_attr = getProperties().any_i32_attr; (void)tblgen_any_i32_attr;
if (!tblgen_any_i32_attr) return emitOpError("requires attribute 'any_i32_attr'");
auto tblgen_index_attr = getProperties().index_attr; (void)tblgen_index_attr;
if (!tblgen_index_attr) return emitOpError("requires attribute 'index_attr'");
auto tblgen_si32_attr = getProperties().si32_attr; (void)tblgen_si32_attr;
if (!tblgen_si32_attr) return emitOpError("requires attribute 'si32_attr'");
auto tblgen_ui32_attr = getProperties().ui32_attr; (void)tblgen_ui32_attr;
if (!tblgen_ui32_attr) return emitOpError("requires attribute 'ui32_attr'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps2(*this, tblgen_any_i32_attr, "any_i32_attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps3(*this, tblgen_index_attr, "index_attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps4(*this, tblgen_ui32_attr, "ui32_attr")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_3TestOps5(*this, tblgen_si32_attr, "si32_attr")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult IntAttrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(::test::IntAttrOp)
namespace test {
namespace detail {
IntElementsAttrOpGenericAdaptorBase::IntElementsAttrOpGenericAdaptorBase(IntElementsAttrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::DenseIntElementsAttr IntElementsAttrOpGenericAdaptorBase::getAnyI32Attr() {
auto attr = getAnyI32AttrAttr();
return attr;
}
::mlir::DenseIntElementsAttr IntElementsAttrOpGenericAdaptorBase::getI32Attr() {
auto attr = getI32AttrAttr();
return attr;
}
}
IntElementsAttrOpAdaptor::IntElementsAttrOpAdaptor(IntElementsAttrOp op) : IntElementsAttrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IntElementsAttrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_any_i32_attr = getProperties().any_i32_attr; (void)tblgen_any_i32_attr;
if (!tblgen_any_i32_attr) return emitError(loc, "'test.int_elements_attr' op ""requires attribute 'any_i32_attr'");
auto tblgen_i32_attr = getProperties().i32_attr; (void)tblgen_i32_attr;
if (!tblgen_i32_attr) return emitError(loc, "'test.int_elements_attr' op ""requires attribute 'i32_attr'");
if (tblgen_any_i32_attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_any_i32_attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_any_i32_attr).getType().getElementType().isInteger(32)))))
return emitError(loc, "'test.int_elements_attr' op ""attribute 'any_i32_attr' failed to satisfy constraint: 32-bit integer elements attribute");
if (tblgen_i32_attr && !(((::llvm::isa<::mlir::DenseIntElementsAttr>(tblgen_i32_attr))) && ((::llvm::cast<::mlir::DenseIntElementsAttr>(tblgen_i32_attr).getType().getElementType().isSignlessInteger(32)))))
return emitError(loc, "'test.int_elements_attr' op ""attribute 'i32_attr' failed to satisfy constraint: 32-bit signless integer elements attribute");
return ::mlir::success();
}
::llvm::LogicalResult IntElementsAttrOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
if (!dict) {
emitError() << "expected DictionaryAttr to set properties";
return ::mlir::failure();
}
{
auto &propStorage = prop.any_i32_attr;
auto attr = dict.get("any_i32_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `any_i32_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.i32_attr;
auto attr = dict.get("i32_attr");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `i32_attr` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute IntElementsAttrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.any_i32_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("any_i32_attr",
propStorage));
}
{
const auto &propStorage = prop.i32_attr;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("i32_attr",
propStorage));
}#endif #ifdef GET_OP_DEFS_4#undef GET_OP_DEFS_4#endif #ifdef GET_OP_DEFS_5#undef GET_OP_DEFS_5#endif #ifdef GET_OP_DEFS_6#undef GET_OP_DEFS_6#endif #ifdef GET_OP_DEFS_7#undef GET_OP_DEFS_7#endif #ifdef GET_OP_DEFS_8#undef GET_OP_DEFS_8#endif #ifdef GET_OP_DEFS_9#undef GET_OP_DEFS_9#endif #ifdef GET_OP_DEFS_10#undef GET_OP_DEFS_10#endif #ifdef GET_OP_DEFS_11#undef GET_OP_DEFS_11#endif #ifdef GET_OP_DEFS_12#undef GET_OP_DEFS_12#endif #ifdef GET_OP_DEFS_13#undef GET_OP_DEFS_13#endif #ifdef GET_OP_DEFS_14#undef GET_OP_DEFS_14#endif #ifdef GET_OP_DEFS_15#undef GET_OP_DEFS_15#endif #ifdef GET_OP_DEFS_16#undef GET_OP_DEFS_16#endif #ifdef GET_OP_DEFS_17#undef GET_OP_DEFS_17#endif #ifdef GET_OP_DEFS_18#undef GET_OP_DEFS_18#endif #ifdef GET_OP_DEFS_19#undef GET_OP_DEFS_19#endif