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

15370 lines
709 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Op Definitions *|
|* *|
|* Automatically generated file, do not edit! *|
|* From: EmitC.td *|
|* *|
\*===----------------------------------------------------------------------===*/
#ifdef GET_OP_LIST
#undef GET_OP_LIST
::mlir::emitc::AddOp,
::mlir::emitc::AddressOfOp,
::mlir::emitc::AssignOp,
::mlir::emitc::BitwiseAndOp,
::mlir::emitc::BitwiseLeftShiftOp,
::mlir::emitc::BitwiseNotOp,
::mlir::emitc::BitwiseOrOp,
::mlir::emitc::BitwiseRightShiftOp,
::mlir::emitc::BitwiseXorOp,
::mlir::emitc::CallOp,
::mlir::emitc::CallOpaqueOp,
::mlir::emitc::CastOp,
::mlir::emitc::ClassOp,
::mlir::emitc::CmpOp,
::mlir::emitc::ConditionalOp,
::mlir::emitc::ConstantOp,
::mlir::emitc::DeclareFuncOp,
::mlir::emitc::DereferenceOp,
::mlir::emitc::DivOp,
::mlir::emitc::DoOp,
::mlir::emitc::ExpressionOp,
::mlir::emitc::FieldOp,
::mlir::emitc::FileOp,
::mlir::emitc::ForOp,
::mlir::emitc::FuncOp,
::mlir::emitc::GetFieldOp,
::mlir::emitc::GetGlobalOp,
::mlir::emitc::GlobalOp,
::mlir::emitc::IfOp,
::mlir::emitc::IncludeOp,
::mlir::emitc::LiteralOp,
::mlir::emitc::LoadOp,
::mlir::emitc::LogicalAndOp,
::mlir::emitc::LogicalNotOp,
::mlir::emitc::LogicalOrOp,
::mlir::emitc::MemberCallOpaqueOp,
::mlir::emitc::MemberOfPtrOp,
::mlir::emitc::MemberOp,
::mlir::emitc::MulOp,
::mlir::emitc::RemOp,
::mlir::emitc::ReturnOp,
::mlir::emitc::SubOp,
::mlir::emitc::SubscriptOp,
::mlir::emitc::SwitchOp,
::mlir::emitc::UnaryMinusOp,
::mlir::emitc::UnaryPlusOp,
::mlir::emitc::VariableOp,
::mlir::emitc::VerbatimOp,
::mlir::emitc::YieldOp
#endif // GET_OP_LIST
#ifdef GET_OP_CLASSES
#undef GET_OP_CLASSES
//===----------------------------------------------------------------------===//
// Local Utility Method Definitions
//===----------------------------------------------------------------------===//
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC1(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((emitc::isSupportedEmitCType(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be type supported by EmitC, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC2(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::emitc::LValueType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be EmitC lvalue type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC3(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((::llvm::isa<::mlir::emitc::PointerType>(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be EmitC pointer type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC4(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((emitc::isSupportedEmitCType(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of type supported by EmitC, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC5(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((emitc::isSupportedEmitCType(type))) || ((::llvm::isa<::mlir::emitc::LValueType>(type))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be variadic of type supported by EmitC or EmitC lvalue type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC6(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((type.isSignlessInteger(1)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be 1-bit signless integer, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC7(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((emitc::isSupportedFloatType(type))) || ((emitc::isIntegerIndexOrOpaqueType(type))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be floating-point type supported by EmitC or integer, index or opaque type supported by EmitC, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC8(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((emitc::isSupportedEmitCType(type))) || ((::llvm::isa<::mlir::emitc::LValueType>(type))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be type supported by EmitC or EmitC lvalue type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC9(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!((emitc::isIntegerIndexOrOpaqueType(type)))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be integer, index or opaque type supported by EmitC, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC10(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::emitc::ArrayType>(type))) || ((::llvm::isa<::mlir::emitc::LValueType>(type))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be EmitC array type or EmitC lvalue type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC11(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(!((::llvm::isa<::mlir::TokenType>(type))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be any non-token type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC12(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::emitc::LValueType>(type))) && (((::llvm::isa<::mlir::emitc::OpaqueType>(::llvm::cast<::mlir::emitc::LValueType>(type).getValueType()))) || ((::llvm::isa<::mlir::emitc::PointerType>(::llvm::cast<::mlir::emitc::LValueType>(type).getValueType())))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be emitc.lvalue of EmitC opaque type or EmitC pointer type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC13(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::emitc::OpaqueType>(type))) || (((::llvm::isa<::mlir::emitc::LValueType>(type))) && ((::llvm::isa<::mlir::emitc::OpaqueType>(::llvm::cast<::mlir::emitc::LValueType>(type).getValueType())))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be EmitC opaque type or emitc.lvalue of EmitC opaque type values, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_EmitC14(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!(((::llvm::isa<::mlir::emitc::ArrayType>(type))) || ((::llvm::isa<::mlir::emitc::OpaqueType>(type))) || ((::llvm::isa<::mlir::emitc::PointerType>(type))))) {
return op->emitOpError(valueKind) << " #" << valueIndex
<< " must be EmitC array type or EmitC opaque type or EmitC pointer type, but got " << type;
}
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC1(
::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_EmitC1(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC1(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC2(
::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_EmitC2(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC2(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC3(
::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_EmitC3(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC3(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC4(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::ArrayAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: array attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC4(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC4(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC5(
::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_EmitC5(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC5(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC6(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::emitc::ClassTypeAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: C++ aggregate type keyword";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC6(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC6(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC7(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !((::llvm::isa<::mlir::emitc::CmpPredicateAttr>(attr))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC7(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC7(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC8(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::emitc::OpaqueAttr>(attr))) || ((::llvm::isa<::mlir::TypedAttr>(attr)))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: An opaque attribute or TypedAttr instance";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC8(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC8(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC9(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((true))))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: any type attribute";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC9(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC9(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC10(
::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: An Attribute containing a string";
return ::mlir::success();
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC10(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC10(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC11(
::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_EmitC11(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC11(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC12(
::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_EmitC12(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC12(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_EmitC13(
::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_EmitC13(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
return __mlir_ods_local_attr_constraint_EmitC13(attr, attrName, [op]() {
return op->emitOpError();
});
}
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_EmitC1(
::mlir::Operation *op, ::mlir::Region &region, ::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_EmitC2(
::mlir::Operation *op, ::mlir::Region &region, ::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_EmitC3(
::mlir::Operation *op, ::mlir::Region &region, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!((::llvm::hasNItemsOrLess(region, 1)))) {
return op->emitOpError("region #") << regionIndex
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
<< "failed to verify constraint: region with at most 1 blocks";
}
return ::mlir::success();
}
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::AddOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
AddOpGenericAdaptorBase::AddOpGenericAdaptorBase(AddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
AddOpAdaptor::AddOpAdaptor(AddOp op) : AddOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AddOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult AddOp::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();
}
return ::mlir::success();
}
::mlir::Attribute AddOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AddOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> AddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void AddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void AddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult AddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void AddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void AddOp::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);
}
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void AddOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
AddOp AddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<AddOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddOp AddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult AddOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AddOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult AddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void AddOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::AddOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::AddressOfOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
AddressOfOpGenericAdaptorBase::AddressOfOpGenericAdaptorBase(AddressOfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
AddressOfOpAdaptor::AddressOfOpAdaptor(AddressOfOp op) : AddressOfOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AddressOfOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult AddressOfOp::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();
}
return ::mlir::success();
}
::mlir::Attribute AddressOfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AddressOfOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> AddressOfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void AddressOfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void AddressOfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult AddressOfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value reference) {
odsState.addOperands(reference);
odsState.addTypes(result);
}
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value reference) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(reference)>(reference));
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value reference) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(reference)>(reference));
}
void AddressOfOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value reference) {
odsState.addOperands(reference);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value reference) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(reference)>(reference));
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value reference) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(reference)>(reference));
}
void AddressOfOp::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);
}
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void AddressOfOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
AddressOfOp AddressOfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<AddressOfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AddressOfOp AddressOfOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult AddressOfOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC2(*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_EmitC3(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
if (!((std::equal_to<>()(emitc::PointerType::get(::llvm::cast<emitc::LValueType>((*this->getODSOperands(0).begin()).getType()).getValueType()), (*this->getODSResults(0).begin()).getType()))))
return emitOpError("failed to verify that input and result reference the same type");
return ::mlir::success();
}
::llvm::LogicalResult AddressOfOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult AddressOfOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand referenceRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> referenceOperands(&referenceRawOperand, 1); ::llvm::SMLoc referenceOperandsLoc;
(void)referenceOperandsLoc;
::mlir::Type referenceRawType{};
::llvm::ArrayRef<::mlir::Type> referenceTypes(&referenceRawType, 1);
referenceOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(referenceRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseType(referenceRawType))
return ::mlir::failure();
{
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();
}
for (::mlir::Type type : referenceTypes) {
(void)type;
if (!((::llvm::isa<::mlir::emitc::LValueType>(type)))) {
return parser.emitError(parser.getNameLoc()) << "'reference' must be EmitC lvalue type, but got " << type;
}
}
result.addTypes(emitc::PointerType::get(::llvm::cast<emitc::LValueType>(referenceTypes[0]).getValueType()));
if (parser.resolveOperands(referenceOperands, referenceTypes, referenceOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void AddressOfOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getReference();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getReference().getType();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::AddressOfOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::AssignOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
AssignOpGenericAdaptorBase::AssignOpGenericAdaptorBase(AssignOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
AssignOpAdaptor::AssignOpAdaptor(AssignOp op) : AssignOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult AssignOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult AssignOp::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();
}
return ::mlir::success();
}
::mlir::Attribute AssignOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code AssignOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> AssignOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void AssignOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void AssignOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult AssignOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void AssignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value value) {
odsState.addOperands(var);
odsState.addOperands(value);
}
AssignOp AssignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, ::mlir::Value value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(var)>(var), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<AssignOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AssignOp AssignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, ::mlir::Value value) {
return create(builder, builder.getLoc(), std::forward<decltype(var)>(var), std::forward<decltype(value)>(value));
}
void AssignOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value value) {
odsState.addOperands(var);
odsState.addOperands(value);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
AssignOp AssignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var)>(var), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<AssignOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AssignOp AssignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(var)>(var), std::forward<decltype(value)>(value));
}
void AssignOp::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);
}
AssignOp AssignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<AssignOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AssignOp AssignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void AssignOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
AssignOp AssignOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<AssignOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
AssignOp AssignOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult AssignOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC2(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult AssignOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult AssignOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
(void)valueOperandsLoc;
::mlir::Type valueRawType{};
::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
::mlir::OpAsmParser::UnresolvedOperand varRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> varOperands(&varRawOperand, 1); ::llvm::SMLoc varOperandsLoc;
(void)varOperandsLoc;
::mlir::Type varRawType{};
::llvm::ArrayRef<::mlir::Type> varTypes(&varRawType, 1);
valueOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(valueRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
valueRawType = type;
}
if (parser.parseKeyword("to"))
return ::mlir::failure();
varOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(varRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::emitc::LValueType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
varRawType = type;
}
{
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();
}
if (parser.resolveOperands(varOperands, varTypes, varOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void AssignOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getValue();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getValue().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ' ' << "to";
_odsPrinter << ' ';
_odsPrinter << getVar();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getVar().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::emitc::LValueType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
void AssignOp::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::Write::get(), &getOperation()->getOpOperand(idx), 1, true, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::AssignOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::BitwiseAndOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
BitwiseAndOpGenericAdaptorBase::BitwiseAndOpGenericAdaptorBase(BitwiseAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BitwiseAndOpAdaptor::BitwiseAndOpAdaptor(BitwiseAndOp op) : BitwiseAndOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BitwiseAndOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult BitwiseAndOp::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();
}
return ::mlir::success();
}
::mlir::Attribute BitwiseAndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code BitwiseAndOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> BitwiseAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void BitwiseAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void BitwiseAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult BitwiseAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void BitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseAndOp::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);
}
BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<BitwiseAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void BitwiseAndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
BitwiseAndOp BitwiseAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<BitwiseAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseAndOp BitwiseAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult BitwiseAndOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BitwiseAndOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BitwiseAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BitwiseAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseAndOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::BitwiseLeftShiftOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
BitwiseLeftShiftOpGenericAdaptorBase::BitwiseLeftShiftOpGenericAdaptorBase(BitwiseLeftShiftOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BitwiseLeftShiftOpAdaptor::BitwiseLeftShiftOpAdaptor(BitwiseLeftShiftOp op) : BitwiseLeftShiftOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BitwiseLeftShiftOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult BitwiseLeftShiftOp::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();
}
return ::mlir::success();
}
::mlir::Attribute BitwiseLeftShiftOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code BitwiseLeftShiftOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> BitwiseLeftShiftOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void BitwiseLeftShiftOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void BitwiseLeftShiftOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult BitwiseLeftShiftOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void BitwiseLeftShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseLeftShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseLeftShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseLeftShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseLeftShiftOp::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);
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<BitwiseLeftShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void BitwiseLeftShiftOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<BitwiseLeftShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseLeftShiftOp BitwiseLeftShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult BitwiseLeftShiftOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BitwiseLeftShiftOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BitwiseLeftShiftOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BitwiseLeftShiftOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseLeftShiftOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::BitwiseNotOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
BitwiseNotOpGenericAdaptorBase::BitwiseNotOpGenericAdaptorBase(BitwiseNotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BitwiseNotOpAdaptor::BitwiseNotOpAdaptor(BitwiseNotOp op) : BitwiseNotOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BitwiseNotOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult BitwiseNotOp::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();
}
return ::mlir::success();
}
::mlir::Attribute BitwiseNotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code BitwiseNotOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> BitwiseNotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void BitwiseNotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void BitwiseNotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult BitwiseNotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void BitwiseNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
odsState.addTypes(resultType0);
}
BitwiseNotOp BitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<BitwiseNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseNotOp BitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void BitwiseNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
BitwiseNotOp BitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<BitwiseNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseNotOp BitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void BitwiseNotOp::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);
}
BitwiseNotOp BitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<BitwiseNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseNotOp BitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void BitwiseNotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
BitwiseNotOp BitwiseNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<BitwiseNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseNotOp BitwiseNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult BitwiseNotOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BitwiseNotOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BitwiseNotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BitwiseNotOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseNotOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::BitwiseOrOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
BitwiseOrOpGenericAdaptorBase::BitwiseOrOpGenericAdaptorBase(BitwiseOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BitwiseOrOpAdaptor::BitwiseOrOpAdaptor(BitwiseOrOp op) : BitwiseOrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BitwiseOrOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult BitwiseOrOp::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();
}
return ::mlir::success();
}
::mlir::Attribute BitwiseOrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code BitwiseOrOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> BitwiseOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void BitwiseOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void BitwiseOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult BitwiseOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void BitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseOrOp::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);
}
BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<BitwiseOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void BitwiseOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
BitwiseOrOp BitwiseOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<BitwiseOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseOrOp BitwiseOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult BitwiseOrOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BitwiseOrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BitwiseOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BitwiseOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseOrOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::BitwiseRightShiftOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
BitwiseRightShiftOpGenericAdaptorBase::BitwiseRightShiftOpGenericAdaptorBase(BitwiseRightShiftOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BitwiseRightShiftOpAdaptor::BitwiseRightShiftOpAdaptor(BitwiseRightShiftOp op) : BitwiseRightShiftOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BitwiseRightShiftOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult BitwiseRightShiftOp::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();
}
return ::mlir::success();
}
::mlir::Attribute BitwiseRightShiftOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code BitwiseRightShiftOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> BitwiseRightShiftOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void BitwiseRightShiftOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void BitwiseRightShiftOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult BitwiseRightShiftOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void BitwiseRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseRightShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseRightShiftOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseRightShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseRightShiftOp::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);
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<BitwiseRightShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void BitwiseRightShiftOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<BitwiseRightShiftOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseRightShiftOp BitwiseRightShiftOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult BitwiseRightShiftOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BitwiseRightShiftOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BitwiseRightShiftOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BitwiseRightShiftOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseRightShiftOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::BitwiseXorOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
BitwiseXorOpGenericAdaptorBase::BitwiseXorOpGenericAdaptorBase(BitwiseXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
BitwiseXorOpAdaptor::BitwiseXorOpAdaptor(BitwiseXorOp op) : BitwiseXorOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult BitwiseXorOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult BitwiseXorOp::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();
}
return ::mlir::success();
}
::mlir::Attribute BitwiseXorOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code BitwiseXorOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> BitwiseXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void BitwiseXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void BitwiseXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult BitwiseXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void BitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseXorOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<BitwiseXorOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void BitwiseXorOp::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);
}
BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<BitwiseXorOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void BitwiseXorOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
BitwiseXorOp BitwiseXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<BitwiseXorOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
BitwiseXorOp BitwiseXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult BitwiseXorOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult BitwiseXorOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult BitwiseXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void BitwiseXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseXorOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::CallOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(CallOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> CallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::StringRef CallOpGenericAdaptorBase::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getArgAttrs() {
auto attr = getArgAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > CallOpGenericAdaptorBase::getResAttrs() {
auto attr = getResAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
} // namespace detail
CallOpAdaptor::CallOpAdaptor(CallOp op) : CallOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CallOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitError(loc, "'emitc.call' op requires attribute 'callee'");
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
if (tblgen_callee && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_callee))))
return emitError(loc, "'emitc.call' op attribute 'callee' failed to satisfy constraint: flat symbol reference attribute");
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, "'emitc.call' 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, "'emitc.call' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
return ::mlir::success();
}
std::pair<unsigned, unsigned> CallOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange CallOp::getOperandsMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
std::pair<unsigned, unsigned> CallOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult CallOp::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.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();
}
}
}
{
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();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CallOp::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.callee;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("callee",
propStorage));
}
{
const auto &propStorage = prop.res_attrs;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CallOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
llvm::hash_value(prop.callee.getAsOpaquePointer()),
llvm::hash_value(prop.res_attrs.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "arg_attrs")
return prop.arg_attrs;
if (name == "callee")
return prop.callee;
if (name == "res_attrs")
return prop.res_attrs;
return std::nullopt;
}
void CallOp::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 == "callee") {
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
return;
}
if (name == "res_attrs") {
prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
return;
}
}
void CallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
if (prop.callee) attrs.append("callee", prop.callee);
if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
}
::llvm::LogicalResult CallOp::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_EmitC2(attr, "arg_attrs", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(attr, "callee", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC2(attr, "res_attrs", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CallOp::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.callee)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
return ::mlir::failure();
return ::mlir::success();
}
void CallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.arg_attrs);
writer.writeAttribute(prop.callee);
writer.writeOptionalAttribute(prop.res_attrs);
}
::llvm::StringRef CallOp::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
::std::optional< ::mlir::ArrayAttr > CallOp::getArgAttrs() {
auto attr = getArgAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > CallOp::getResAttrs() {
auto attr = getResAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
void CallOp::setCallee(::llvm::StringRef attrValue) {
getProperties().callee = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands) {
odsState.addOperands(operands);
odsState.addAttribute("callee", SymbolRefAttr::get(callee));
odsState.addTypes(callee.getFunctionType().getResults());
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, FuncOp callee, ValueRange operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(callee)>(callee), std::forward<decltype(operands)>(operands));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, FuncOp callee, ValueRange operands) {
return create(builder, builder.getLoc(), std::forward<decltype(callee)>(callee), std::forward<decltype(operands)>(operands));
}
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands) {
odsState.addOperands(operands);
odsState.addAttribute("callee", callee);
odsState.addTypes(results);
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, SymbolRefAttr callee, TypeRange results, ValueRange operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(callee)>(callee), std::forward<decltype(results)>(results), std::forward<decltype(operands)>(operands));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, SymbolRefAttr callee, TypeRange results, ValueRange operands) {
return create(builder, builder.getLoc(), std::forward<decltype(callee)>(callee), std::forward<decltype(results)>(results), std::forward<decltype(operands)>(operands));
}
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands) {
build(odsBuilder, odsState, SymbolRefAttr::get(callee), results, operands);
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringAttr callee, TypeRange results, ValueRange operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(callee)>(callee), std::forward<decltype(results)>(results), std::forward<decltype(operands)>(operands));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, StringAttr callee, TypeRange results, ValueRange operands) {
return create(builder, builder.getLoc(), std::forward<decltype(callee)>(callee), std::forward<decltype(results)>(results), std::forward<decltype(operands)>(operands));
}
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands) {
build(odsBuilder, odsState, StringAttr::get(odsBuilder.getContext(), callee),
results, operands);
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef callee, TypeRange results, ValueRange operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(callee)>(callee), std::forward<decltype(results)>(results), std::forward<decltype(operands)>(operands));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef callee, TypeRange results, ValueRange operands) {
return create(builder, builder.getLoc(), std::forward<decltype(callee)>(callee), std::forward<decltype(results)>(results), std::forward<decltype(operands)>(operands));
}
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
odsState.addOperands(operands);
odsState.getOrAddProperties<Properties>().callee = callee;
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
odsState.addTypes(resultType0);
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(operands)>(operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(operands)>(operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
}
void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
odsState.addOperands(operands);
odsState.getOrAddProperties<Properties>().callee = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), callee);
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
odsState.addTypes(resultType0);
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(operands)>(operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(operands)>(operands), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
}
void CallOp::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()) {
(void)odsState.getOrAddProperties<CallOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CallOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
CallOp CallOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CallOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOp CallOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CallOp::verifyInvariantsImpl() {
auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(*this, tblgen_callee, "callee")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC2(*this, tblgen_arg_attrs, "arg_attrs")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC2(*this, tblgen_res_attrs, "res_attrs")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC4(*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_EmitC4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CallOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CallOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::FlatSymbolRefAttr calleeAttr;
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands;
::llvm::SMLoc operandsOperandsLoc;
(void)operandsOperandsLoc;
::llvm::ArrayRef<::mlir::Type> operandsTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (calleeAttr) result.getOrAddProperties<CallOp::Properties>().callee = calleeAttr;
if (parser.parseLParen())
return ::mlir::failure();
operandsOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperandList(operandsOperands))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType operands__allResult_functionType;
if (parser.parseType(operands__allResult_functionType))
return ::mlir::failure();
operandsTypes = operands__allResult_functionType.getInputs();
allResultTypes = operands__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CallOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getCalleeAttr());
_odsPrinter << "(";
_odsPrinter << getOperands();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("callee");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperands().getTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::CallOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CallOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::CallOpaqueOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CallOpaqueOpGenericAdaptorBase::CallOpaqueOpGenericAdaptorBase(CallOpaqueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> CallOpaqueOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::StringRef CallOpaqueOpGenericAdaptorBase::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
::std::optional< ::mlir::ArrayAttr > CallOpaqueOpGenericAdaptorBase::getArgs() {
auto attr = getArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > CallOpaqueOpGenericAdaptorBase::getTemplateArgs() {
auto attr = getTemplateArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
} // namespace detail
CallOpaqueOpAdaptor::CallOpaqueOpAdaptor(CallOpaqueOp op) : CallOpaqueOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CallOpaqueOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_args = getProperties().args; (void)tblgen_args;
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitError(loc, "'emitc.call_opaque' op requires attribute 'callee'");
auto tblgen_template_args = getProperties().template_args; (void)tblgen_template_args;
if (tblgen_callee && !((::llvm::isa<::mlir::StringAttr>(tblgen_callee))))
return emitError(loc, "'emitc.call_opaque' op attribute 'callee' failed to satisfy constraint: string attribute");
if (tblgen_args && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_args))))
return emitError(loc, "'emitc.call_opaque' op attribute 'args' failed to satisfy constraint: array attribute");
if (tblgen_template_args && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_template_args))))
return emitError(loc, "'emitc.call_opaque' op attribute 'template_args' failed to satisfy constraint: array attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> CallOpaqueOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange CallOpaqueOp::getArgOperandsMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
std::pair<unsigned, unsigned> CallOpaqueOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult CallOpaqueOp::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.args;
auto attr = dict.get("args");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `args` in property conversion: " << attr;
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();
}
}
}
{
auto &propStorage = prop.template_args;
auto attr = dict.get("template_args");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `template_args` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CallOpaqueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.args;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("args",
propStorage));
}
{
const auto &propStorage = prop.callee;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("callee",
propStorage));
}
{
const auto &propStorage = prop.template_args;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("template_args",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CallOpaqueOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.args.getAsOpaquePointer()),
llvm::hash_value(prop.callee.getAsOpaquePointer()),
llvm::hash_value(prop.template_args.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CallOpaqueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "args")
return prop.args;
if (name == "callee")
return prop.callee;
if (name == "template_args")
return prop.template_args;
return std::nullopt;
}
void CallOpaqueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "args") {
prop.args = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.args)>>(value);
return;
}
if (name == "callee") {
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
return;
}
if (name == "template_args") {
prop.template_args = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.template_args)>>(value);
return;
}
}
void CallOpaqueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.args) attrs.append("args", prop.args);
if (prop.callee) attrs.append("callee", prop.callee);
if (prop.template_args) attrs.append("template_args", prop.template_args);
}
::llvm::LogicalResult CallOpaqueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getArgsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(attr, "args", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "callee", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getTemplateArgsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(attr, "template_args", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CallOpaqueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.args)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.callee)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.template_args)))
return ::mlir::failure();
return ::mlir::success();
}
void CallOpaqueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.args);
writer.writeAttribute(prop.callee);
writer.writeOptionalAttribute(prop.template_args);
}
::llvm::StringRef CallOpaqueOp::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
::std::optional< ::mlir::ArrayAttr > CallOpaqueOp::getArgs() {
auto attr = getArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > CallOpaqueOp::getTemplateArgs() {
auto attr = getTemplateArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
void CallOpaqueOp::setCallee(::llvm::StringRef attrValue) {
getProperties().callee = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void CallOpaqueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arg_operands, ::mlir::ArrayAttr args, ::mlir::ArrayAttr template_args) {
build(odsBuilder, odsState, resultTypes, callee, args, template_args,
arg_operands);
}
CallOpaqueOp CallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arg_operands, ::mlir::ArrayAttr args, ::mlir::ArrayAttr template_args) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(callee)>(callee), std::forward<decltype(arg_operands)>(arg_operands), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args));
auto __res__ = ::llvm::dyn_cast<CallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOpaqueOp CallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arg_operands, ::mlir::ArrayAttr args, ::mlir::ArrayAttr template_args) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(callee)>(callee), std::forward<decltype(arg_operands)>(arg_operands), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args));
}
void CallOpaqueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
odsState.addOperands(arg_operands);
odsState.getOrAddProperties<Properties>().callee = callee;
if (args) {
odsState.getOrAddProperties<Properties>().args = args;
}
if (template_args) {
odsState.getOrAddProperties<Properties>().template_args = template_args;
}
odsState.addTypes(resultType0);
}
CallOpaqueOp CallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
auto __res__ = ::llvm::dyn_cast<CallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOpaqueOp CallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
}
void CallOpaqueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
odsState.addOperands(arg_operands);
odsState.getOrAddProperties<Properties>().callee = odsBuilder.getStringAttr(callee);
if (args) {
odsState.getOrAddProperties<Properties>().args = args;
}
if (template_args) {
odsState.getOrAddProperties<Properties>().template_args = template_args;
}
odsState.addTypes(resultType0);
}
CallOpaqueOp CallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
auto __res__ = ::llvm::dyn_cast<CallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOpaqueOp CallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
}
void CallOpaqueOp::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()) {
(void)odsState.getOrAddProperties<CallOpaqueOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
CallOpaqueOp CallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOpaqueOp CallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CallOpaqueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
CallOpaqueOp CallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CallOpaqueOp CallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CallOpaqueOp::verifyInvariantsImpl() {
auto tblgen_args = getProperties().args; (void)tblgen_args;
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
auto tblgen_template_args = getProperties().template_args; (void)tblgen_template_args;
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_callee, "callee")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(*this, tblgen_args, "args")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(*this, tblgen_template_args, "template_args")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC5(*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_EmitC4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CallOpaqueOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult CallOpaqueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::StringAttr calleeAttr;
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> arg_operandsOperands;
::llvm::SMLoc arg_operandsOperandsLoc;
(void)arg_operandsOperandsLoc;
::llvm::ArrayRef<::mlir::Type> arg_operandsTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (calleeAttr) result.getOrAddProperties<CallOpaqueOp::Properties>().callee = calleeAttr;
if (parser.parseLParen())
return ::mlir::failure();
arg_operandsOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperandList(arg_operandsOperands))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
if (parseProperties(parser, result))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType arg_operands__allResult_functionType;
if (parser.parseType(arg_operands__allResult_functionType))
return ::mlir::failure();
arg_operandsTypes = arg_operands__allResult_functionType.getInputs();
allResultTypes = arg_operands__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(arg_operandsOperands, arg_operandsTypes, arg_operandsOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult CallOpaqueOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.args;
auto argsAttrName = ::mlir::StringAttr::get(ctx, "args");
auto attr = dict.get(argsAttrName);
usedKeys.insert(argsAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for args in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `args` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.template_args;
auto template_argsAttrName = ::mlir::StringAttr::get(ctx, "template_args");
auto attr = dict.get(template_argsAttrName);
usedKeys.insert(template_argsAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for template_args in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `template_args` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
void CallOpaqueOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getCalleeAttr());
_odsPrinter << "(";
_odsPrinter << getArgOperands();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedProps;
elidedProps.push_back("callee");
_odsPrinter << " ";
printProperties(this->getContext(), _odsPrinter, getProperties(), elidedProps);
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("callee");
_odsPrinter.printOptionalAttrDict(llvm::to_vector((*this)->getDiscardableAttrs()), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getArgOperands().getTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::CallOpaqueOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CallOpaqueOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::CastOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CastOpGenericAdaptorBase::CastOpGenericAdaptorBase(CastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::UnitAttr CastOpGenericAdaptorBase::getPureAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().pure);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool CastOpGenericAdaptorBase::getPure() {
auto attr = getPureAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
} // namespace detail
CastOpAdaptor::CastOpAdaptor(CastOp op) : CastOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CastOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_pure = getProperties().pure; (void)tblgen_pure;
if (tblgen_pure && !((::llvm::isa<::mlir::UnitAttr>(tblgen_pure))))
return emitError(loc, "'emitc.cast' op attribute 'pure' failed to satisfy constraint: unit attribute");
return ::mlir::success();
}
::llvm::LogicalResult CastOp::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.pure;
auto attr = dict.get("pure");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `pure` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CastOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.pure;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("pure",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CastOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.pure.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "pure")
return prop.pure;
return std::nullopt;
}
void CastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "pure") {
prop.pure = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.pure)>>(value);
return;
}
}
void CastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.pure) attrs.append("pure", prop.pure);
}
::llvm::LogicalResult CastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getPureAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "pure", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CastOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.pure)))
return ::mlir::failure();
return ::mlir::success();
}
void CastOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.pure);
}
bool CastOp::getPure() {
auto attr = getPureAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
void CastOp::setPure(bool attrValue) {
auto &odsProp = getProperties().pure;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void CastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure) {
odsState.addOperands(source);
if (pure) {
odsState.getOrAddProperties<Properties>().pure = pure;
}
odsState.addTypes(dest);
}
CastOp CastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type dest, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(dest)>(dest), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
auto __res__ = ::llvm::dyn_cast<CastOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CastOp CastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type dest, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure) {
return create(builder, builder.getLoc(), std::forward<decltype(dest)>(dest), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
}
void CastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure) {
odsState.addOperands(source);
if (pure) {
odsState.getOrAddProperties<Properties>().pure = pure;
}
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CastOp CastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
auto __res__ = ::llvm::dyn_cast<CastOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CastOp CastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
}
void CastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source, /*optional*/bool pure) {
odsState.addOperands(source);
if (pure) {
odsState.getOrAddProperties<Properties>().pure = ((pure) ? odsBuilder.getUnitAttr() : nullptr);
}
odsState.addTypes(dest);
}
CastOp CastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type dest, ::mlir::Value source, /*optional*/bool pure) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(dest)>(dest), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
auto __res__ = ::llvm::dyn_cast<CastOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CastOp CastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type dest, ::mlir::Value source, /*optional*/bool pure) {
return create(builder, builder.getLoc(), std::forward<decltype(dest)>(dest), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
}
void CastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/bool pure) {
odsState.addOperands(source);
if (pure) {
odsState.getOrAddProperties<Properties>().pure = ((pure) ? odsBuilder.getUnitAttr() : nullptr);
}
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CastOp CastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/bool pure) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
auto __res__ = ::llvm::dyn_cast<CastOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CastOp CastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/bool pure) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(source)>(source), std::forward<decltype(pure)>(pure));
}
void CastOp::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()) {
(void)odsState.getOrAddProperties<CastOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
CastOp CastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CastOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CastOp CastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CastOp CastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CastOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CastOp CastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CastOp::verifyInvariantsImpl() {
auto tblgen_pure = getProperties().pure; (void)tblgen_pure;
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_pure, "pure")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CastOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CastOp::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::Type sourceRawType{};
::llvm::ArrayRef<::mlir::Type> sourceTypes(&sourceRawType, 1);
::mlir::Type destRawType{};
::llvm::ArrayRef<::mlir::Type> destTypes(&destRawType, 1);
sourceOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(sourceRawOperand))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
sourceRawType = type;
}
if (parser.parseKeyword("to"))
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
destRawType = type;
}
result.addTypes(destTypes);
if (parser.resolveOperands(sourceOperands, sourceTypes, sourceOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getSource();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
{
::mlir::Builder odsBuilder(getContext());
::mlir::Attribute attr = getPureAttr();
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
elidedAttrs.push_back("pure");
}
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getSource().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ' ' << "to";
_odsPrinter << ' ';
{
auto type = getDest().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::CastOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CastOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::ClassOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ClassOpGenericAdaptorBase::ClassOpGenericAdaptorBase(ClassOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef ClassOpGenericAdaptorBase::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::UnitAttr ClassOpGenericAdaptorBase::getFinalSpecifierAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().final_specifier);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool ClassOpGenericAdaptorBase::getFinalSpecifier() {
auto attr = getFinalSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
::mlir::emitc::ClassTypeAttr ClassOpGenericAdaptorBase::getClassTypeAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::emitc::ClassTypeAttr>(getProperties().class_type);
return attr;
}
::mlir::emitc::ClassType ClassOpGenericAdaptorBase::getClassType() {
auto attr = getClassTypeAttr();
return attr.getValue();
}
} // namespace detail
ClassOpAdaptor::ClassOpAdaptor(ClassOp op) : ClassOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ClassOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_class_type = getProperties().class_type; (void)tblgen_class_type;
auto tblgen_final_specifier = getProperties().final_specifier; (void)tblgen_final_specifier;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitError(loc, "'emitc.class' op requires attribute 'sym_name'");
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
return emitError(loc, "'emitc.class' op attribute 'sym_name' failed to satisfy constraint: string attribute");
if (tblgen_final_specifier && !((::llvm::isa<::mlir::UnitAttr>(tblgen_final_specifier))))
return emitError(loc, "'emitc.class' op attribute 'final_specifier' failed to satisfy constraint: unit attribute");
if (tblgen_class_type && !((::llvm::isa<::mlir::emitc::ClassTypeAttr>(tblgen_class_type))))
return emitError(loc, "'emitc.class' op attribute 'class_type' failed to satisfy constraint: C++ aggregate type keyword");
return ::mlir::success();
}
::llvm::LogicalResult ClassOp::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.class_type;
auto attr = dict.get("class_type");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `class_type` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.final_specifier;
auto attr = dict.get("final_specifier");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `final_specifier` 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();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ClassOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.class_type;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("class_type",
propStorage));
}
{
const auto &propStorage = prop.final_specifier;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("final_specifier",
propStorage));
}
{
const auto &propStorage = prop.sym_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ClassOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.class_type.getAsOpaquePointer()),
llvm::hash_value(prop.final_specifier.getAsOpaquePointer()),
llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ClassOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "class_type")
return prop.class_type;
if (name == "final_specifier")
return prop.final_specifier;
if (name == "sym_name")
return prop.sym_name;
return std::nullopt;
}
void ClassOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "class_type") {
prop.class_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.class_type)>>(value);
return;
}
if (name == "final_specifier") {
prop.final_specifier = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.final_specifier)>>(value);
return;
}
if (name == "sym_name") {
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
return;
}
}
void ClassOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.class_type) attrs.append("class_type", prop.class_type);
if (prop.final_specifier) attrs.append("final_specifier", prop.final_specifier);
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
}
::llvm::LogicalResult ClassOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getClassTypeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC6(attr, "class_type", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getFinalSpecifierAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "final_specifier", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "sym_name", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ClassOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.class_type)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.final_specifier)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
return ::mlir::failure();
return ::mlir::success();
}
void ClassOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.class_type);
writer.writeOptionalAttribute(prop.final_specifier);
writer.writeAttribute(prop.sym_name);
}
::llvm::StringRef ClassOp::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
bool ClassOp::getFinalSpecifier() {
auto attr = getFinalSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
::mlir::emitc::ClassType ClassOp::getClassType() {
auto attr = getClassTypeAttr();
return attr.getValue();
}
void ClassOp::setSymName(::llvm::StringRef attrValue) {
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void ClassOp::setFinalSpecifier(bool attrValue) {
auto &odsProp = getProperties().final_specifier;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void ClassOp::setClassType(::mlir::emitc::ClassType attrValue) {
getProperties().class_type = ::mlir::emitc::ClassTypeAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier, ::mlir::emitc::ClassTypeAttr class_type) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
if (final_specifier) {
odsState.getOrAddProperties<Properties>().final_specifier = final_specifier;
}
if (class_type) {
odsState.getOrAddProperties<Properties>().class_type = class_type;
}
(void)odsState.addRegion();
}
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier, ::mlir::emitc::ClassTypeAttr class_type) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
auto __res__ = ::llvm::dyn_cast<ClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ClassOp ClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier, ::mlir::emitc::ClassTypeAttr class_type) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
}
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier, ::mlir::emitc::ClassTypeAttr class_type) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
if (final_specifier) {
odsState.getOrAddProperties<Properties>().final_specifier = final_specifier;
}
if (class_type) {
odsState.getOrAddProperties<Properties>().class_type = class_type;
}
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier, ::mlir::emitc::ClassTypeAttr class_type) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
auto __res__ = ::llvm::dyn_cast<ClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ClassOp ClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier, ::mlir::emitc::ClassTypeAttr class_type) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
}
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/bool final_specifier, ::mlir::emitc::ClassType class_type) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
if (final_specifier) {
odsState.getOrAddProperties<Properties>().final_specifier = ((final_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
odsState.getOrAddProperties<Properties>().class_type = ::mlir::emitc::ClassTypeAttr::get(odsBuilder.getContext(), class_type);
(void)odsState.addRegion();
}
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, /*optional*/bool final_specifier, ::mlir::emitc::ClassType class_type) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
auto __res__ = ::llvm::dyn_cast<ClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ClassOp ClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, /*optional*/bool final_specifier, ::mlir::emitc::ClassType class_type) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
}
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool final_specifier, ::mlir::emitc::ClassType class_type) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
if (final_specifier) {
odsState.getOrAddProperties<Properties>().final_specifier = ((final_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
odsState.getOrAddProperties<Properties>().class_type = ::mlir::emitc::ClassTypeAttr::get(odsBuilder.getContext(), class_type);
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool final_specifier, ::mlir::emitc::ClassType class_type) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
auto __res__ = ::llvm::dyn_cast<ClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ClassOp ClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool final_specifier, ::mlir::emitc::ClassType class_type) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(final_specifier)>(final_specifier), std::forward<decltype(class_type)>(class_type));
}
void ClassOp::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()) {
(void)odsState.getOrAddProperties<ClassOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ClassOp ClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ClassOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ClassOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ClassOp ClassOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
void ClassOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
::mlir::Builder odsBuilder(opName.getContext());
if (!properties.class_type)
properties.class_type = ::mlir::emitc::ClassTypeAttr::get(odsBuilder.getContext(), ClassType::class_);
}
::llvm::LogicalResult ClassOp::verifyInvariantsImpl() {
auto tblgen_class_type = getProperties().class_type; (void)tblgen_class_type;
auto tblgen_final_specifier = getProperties().final_specifier; (void)tblgen_final_specifier;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_sym_name, "sym_name")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_final_specifier, "final_specifier")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC6(*this, tblgen_class_type, "class_type")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC1(*this, region, "body", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ClassOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ClassOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::emitc::ClassTypeAttr class_typeAttr;
::mlir::StringAttr sym_nameAttr;
std::unique_ptr<::mlir::Region> bodyRegion = std::make_unique<::mlir::Region>();
{
::llvm::StringRef attrStr;
::mlir::NamedAttrList attrStorage;
auto loc = parser.getCurrentLocation();
if (parser.parseOptionalKeyword(&attrStr, {"class","struct","union"})) {
::mlir::StringAttr attrVal;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalAttribute(attrVal,
parser.getBuilder().getNoneType(),
"class_type", attrStorage);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
attrStr = attrVal.getValue();
} else {
}
}
if (!attrStr.empty()) {
auto attrOptional = ::mlir::emitc::symbolizeClassType(attrStr);
if (!attrOptional)
return parser.emitError(loc, "invalid ")
<< "class_type attribute specification: \"" << attrStr << '"';;
class_typeAttr = ::mlir::emitc::ClassTypeAttr::get(parser.getBuilder().getContext(), *attrOptional);
result.getOrAddProperties<ClassOp::Properties>().class_type = class_typeAttr;
}
}
if (class_typeAttr) {
}
if (::mlir::succeeded(parser.parseOptionalKeyword("final"))) {
result.getOrAddProperties<ClassOp::Properties>().final_specifier = parser.getBuilder().getUnitAttr(); }
if (parser.parseSymbolName(sym_nameAttr))
return ::mlir::failure();
if (sym_nameAttr) result.getOrAddProperties<ClassOp::Properties>().sym_name = sym_nameAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseRegion(*bodyRegion))
return ::mlir::failure();
if (bodyRegion->empty()) bodyRegion->emplaceBlock();
result.addRegion(std::move(bodyRegion));
return ::mlir::success();
}
void ClassOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
if (getClassTypeAttr() != ::mlir::emitc::ClassTypeAttr::get(::mlir::OpBuilder((*this)->getContext()).getContext(), ClassType::class_)) {
_odsPrinter << ' ';
{
auto caseValue = getClassType();
auto caseValueStr = stringifyClassType(caseValue);
_odsPrinter << caseValueStr;
}
}
if ((getFinalSpecifierAttr() && getFinalSpecifierAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
_odsPrinter << ' ' << "final";
}
_odsPrinter << ' ';
_odsPrinter.printSymbolName(getSymNameAttr().getValue());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("class_type");
elidedAttrs.push_back("final_specifier");
elidedAttrs.push_back("sym_name");
{
::mlir::Builder odsBuilder(getContext());
::mlir::Attribute attr = getFinalSpecifierAttr();
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
elidedAttrs.push_back("final_specifier");
}
{
::mlir::Builder odsBuilder(getContext());
::mlir::Attribute attr = getClassTypeAttr();
if(attr && (attr == ::mlir::emitc::ClassTypeAttr::get(odsBuilder.getContext(), ClassType::class_)))
elidedAttrs.push_back("class_type");
}
_odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ';
_odsPrinter.printRegion(getBody());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::ClassOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::ClassOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::CmpOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
CmpOpGenericAdaptorBase::CmpOpGenericAdaptorBase(CmpOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::emitc::CmpPredicate CmpOpGenericAdaptorBase::getPredicate() {
auto attr = getPredicateAttr();
return attr.getValue();
}
} // namespace detail
CmpOpAdaptor::CmpOpAdaptor(CmpOp op) : CmpOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult CmpOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate;
if (!tblgen_predicate) return emitError(loc, "'emitc.cmp' op requires attribute 'predicate'");
if (tblgen_predicate && !((::llvm::isa<::mlir::emitc::CmpPredicateAttr>(tblgen_predicate))))
return emitError(loc, "'emitc.cmp' op attribute 'predicate' failed to satisfy constraint: allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6");
return ::mlir::success();
}
::llvm::LogicalResult CmpOp::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.predicate;
auto attr = dict.get("predicate");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `predicate` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute CmpOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.predicate;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("predicate",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code CmpOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.predicate.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> CmpOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "predicate")
return prop.predicate;
return std::nullopt;
}
void CmpOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "predicate") {
prop.predicate = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.predicate)>>(value);
return;
}
}
void CmpOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.predicate) attrs.append("predicate", prop.predicate);
}
::llvm::LogicalResult CmpOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getPredicateAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC7(attr, "predicate", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult CmpOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.predicate)))
return ::mlir::failure();
return ::mlir::success();
}
void CmpOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.predicate);
}
::mlir::emitc::CmpPredicate CmpOp::getPredicate() {
auto attr = getPredicateAttr();
return attr.getValue();
}
void CmpOp::setPredicate(::mlir::emitc::CmpPredicate attrValue) {
getProperties().predicate = ::mlir::emitc::CmpPredicateAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.getOrAddProperties<Properties>().predicate = predicate;
odsState.addTypes(resultType0);
}
CmpOp CmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<CmpOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CmpOp CmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.getOrAddProperties<Properties>().predicate = predicate;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CmpOp CmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<CmpOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CmpOp CmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.getOrAddProperties<Properties>().predicate = ::mlir::emitc::CmpPredicateAttr::get(odsBuilder.getContext(), predicate);
odsState.addTypes(resultType0);
}
CmpOp CmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<CmpOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CmpOp CmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void CmpOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.getOrAddProperties<Properties>().predicate = ::mlir::emitc::CmpPredicateAttr::get(odsBuilder.getContext(), predicate);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
CmpOp CmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<CmpOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CmpOp CmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(predicate)>(predicate), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void CmpOp::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);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<CmpOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
CmpOp CmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<CmpOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CmpOp CmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void CmpOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
CmpOp CmpOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<CmpOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
CmpOp CmpOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult CmpOp::verifyInvariantsImpl() {
auto tblgen_predicate = getProperties().predicate; (void)tblgen_predicate;
if (!tblgen_predicate) return emitOpError("requires attribute 'predicate'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC7(*this, tblgen_predicate, "predicate")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult CmpOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult CmpOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::emitc::CmpPredicateAttr predicateAttr;
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
{
::llvm::StringRef attrStr;
::mlir::NamedAttrList attrStorage;
auto loc = parser.getCurrentLocation();
if (parser.parseOptionalKeyword(&attrStr, {"eq","ne","lt","le","gt","ge","three_way"})) {
::mlir::StringAttr attrVal;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalAttribute(attrVal,
parser.getBuilder().getNoneType(),
"predicate", attrStorage);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
attrStr = attrVal.getValue();
} else {
return parser.emitError(loc, "expected string or keyword containing one of the following enum values for attribute 'predicate' [eq, ne, lt, le, gt, ge, three_way]");
}
}
if (!attrStr.empty()) {
auto attrOptional = ::mlir::emitc::symbolizeCmpPredicate(attrStr);
if (!attrOptional)
return parser.emitError(loc, "invalid ")
<< "predicate attribute specification: \"" << attrStr << '"';;
predicateAttr = ::mlir::emitc::CmpPredicateAttr::get(parser.getBuilder().getContext(), *attrOptional);
result.getOrAddProperties<CmpOp::Properties>().predicate = predicateAttr;
}
}
if (parser.parseComma())
return ::mlir::failure();
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void CmpOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
{
auto caseValue = getPredicate();
auto caseValueStr = stringifyCmpPredicate(caseValue);
_odsPrinter << caseValueStr;
}
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("predicate");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::CmpOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CmpOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::ConditionalOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ConditionalOpGenericAdaptorBase::ConditionalOpGenericAdaptorBase(ConditionalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
ConditionalOpAdaptor::ConditionalOpAdaptor(ConditionalOp op) : ConditionalOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ConditionalOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult ConditionalOp::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();
}
return ::mlir::success();
}
::mlir::Attribute ConditionalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ConditionalOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> ConditionalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void ConditionalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void ConditionalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult ConditionalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void ConditionalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
odsState.addOperands(condition);
odsState.addOperands(true_value);
odsState.addOperands(false_value);
odsState.addTypes(result);
}
ConditionalOp ConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(condition)>(condition), std::forward<decltype(true_value)>(true_value), std::forward<decltype(false_value)>(false_value));
auto __res__ = ::llvm::dyn_cast<ConditionalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConditionalOp ConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(condition)>(condition), std::forward<decltype(true_value)>(true_value), std::forward<decltype(false_value)>(false_value));
}
void ConditionalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
odsState.addOperands(condition);
odsState.addOperands(true_value);
odsState.addOperands(false_value);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ConditionalOp ConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(true_value)>(true_value), std::forward<decltype(false_value)>(false_value));
auto __res__ = ::llvm::dyn_cast<ConditionalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConditionalOp ConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(true_value)>(true_value), std::forward<decltype(false_value)>(false_value));
}
void ConditionalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ConditionalOp ConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ConditionalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConditionalOp ConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ConditionalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 3u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ConditionalOp ConditionalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ConditionalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConditionalOp ConditionalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ConditionalOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
if (!((((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()))))
return emitOpError("failed to verify that all of {true_value, false_value, result} have same type");
return ::mlir::success();
}
::llvm::LogicalResult ConditionalOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult ConditionalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::mlir::Type resultRawType{};
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
resultRawType = type;
}
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
result.addTypes(resultTypes);
if (parser.resolveOperands(allOperands, ::llvm::concat<const ::mlir::Type>(::llvm::ArrayRef<::mlir::Type>(odsBuildableType0), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0]), ::llvm::ArrayRef<::mlir::Type>(resultTypes[0])), allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void ConditionalOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getResult().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::ConditionalOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::ConstantOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::Attribute ConstantOpGenericAdaptorBase::getValue() {
auto attr = getValueAttr();
return attr;
}
} // namespace detail
ConstantOpAdaptor::ConstantOpAdaptor(ConstantOp op) : ConstantOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ConstantOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitError(loc, "'emitc.constant' op requires attribute 'value'");
if (tblgen_value && !(((::llvm::isa<::mlir::emitc::OpaqueAttr>(tblgen_value))) || ((::llvm::isa<::mlir::TypedAttr>(tblgen_value)))))
return emitError(loc, "'emitc.constant' op attribute 'value' failed to satisfy constraint: An opaque attribute or TypedAttr instance");
return ::mlir::success();
}
::llvm::LogicalResult ConstantOp::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.value;
auto attr = dict.get("value");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ConstantOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.value;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("value",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ConstantOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.value.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ConstantOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "value")
return prop.value;
return std::nullopt;
}
void ConstantOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "value") {
prop.value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.value)>>(value);
return;
}
}
void ConstantOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.value) attrs.append("value", prop.value);
}
::llvm::LogicalResult ConstantOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getValueAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(attr, "value", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ConstantOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.value)))
return ::mlir::failure();
return ::mlir::success();
}
void ConstantOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.value);
}
::mlir::Attribute ConstantOp::getValue() {
auto attr = getValueAttr();
return attr;
}
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Attribute value) {
odsState.getOrAddProperties<Properties>().value = value;
odsState.addTypes(resultType0);
}
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Attribute value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Attribute value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(value)>(value));
}
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
odsState.getOrAddProperties<Properties>().value = value;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
}
void ConstantOp::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()) {
(void)odsState.getOrAddProperties<ConstantOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ConstantOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ConstantOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ConstantOp ConstantOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ConstantOp::verifyInvariantsImpl() {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitOpError("requires attribute 'value'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(*this, tblgen_value, "value")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ConstantOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::llvm::LogicalResult ConstantOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.value;
auto valueAttrName = ::mlir::StringAttr::get(ctx, "value");
auto attr = dict.get(valueAttrName);
usedKeys.insert(valueAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for value in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::ConstantOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::ConstantOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::DeclareFuncOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
DeclareFuncOpGenericAdaptorBase::DeclareFuncOpGenericAdaptorBase(DeclareFuncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef DeclareFuncOpGenericAdaptorBase::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
} // namespace detail
DeclareFuncOpAdaptor::DeclareFuncOpAdaptor(DeclareFuncOp op) : DeclareFuncOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DeclareFuncOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitError(loc, "'emitc.declare_func' op requires attribute 'sym_name'");
if (tblgen_sym_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_sym_name))))
return emitError(loc, "'emitc.declare_func' op attribute 'sym_name' failed to satisfy constraint: flat symbol reference attribute");
return ::mlir::success();
}
::llvm::LogicalResult DeclareFuncOp::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.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();
}
}
}
return ::mlir::success();
}
::mlir::Attribute DeclareFuncOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.sym_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DeclareFuncOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> DeclareFuncOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "sym_name")
return prop.sym_name;
return std::nullopt;
}
void DeclareFuncOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "sym_name") {
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
return;
}
}
void DeclareFuncOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
}
::llvm::LogicalResult DeclareFuncOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(attr, "sym_name", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult DeclareFuncOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
return ::mlir::failure();
return ::mlir::success();
}
void DeclareFuncOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.sym_name);
}
::llvm::StringRef DeclareFuncOp::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
void DeclareFuncOp::setSymName(::llvm::StringRef attrValue) {
getProperties().sym_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void DeclareFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FlatSymbolRefAttr sym_name) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::FlatSymbolRefAttr sym_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name));
auto __res__ = ::llvm::dyn_cast<DeclareFuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::FlatSymbolRefAttr sym_name) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name));
}
void DeclareFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr sym_name) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
DeclareFuncOp DeclareFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr sym_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name));
auto __res__ = ::llvm::dyn_cast<DeclareFuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr sym_name) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name));
}
void DeclareFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) {
odsState.getOrAddProperties<Properties>().sym_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), sym_name);
}
DeclareFuncOp DeclareFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name));
auto __res__ = ::llvm::dyn_cast<DeclareFuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name));
}
void DeclareFuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
odsState.getOrAddProperties<Properties>().sym_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), sym_name);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
DeclareFuncOp DeclareFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name));
auto __res__ = ::llvm::dyn_cast<DeclareFuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name));
}
void DeclareFuncOp::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()) {
(void)odsState.getOrAddProperties<DeclareFuncOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
DeclareFuncOp DeclareFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<DeclareFuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void DeclareFuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
DeclareFuncOp DeclareFuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<DeclareFuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DeclareFuncOp DeclareFuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult DeclareFuncOp::verifyInvariantsImpl() {
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(*this, tblgen_sym_name, "sym_name")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult DeclareFuncOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult DeclareFuncOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::FlatSymbolRefAttr sym_nameAttr;
if (parser.parseCustomAttributeWithFallback(sym_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (sym_nameAttr) result.getOrAddProperties<DeclareFuncOp::Properties>().sym_name = sym_nameAttr;
{
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 DeclareFuncOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getSymNameAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("sym_name");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::DeclareFuncOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::DeclareFuncOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::DereferenceOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
DereferenceOpGenericAdaptorBase::DereferenceOpGenericAdaptorBase(DereferenceOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
DereferenceOpAdaptor::DereferenceOpAdaptor(DereferenceOp op) : DereferenceOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DereferenceOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult DereferenceOp::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();
}
return ::mlir::success();
}
::mlir::Attribute DereferenceOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DereferenceOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> DereferenceOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void DereferenceOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void DereferenceOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult DereferenceOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void DereferenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pointer) {
odsState.addOperands(pointer);
odsState.addTypes(result);
}
DereferenceOp DereferenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(pointer)>(pointer));
auto __res__ = ::llvm::dyn_cast<DereferenceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DereferenceOp DereferenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(pointer)>(pointer));
}
void DereferenceOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) {
odsState.addOperands(pointer);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
DereferenceOp DereferenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(pointer)>(pointer));
auto __res__ = ::llvm::dyn_cast<DereferenceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DereferenceOp DereferenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(pointer)>(pointer));
}
void DereferenceOp::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);
}
DereferenceOp DereferenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<DereferenceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DereferenceOp DereferenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void DereferenceOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
DereferenceOp DereferenceOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<DereferenceOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DereferenceOp DereferenceOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult DereferenceOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC3(*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_EmitC2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
if (!((std::equal_to<>()(emitc::LValueType::get(::llvm::cast<emitc::PointerType>((*this->getODSOperands(0).begin()).getType()).getPointee()), (*this->getODSResults(0).begin()).getType()))))
return emitOpError("failed to verify that input and result reference the same type");
return ::mlir::success();
}
::llvm::LogicalResult DereferenceOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult DereferenceOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand pointerRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pointerOperands(&pointerRawOperand, 1); ::llvm::SMLoc pointerOperandsLoc;
(void)pointerOperandsLoc;
::mlir::Type pointerRawType{};
::llvm::ArrayRef<::mlir::Type> pointerTypes(&pointerRawType, 1);
pointerOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(pointerRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseType(pointerRawType))
return ::mlir::failure();
{
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();
}
for (::mlir::Type type : pointerTypes) {
(void)type;
if (!((::llvm::isa<::mlir::emitc::PointerType>(type)))) {
return parser.emitError(parser.getNameLoc()) << "'pointer' must be EmitC pointer type, but got " << type;
}
}
result.addTypes(emitc::LValueType::get(::llvm::cast<emitc::PointerType>(pointerTypes[0]).getPointee()));
if (parser.resolveOperands(pointerOperands, pointerTypes, pointerOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void DereferenceOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getPointer();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getPointer().getType();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::DereferenceOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::DivOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
DivOpGenericAdaptorBase::DivOpGenericAdaptorBase(DivOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
DivOpAdaptor::DivOpAdaptor(DivOp op) : DivOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DivOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult DivOp::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();
}
return ::mlir::success();
}
::mlir::Attribute DivOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DivOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> DivOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void DivOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void DivOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult DivOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
odsState.addOperands(odsArg_0);
odsState.addOperands(odsArg_1);
odsState.addTypes(resultType0);
}
DivOp DivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
auto __res__ = ::llvm::dyn_cast<DivOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DivOp DivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
}
void DivOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
odsState.addOperands(odsArg_0);
odsState.addOperands(odsArg_1);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
DivOp DivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
auto __res__ = ::llvm::dyn_cast<DivOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DivOp DivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
}
void DivOp::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);
}
DivOp DivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<DivOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DivOp DivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void DivOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
DivOp DivOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<DivOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DivOp DivOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult DivOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC7(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC7(*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_EmitC7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult DivOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult DivOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void DivOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::DivOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::DoOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
DoOpGenericAdaptorBase::DoOpGenericAdaptorBase(DoOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
DoOpAdaptor::DoOpAdaptor(DoOp op) : DoOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult DoOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult DoOp::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();
}
return ::mlir::success();
}
::mlir::Attribute DoOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code DoOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> DoOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void DoOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void DoOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult DoOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void DoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
(void)odsState.addRegion();
(void)odsState.addRegion();
}
DoOp DoOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__);
auto __res__ = ::llvm::dyn_cast<DoOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DoOp DoOp::create(::mlir::ImplicitLocOpBuilder &builder) {
return create(builder, builder.getLoc());
}
void DoOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
(void)odsState.addRegion();
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
DoOp DoOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes));
auto __res__ = ::llvm::dyn_cast<DoOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DoOp DoOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
}
void DoOp::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 != 2; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
DoOp DoOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<DoOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DoOp DoOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void DoOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
for (unsigned i = 0; i != 2; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
DoOp DoOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<DoOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
DoOp DoOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult DoOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "bodyRegion", index++)))
return ::mlir::failure();
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(1)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "conditionRegion", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult DoOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::llvm::LogicalResult DoOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::DoOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::ExpressionOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ExpressionOpGenericAdaptorBase::ExpressionOpGenericAdaptorBase(ExpressionOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> ExpressionOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::UnitAttr ExpressionOpGenericAdaptorBase::getDoNotInlineAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().do_not_inline);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool ExpressionOpGenericAdaptorBase::getDoNotInline() {
auto attr = getDoNotInlineAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
} // namespace detail
ExpressionOpAdaptor::ExpressionOpAdaptor(ExpressionOp op) : ExpressionOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ExpressionOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_do_not_inline = getProperties().do_not_inline; (void)tblgen_do_not_inline;
if (tblgen_do_not_inline && !((::llvm::isa<::mlir::UnitAttr>(tblgen_do_not_inline))))
return emitError(loc, "'emitc.expression' op attribute 'do_not_inline' failed to satisfy constraint: unit attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> ExpressionOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange ExpressionOp::getDefsMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
::llvm::LogicalResult ExpressionOp::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.do_not_inline;
auto attr = dict.get("do_not_inline");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `do_not_inline` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute ExpressionOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.do_not_inline;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("do_not_inline",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ExpressionOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.do_not_inline.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> ExpressionOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "do_not_inline")
return prop.do_not_inline;
return std::nullopt;
}
void ExpressionOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "do_not_inline") {
prop.do_not_inline = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.do_not_inline)>>(value);
return;
}
}
void ExpressionOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.do_not_inline) attrs.append("do_not_inline", prop.do_not_inline);
}
::llvm::LogicalResult ExpressionOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getDoNotInlineAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "do_not_inline", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ExpressionOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.do_not_inline)))
return ::mlir::failure();
return ::mlir::success();
}
void ExpressionOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.do_not_inline);
}
bool ExpressionOp::getDoNotInline() {
auto attr = getDoNotInlineAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
void ExpressionOp::setDoNotInline(bool attrValue) {
auto &odsProp = getProperties().do_not_inline;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void ExpressionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline) {
odsState.addOperands(defs);
if (do_not_inline) {
odsState.getOrAddProperties<Properties>().do_not_inline = do_not_inline;
}
(void)odsState.addRegion();
odsState.addTypes(result);
}
ExpressionOp ExpressionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
auto __res__ = ::llvm::dyn_cast<ExpressionOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ExpressionOp ExpressionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
}
void ExpressionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline) {
odsState.addOperands(defs);
if (do_not_inline) {
odsState.getOrAddProperties<Properties>().do_not_inline = do_not_inline;
}
(void)odsState.addRegion();
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ExpressionOp ExpressionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
auto __res__ = ::llvm::dyn_cast<ExpressionOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ExpressionOp ExpressionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
}
void ExpressionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/bool do_not_inline) {
odsState.addOperands(defs);
if (do_not_inline) {
odsState.getOrAddProperties<Properties>().do_not_inline = ((do_not_inline) ? odsBuilder.getUnitAttr() : nullptr);
}
(void)odsState.addRegion();
odsState.addTypes(result);
}
ExpressionOp ExpressionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/bool do_not_inline) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
auto __res__ = ::llvm::dyn_cast<ExpressionOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ExpressionOp ExpressionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/bool do_not_inline) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
}
void ExpressionOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/bool do_not_inline) {
odsState.addOperands(defs);
if (do_not_inline) {
odsState.getOrAddProperties<Properties>().do_not_inline = ((do_not_inline) ? odsBuilder.getUnitAttr() : nullptr);
}
(void)odsState.addRegion();
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ExpressionOp ExpressionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/bool do_not_inline) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
auto __res__ = ::llvm::dyn_cast<ExpressionOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ExpressionOp ExpressionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/bool do_not_inline) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(defs)>(defs), std::forward<decltype(do_not_inline)>(do_not_inline));
}
void ExpressionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
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);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<ExpressionOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
ExpressionOp ExpressionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ExpressionOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ExpressionOp ExpressionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ExpressionOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ExpressionOp ExpressionOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ExpressionOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ExpressionOp ExpressionOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ExpressionOp::verifyInvariantsImpl() {
auto tblgen_do_not_inline = getProperties().do_not_inline; (void)tblgen_do_not_inline;
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_do_not_inline, "do_not_inline")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC5(*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_EmitC8(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "region", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ExpressionOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::llvm::LogicalResult ExpressionOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.do_not_inline;
auto do_not_inlineAttrName = ::mlir::StringAttr::get(ctx, "do_not_inline");
auto attr = dict.get(do_not_inlineAttrName);
usedKeys.insert(do_not_inlineAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for do_not_inline in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `do_not_inline` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::ExpressionOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::ExpressionOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::FieldOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
FieldOpGenericAdaptorBase::FieldOpGenericAdaptorBase(FieldOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef FieldOpGenericAdaptorBase::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::Type FieldOpGenericAdaptorBase::getType() {
auto attr = getTypeAttr();
return ::llvm::cast<::mlir::Type>(attr.getValue());
}
::std::optional<::mlir::Attribute> FieldOpGenericAdaptorBase::getInitialValue() {
auto attr = getInitialValueAttr();
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
}
} // namespace detail
FieldOpAdaptor::FieldOpAdaptor(FieldOp op) : FieldOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FieldOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitError(loc, "'emitc.field' op requires attribute 'sym_name'");
auto tblgen_type = getProperties().type; (void)tblgen_type;
if (!tblgen_type) return emitError(loc, "'emitc.field' op requires attribute 'type'");
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
return emitError(loc, "'emitc.field' op attribute 'sym_name' failed to satisfy constraint: string attribute");
if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true))))
return emitError(loc, "'emitc.field' op attribute 'type' failed to satisfy constraint: any type attribute");
if (tblgen_initial_value && !(((::llvm::isa<::mlir::emitc::OpaqueAttr>(tblgen_initial_value))) || ((::llvm::isa<::mlir::TypedAttr>(tblgen_initial_value)))))
return emitError(loc, "'emitc.field' op attribute 'initial_value' failed to satisfy constraint: An opaque attribute or TypedAttr instance");
return ::mlir::success();
}
::llvm::LogicalResult FieldOp::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.initial_value;
auto attr = dict.get("initial_value");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `initial_value` 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.type;
auto attr = dict.get("type");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `type` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute FieldOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.initial_value;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("initial_value",
propStorage));
}
{
const auto &propStorage = prop.sym_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
propStorage));
}
{
const auto &propStorage = prop.type;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("type",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FieldOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.initial_value.getAsOpaquePointer()),
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
llvm::hash_value(prop.type.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> FieldOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "initial_value")
return prop.initial_value;
if (name == "sym_name")
return prop.sym_name;
if (name == "type")
return prop.type;
return std::nullopt;
}
void FieldOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "initial_value") {
prop.initial_value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.initial_value)>>(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 == "type") {
prop.type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.type)>>(value);
return;
}
}
void FieldOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.initial_value) attrs.append("initial_value", prop.initial_value);
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
if (prop.type) attrs.append("type", prop.type);
}
::llvm::LogicalResult FieldOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getInitialValueAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(attr, "initial_value", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "sym_name", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getTypeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC9(attr, "type", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FieldOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.initial_value)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.type)))
return ::mlir::failure();
return ::mlir::success();
}
void FieldOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.initial_value);
writer.writeAttribute(prop.sym_name);
writer.writeAttribute(prop.type);
}
::llvm::StringRef FieldOp::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::Type FieldOp::getType() {
auto attr = getTypeAttr();
return ::llvm::cast<::mlir::Type>(attr.getValue());
}
::std::optional<::mlir::Attribute> FieldOp::getInitialValue() {
auto attr = getInitialValueAttr();
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
}
void FieldOp::setSymName(::llvm::StringRef attrValue) {
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void FieldOp::setType(::mlir::Type attrValue) {
getProperties().type = ::mlir::TypeAttr::get(attrValue);
}
void FieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().type = type;
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
}
FieldOp FieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
auto __res__ = ::llvm::dyn_cast<FieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FieldOp FieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
}
void FieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().type = type;
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
FieldOp FieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
auto __res__ = ::llvm::dyn_cast<FieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FieldOp FieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
}
void FieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().type = ::mlir::TypeAttr::get(type);
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
}
FieldOp FieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
auto __res__ = ::llvm::dyn_cast<FieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FieldOp FieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
}
void FieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().type = ::mlir::TypeAttr::get(type);
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
FieldOp FieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
auto __res__ = ::llvm::dyn_cast<FieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FieldOp FieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value));
}
void FieldOp::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()) {
(void)odsState.getOrAddProperties<FieldOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
FieldOp FieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<FieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FieldOp FieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void FieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
FieldOp FieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<FieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FieldOp FieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult FieldOp::verifyInvariantsImpl() {
auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
auto tblgen_type = getProperties().type; (void)tblgen_type;
if (!tblgen_type) return emitOpError("requires attribute 'type'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_sym_name, "sym_name")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC9(*this, tblgen_type, "type")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(*this, tblgen_initial_value, "initial_value")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult FieldOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult FieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::StringAttr sym_nameAttr;
::mlir::TypeAttr typeAttr;
::mlir::Attribute initial_valueAttr;
if (parser.parseSymbolName(sym_nameAttr))
return ::mlir::failure();
if (sym_nameAttr) result.getOrAddProperties<FieldOp::Properties>().sym_name = sym_nameAttr;
if (parser.parseColon())
return ::mlir::failure();
{
auto odsResult = parseEmitCFieldOpTypeAndInitialValue(parser, typeAttr, initial_valueAttr);
if (odsResult) return ::mlir::failure();
result.getOrAddProperties<FieldOp::Properties>().type = typeAttr;
if (initial_valueAttr)
result.getOrAddProperties<FieldOp::Properties>().initial_value = initial_valueAttr;
}
{
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 FieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printSymbolName(getSymNameAttr().getValue());
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
printEmitCFieldOpTypeAndInitialValue(_odsPrinter, *this, getTypeAttr(), getInitialValueAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("sym_name");
elidedAttrs.push_back("type");
elidedAttrs.push_back("initial_value");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::FieldOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::FieldOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::FileOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
FileOpGenericAdaptorBase::FileOpGenericAdaptorBase(FileOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::StringAttr FileOpGenericAdaptorBase::getId() {
auto attr = getIdAttr();
return ::llvm::cast<::mlir::StringAttr>(attr);
}
} // namespace detail
FileOpAdaptor::FileOpAdaptor(FileOp op) : FileOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FileOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_id = getProperties().id; (void)tblgen_id;
if (!tblgen_id) return emitError(loc, "'emitc.file' op requires attribute 'id'");
if (tblgen_id && !((::llvm::isa<::mlir::StringAttr>(tblgen_id))))
return emitError(loc, "'emitc.file' op attribute 'id' failed to satisfy constraint: An Attribute containing a string");
return ::mlir::success();
}
::llvm::LogicalResult FileOp::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.id;
auto attr = dict.get("id");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `id` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute FileOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.id;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("id",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FileOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.id.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> FileOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "id")
return prop.id;
return std::nullopt;
}
void FileOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "id") {
prop.id = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.id)>>(value);
return;
}
}
void FileOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.id) attrs.append("id", prop.id);
}
::llvm::LogicalResult FileOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getIdAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC10(attr, "id", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FileOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.id)))
return ::mlir::failure();
return ::mlir::success();
}
void FileOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.id);
}
::mlir::StringAttr FileOp::getId() {
auto attr = getIdAttr();
return ::llvm::cast<::mlir::StringAttr>(attr);
}
FileOp FileOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef id) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(id)>(id));
auto __res__ = ::llvm::dyn_cast<FileOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FileOp FileOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef id) {
return create(builder, builder.getLoc(), std::forward<decltype(id)>(id));
}
::llvm::LogicalResult FileOp::verifyInvariantsImpl() {
auto tblgen_id = getProperties().id; (void)tblgen_id;
if (!tblgen_id) return emitOpError("requires attribute 'id'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC10(*this, tblgen_id, "id")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "bodyRegion", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FileOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult FileOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::StringAttr idAttr;
std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>();
if (parser.parseCustomAttributeWithFallback(idAttr, ::mlir::Type{})) {
return ::mlir::failure();
}
if (idAttr) result.getOrAddProperties<FileOp::Properties>().id = idAttr;
{
auto loc = parser.getCurrentLocation();(void)loc;
if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
return ::mlir::failure();
if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
})))
return ::mlir::failure();
}
if (parser.parseRegion(*bodyRegionRegion))
return ::mlir::failure();
if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock();
result.addRegion(std::move(bodyRegionRegion));
return ::mlir::success();
}
void FileOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printStrippedAttrOrType(getIdAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("id");
_odsPrinter.printOptionalAttrDictWithKeyword((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ';
_odsPrinter.printRegion(getBodyRegion());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::FileOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::FileOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::ForOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ForOpGenericAdaptorBase::ForOpGenericAdaptorBase(ForOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
ForOpAdaptor::ForOpAdaptor(ForOp op) : ForOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ForOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult ForOp::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();
}
return ::mlir::success();
}
::mlir::Attribute ForOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ForOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> ForOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void ForOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void ForOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult ForOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
ForOp ForOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value lowerBound, Value upperBound, Value step, function_ref<void(OpBuilder &, Location, Value)> odsArg3) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(lowerBound)>(lowerBound), std::forward<decltype(upperBound)>(upperBound), std::forward<decltype(step)>(step), std::forward<decltype(odsArg3)>(odsArg3));
auto __res__ = ::llvm::dyn_cast<ForOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ForOp ForOp::create(::mlir::ImplicitLocOpBuilder &builder, Value lowerBound, Value upperBound, Value step, function_ref<void(OpBuilder &, Location, Value)> odsArg3) {
return create(builder, builder.getLoc(), std::forward<decltype(lowerBound)>(lowerBound), std::forward<decltype(upperBound)>(upperBound), std::forward<decltype(step)>(step), std::forward<decltype(odsArg3)>(odsArg3));
}
::llvm::LogicalResult ForOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC9(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC9(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup2 = getODSOperands(2);
for (auto v : valueGroup2) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC9(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(2).begin()).getType()) && ((*this->getODSOperands(2).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()))))
return emitOpError("failed to verify that all of {lowerBound, upperBound, step} have same type");
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "region", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult ForOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult ForOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::ForOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::FuncOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
FuncOpGenericAdaptorBase::FuncOpGenericAdaptorBase(FuncOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef FuncOpGenericAdaptorBase::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::FunctionType FuncOpGenericAdaptorBase::getFunctionType() {
auto attr = getFunctionTypeAttr();
return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
}
::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getSpecifiers() {
auto attr = getSpecifiersAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getArgAttrs() {
auto attr = getArgAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > FuncOpGenericAdaptorBase::getResAttrs() {
auto attr = getResAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
} // namespace detail
FuncOpAdaptor::FuncOpAdaptor(FuncOp op) : FuncOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult FuncOpAdaptor::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, "'emitc.func' op requires attribute 'function_type'");
auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
auto tblgen_specifiers = getProperties().specifiers; (void)tblgen_specifiers;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitError(loc, "'emitc.func' op requires attribute 'sym_name'");
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
return emitError(loc, "'emitc.func' 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, "'emitc.func' op attribute 'function_type' failed to satisfy constraint: type attribute of function type");
if (tblgen_specifiers && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_specifiers))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_specifiers), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
return emitError(loc, "'emitc.func' op attribute 'specifiers' failed to satisfy constraint: string array attribute");
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, "'emitc.func' 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, "'emitc.func' op attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
return ::mlir::success();
}
::llvm::LogicalResult FuncOp::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.specifiers;
auto attr = dict.get("specifiers");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `specifiers` 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();
}
}
}
return ::mlir::success();
}
::mlir::Attribute FuncOp::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.specifiers;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("specifiers",
propStorage));
}
{
const auto &propStorage = prop.sym_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code FuncOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
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.specifiers.getAsOpaquePointer()),
llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> FuncOp::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 == "specifiers")
return prop.specifiers;
if (name == "sym_name")
return prop.sym_name;
return std::nullopt;
}
void FuncOp::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 == "specifiers") {
prop.specifiers = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.specifiers)>>(value);
return;
}
if (name == "sym_name") {
prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
return;
}
}
void FuncOp::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.specifiers) attrs.append("specifiers", prop.specifiers);
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
}
::llvm::LogicalResult FuncOp::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_EmitC2(attr, "arg_attrs", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC11(attr, "function_type", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC2(attr, "res_attrs", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSpecifiersAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC12(attr, "specifiers", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "sym_name", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FuncOp::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.readOptionalAttribute(prop.specifiers)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
return ::mlir::failure();
return ::mlir::success();
}
void FuncOp::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.writeOptionalAttribute(prop.specifiers);
writer.writeAttribute(prop.sym_name);
}
::llvm::StringRef FuncOp::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::FunctionType FuncOp::getFunctionType() {
auto attr = getFunctionTypeAttr();
return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
}
::std::optional< ::mlir::ArrayAttr > FuncOp::getSpecifiers() {
auto attr = getSpecifiersAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > FuncOp::getArgAttrs() {
auto attr = getArgAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > FuncOp::getResAttrs() {
auto attr = getResAttrsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
void FuncOp::setSymName(::llvm::StringRef attrValue) {
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void FuncOp::setFunctionType(::mlir::FunctionType attrValue) {
getProperties().function_type = ::mlir::TypeAttr::get(attrValue);
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, FunctionType type, ArrayRef<NamedAttribute> attrs, ArrayRef<DictionaryAttr> argAttrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(type)>(type), std::forward<decltype(attrs)>(attrs), std::forward<decltype(argAttrs)>(argAttrs));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, FunctionType type, ArrayRef<NamedAttribute> attrs, ArrayRef<DictionaryAttr> argAttrs) {
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(type)>(type), std::forward<decltype(attrs)>(attrs), std::forward<decltype(argAttrs)>(argAttrs));
}
void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().function_type = function_type;
if (specifiers) {
odsState.getOrAddProperties<Properties>().specifiers = specifiers;
}
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
(void)odsState.addRegion();
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
}
void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().function_type = function_type;
if (specifiers) {
odsState.getOrAddProperties<Properties>().specifiers = specifiers;
}
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
}
void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
if (specifiers) {
odsState.getOrAddProperties<Properties>().specifiers = specifiers;
}
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
(void)odsState.addRegion();
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
}
void FuncOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
if (specifiers) {
odsState.getOrAddProperties<Properties>().specifiers = specifiers;
}
if (arg_attrs) {
odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
}
if (res_attrs) {
odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
}
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(function_type)>(function_type), std::forward<decltype(specifiers)>(specifiers), std::forward<decltype(arg_attrs)>(arg_attrs), std::forward<decltype(res_attrs)>(res_attrs));
}
void FuncOp::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()) {
(void)odsState.getOrAddProperties<FuncOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void FuncOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
for (unsigned i = 0; i != 1; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
FuncOp FuncOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<FuncOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
FuncOp FuncOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult FuncOp::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_specifiers = getProperties().specifiers; (void)tblgen_specifiers;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_sym_name, "sym_name")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC11(*this, tblgen_function_type, "function_type")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC12(*this, tblgen_specifiers, "specifiers")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC2(*this, tblgen_arg_attrs, "arg_attrs")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC2(*this, tblgen_res_attrs, "res_attrs")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC1(*this, region, "body", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult FuncOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::llvm::LogicalResult FuncOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.sym_name;
auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name");
auto attr = dict.get(sym_nameAttrName);
usedKeys.insert(sym_nameAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for sym_name in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
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.function_type;
auto function_typeAttrName = ::mlir::StringAttr::get(ctx, "function_type");
auto attr = dict.get(function_typeAttrName);
usedKeys.insert(function_typeAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for function_type in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
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.specifiers;
auto specifiersAttrName = ::mlir::StringAttr::get(ctx, "specifiers");
auto attr = dict.get(specifiersAttrName);
usedKeys.insert(specifiersAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for specifiers in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `specifiers` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.arg_attrs;
auto arg_attrsAttrName = ::mlir::StringAttr::get(ctx, "arg_attrs");
auto attr = dict.get(arg_attrsAttrName);
usedKeys.insert(arg_attrsAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for arg_attrs in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
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.res_attrs;
auto res_attrsAttrName = ::mlir::StringAttr::get(ctx, "res_attrs");
auto attr = dict.get(res_attrsAttrName);
usedKeys.insert(res_attrsAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for res_attrs in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
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();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::FuncOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::FuncOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::GetFieldOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
GetFieldOpGenericAdaptorBase::GetFieldOpGenericAdaptorBase(GetFieldOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef GetFieldOpGenericAdaptorBase::getFieldName() {
auto attr = getFieldNameAttr();
return attr.getValue();
}
} // namespace detail
GetFieldOpAdaptor::GetFieldOpAdaptor(GetFieldOp op) : GetFieldOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult GetFieldOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
if (!tblgen_field_name) return emitError(loc, "'emitc.get_field' op requires attribute 'field_name'");
if (tblgen_field_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_field_name))))
return emitError(loc, "'emitc.get_field' op attribute 'field_name' failed to satisfy constraint: flat symbol reference attribute");
return ::mlir::success();
}
::llvm::LogicalResult GetFieldOp::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.field_name;
auto attr = dict.get("field_name");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `field_name` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute GetFieldOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.field_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("field_name",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code GetFieldOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.field_name.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> GetFieldOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "field_name")
return prop.field_name;
return std::nullopt;
}
void GetFieldOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "field_name") {
prop.field_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.field_name)>>(value);
return;
}
}
void GetFieldOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.field_name) attrs.append("field_name", prop.field_name);
}
::llvm::LogicalResult GetFieldOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getFieldNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(attr, "field_name", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult GetFieldOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.field_name)))
return ::mlir::failure();
return ::mlir::success();
}
void GetFieldOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.field_name);
}
::llvm::StringRef GetFieldOp::getFieldName() {
auto attr = getFieldNameAttr();
return attr.getValue();
}
void GetFieldOp::setFieldName(::llvm::StringRef attrValue) {
getProperties().field_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void GetFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr field_name) {
odsState.getOrAddProperties<Properties>().field_name = field_name;
odsState.addTypes(result);
}
GetFieldOp GetFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::FlatSymbolRefAttr field_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(field_name)>(field_name));
auto __res__ = ::llvm::dyn_cast<GetFieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetFieldOp GetFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::FlatSymbolRefAttr field_name) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(field_name)>(field_name));
}
void GetFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr field_name) {
odsState.getOrAddProperties<Properties>().field_name = field_name;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
GetFieldOp GetFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr field_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(field_name)>(field_name));
auto __res__ = ::llvm::dyn_cast<GetFieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetFieldOp GetFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr field_name) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(field_name)>(field_name));
}
void GetFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef field_name) {
odsState.getOrAddProperties<Properties>().field_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), field_name);
odsState.addTypes(result);
}
GetFieldOp GetFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef field_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(field_name)>(field_name));
auto __res__ = ::llvm::dyn_cast<GetFieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetFieldOp GetFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef field_name) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(field_name)>(field_name));
}
void GetFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef field_name) {
odsState.getOrAddProperties<Properties>().field_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), field_name);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
GetFieldOp GetFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef field_name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(field_name)>(field_name));
auto __res__ = ::llvm::dyn_cast<GetFieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetFieldOp GetFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef field_name) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(field_name)>(field_name));
}
void GetFieldOp::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()) {
(void)odsState.getOrAddProperties<GetFieldOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
GetFieldOp GetFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<GetFieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetFieldOp GetFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void GetFieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
GetFieldOp GetFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<GetFieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetFieldOp GetFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult GetFieldOp::verifyInvariantsImpl() {
auto tblgen_field_name = getProperties().field_name; (void)tblgen_field_name;
if (!tblgen_field_name) return emitOpError("requires attribute 'field_name'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(*this, tblgen_field_name, "field_name")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult GetFieldOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult GetFieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::FlatSymbolRefAttr field_nameAttr;
::mlir::Type resultRawType{};
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
if (parser.parseCustomAttributeWithFallback(field_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (field_nameAttr) result.getOrAddProperties<GetFieldOp::Properties>().field_name = field_nameAttr;
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
resultRawType = type;
}
{
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();
}
result.addTypes(resultTypes);
return ::mlir::success();
}
void GetFieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getFieldNameAttr());
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getResult().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("field_name");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
void GetFieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::GetFieldOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::GetFieldOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::GetGlobalOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
GetGlobalOpGenericAdaptorBase::GetGlobalOpGenericAdaptorBase(GetGlobalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef GetGlobalOpGenericAdaptorBase::getName() {
auto attr = getNameAttr();
return attr.getValue();
}
} // namespace detail
GetGlobalOpAdaptor::GetGlobalOpAdaptor(GetGlobalOp op) : GetGlobalOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult GetGlobalOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_name = getProperties().name; (void)tblgen_name;
if (!tblgen_name) return emitError(loc, "'emitc.get_global' op requires attribute 'name'");
if (tblgen_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_name))))
return emitError(loc, "'emitc.get_global' op attribute 'name' failed to satisfy constraint: flat symbol reference attribute");
return ::mlir::success();
}
::llvm::LogicalResult GetGlobalOp::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.name;
auto attr = dict.get("name");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `name` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute GetGlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("name",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code GetGlobalOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.name.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> GetGlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "name")
return prop.name;
return std::nullopt;
}
void GetGlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "name") {
prop.name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.name)>>(value);
return;
}
}
void GetGlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.name) attrs.append("name", prop.name);
}
::llvm::LogicalResult GetGlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(attr, "name", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult GetGlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.name)))
return ::mlir::failure();
return ::mlir::success();
}
void GetGlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.name);
}
::llvm::StringRef GetGlobalOp::getName() {
auto attr = getNameAttr();
return attr.getValue();
}
void GetGlobalOp::setName(::llvm::StringRef attrValue) {
getProperties().name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
}
void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name) {
odsState.getOrAddProperties<Properties>().name = name;
odsState.addTypes(result);
}
GetGlobalOp GetGlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(name)>(name));
auto __res__ = ::llvm::dyn_cast<GetGlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetGlobalOp GetGlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(name)>(name));
}
void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name) {
odsState.getOrAddProperties<Properties>().name = name;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
GetGlobalOp GetGlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(name)>(name));
auto __res__ = ::llvm::dyn_cast<GetGlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetGlobalOp GetGlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(name)>(name));
}
void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef name) {
odsState.getOrAddProperties<Properties>().name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), name);
odsState.addTypes(result);
}
GetGlobalOp GetGlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(name)>(name));
auto __res__ = ::llvm::dyn_cast<GetGlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetGlobalOp GetGlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef name) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(name)>(name));
}
void GetGlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name) {
odsState.getOrAddProperties<Properties>().name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), name);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
GetGlobalOp GetGlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef name) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(name)>(name));
auto __res__ = ::llvm::dyn_cast<GetGlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetGlobalOp GetGlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef name) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(name)>(name));
}
void GetGlobalOp::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()) {
(void)odsState.getOrAddProperties<GetGlobalOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
GetGlobalOp GetGlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<GetGlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetGlobalOp GetGlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void GetGlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
GetGlobalOp GetGlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<GetGlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GetGlobalOp GetGlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult GetGlobalOp::verifyInvariantsImpl() {
auto tblgen_name = getProperties().name; (void)tblgen_name;
if (!tblgen_name) return emitOpError("requires attribute 'name'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC1(*this, tblgen_name, "name")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC10(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult GetGlobalOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult GetGlobalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::FlatSymbolRefAttr nameAttr;
::mlir::Type resultRawType{};
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
if (parser.parseCustomAttributeWithFallback(nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (nameAttr) result.getOrAddProperties<GetGlobalOp::Properties>().name = nameAttr;
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
resultRawType = type;
}
{
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();
}
result.addTypes(resultTypes);
return ::mlir::success();
}
void GetGlobalOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getNameAttr());
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getResult().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("name");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
void GetGlobalOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::GetGlobalOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::GetGlobalOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::GlobalOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
GlobalOpGenericAdaptorBase::GlobalOpGenericAdaptorBase(GlobalOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef GlobalOpGenericAdaptorBase::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::Type GlobalOpGenericAdaptorBase::getType() {
auto attr = getTypeAttr();
return ::llvm::cast<::mlir::Type>(attr.getValue());
}
::std::optional<::mlir::Attribute> GlobalOpGenericAdaptorBase::getInitialValue() {
auto attr = getInitialValueAttr();
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
}
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getExternSpecifierAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().extern_specifier);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool GlobalOpGenericAdaptorBase::getExternSpecifier() {
auto attr = getExternSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getStaticSpecifierAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().static_specifier);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool GlobalOpGenericAdaptorBase::getStaticSpecifier() {
auto attr = getStaticSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
::mlir::UnitAttr GlobalOpGenericAdaptorBase::getConstSpecifierAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().const_specifier);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool GlobalOpGenericAdaptorBase::getConstSpecifier() {
auto attr = getConstSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
} // namespace detail
GlobalOpAdaptor::GlobalOpAdaptor(GlobalOp op) : GlobalOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult GlobalOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_const_specifier = getProperties().const_specifier; (void)tblgen_const_specifier;
auto tblgen_extern_specifier = getProperties().extern_specifier; (void)tblgen_extern_specifier;
auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
auto tblgen_static_specifier = getProperties().static_specifier; (void)tblgen_static_specifier;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitError(loc, "'emitc.global' op requires attribute 'sym_name'");
auto tblgen_type = getProperties().type; (void)tblgen_type;
if (!tblgen_type) return emitError(loc, "'emitc.global' op requires attribute 'type'");
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
return emitError(loc, "'emitc.global' op attribute 'sym_name' failed to satisfy constraint: string attribute");
if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((true))))
return emitError(loc, "'emitc.global' op attribute 'type' failed to satisfy constraint: any type attribute");
if (tblgen_initial_value && !(((::llvm::isa<::mlir::emitc::OpaqueAttr>(tblgen_initial_value))) || ((::llvm::isa<::mlir::TypedAttr>(tblgen_initial_value)))))
return emitError(loc, "'emitc.global' op attribute 'initial_value' failed to satisfy constraint: An opaque attribute or TypedAttr instance");
if (tblgen_extern_specifier && !((::llvm::isa<::mlir::UnitAttr>(tblgen_extern_specifier))))
return emitError(loc, "'emitc.global' op attribute 'extern_specifier' failed to satisfy constraint: unit attribute");
if (tblgen_static_specifier && !((::llvm::isa<::mlir::UnitAttr>(tblgen_static_specifier))))
return emitError(loc, "'emitc.global' op attribute 'static_specifier' failed to satisfy constraint: unit attribute");
if (tblgen_const_specifier && !((::llvm::isa<::mlir::UnitAttr>(tblgen_const_specifier))))
return emitError(loc, "'emitc.global' op attribute 'const_specifier' failed to satisfy constraint: unit attribute");
return ::mlir::success();
}
::llvm::LogicalResult GlobalOp::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.const_specifier;
auto attr = dict.get("const_specifier");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `const_specifier` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.extern_specifier;
auto attr = dict.get("extern_specifier");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `extern_specifier` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.initial_value;
auto attr = dict.get("initial_value");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `initial_value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.static_specifier;
auto attr = dict.get("static_specifier");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `static_specifier` 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.type;
auto attr = dict.get("type");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `type` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute GlobalOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.const_specifier;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("const_specifier",
propStorage));
}
{
const auto &propStorage = prop.extern_specifier;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("extern_specifier",
propStorage));
}
{
const auto &propStorage = prop.initial_value;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("initial_value",
propStorage));
}
{
const auto &propStorage = prop.static_specifier;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("static_specifier",
propStorage));
}
{
const auto &propStorage = prop.sym_name;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("sym_name",
propStorage));
}
{
const auto &propStorage = prop.type;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("type",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code GlobalOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.const_specifier.getAsOpaquePointer()),
llvm::hash_value(prop.extern_specifier.getAsOpaquePointer()),
llvm::hash_value(prop.initial_value.getAsOpaquePointer()),
llvm::hash_value(prop.static_specifier.getAsOpaquePointer()),
llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
llvm::hash_value(prop.type.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> GlobalOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "const_specifier")
return prop.const_specifier;
if (name == "extern_specifier")
return prop.extern_specifier;
if (name == "initial_value")
return prop.initial_value;
if (name == "static_specifier")
return prop.static_specifier;
if (name == "sym_name")
return prop.sym_name;
if (name == "type")
return prop.type;
return std::nullopt;
}
void GlobalOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "const_specifier") {
prop.const_specifier = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.const_specifier)>>(value);
return;
}
if (name == "extern_specifier") {
prop.extern_specifier = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.extern_specifier)>>(value);
return;
}
if (name == "initial_value") {
prop.initial_value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.initial_value)>>(value);
return;
}
if (name == "static_specifier") {
prop.static_specifier = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.static_specifier)>>(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 == "type") {
prop.type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.type)>>(value);
return;
}
}
void GlobalOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.const_specifier) attrs.append("const_specifier", prop.const_specifier);
if (prop.extern_specifier) attrs.append("extern_specifier", prop.extern_specifier);
if (prop.initial_value) attrs.append("initial_value", prop.initial_value);
if (prop.static_specifier) attrs.append("static_specifier", prop.static_specifier);
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
if (prop.type) attrs.append("type", prop.type);
}
::llvm::LogicalResult GlobalOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getConstSpecifierAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "const_specifier", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getExternSpecifierAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "extern_specifier", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getInitialValueAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(attr, "initial_value", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getStaticSpecifierAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "static_specifier", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "sym_name", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getTypeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC9(attr, "type", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult GlobalOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.const_specifier)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.extern_specifier)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.initial_value)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.static_specifier)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.type)))
return ::mlir::failure();
return ::mlir::success();
}
void GlobalOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.const_specifier);
writer.writeOptionalAttribute(prop.extern_specifier);
writer.writeOptionalAttribute(prop.initial_value);
writer.writeOptionalAttribute(prop.static_specifier);
writer.writeAttribute(prop.sym_name);
writer.writeAttribute(prop.type);
}
::llvm::StringRef GlobalOp::getSymName() {
auto attr = getSymNameAttr();
return attr.getValue();
}
::mlir::Type GlobalOp::getType() {
auto attr = getTypeAttr();
return ::llvm::cast<::mlir::Type>(attr.getValue());
}
::std::optional<::mlir::Attribute> GlobalOp::getInitialValue() {
auto attr = getInitialValueAttr();
return attr ? ::std::optional<::mlir::Attribute>(attr) : (::std::nullopt);
}
bool GlobalOp::getExternSpecifier() {
auto attr = getExternSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
bool GlobalOp::getStaticSpecifier() {
auto attr = getStaticSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
bool GlobalOp::getConstSpecifier() {
auto attr = getConstSpecifierAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
void GlobalOp::setSymName(::llvm::StringRef attrValue) {
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void GlobalOp::setType(::mlir::Type attrValue) {
getProperties().type = ::mlir::TypeAttr::get(attrValue);
}
void GlobalOp::setExternSpecifier(bool attrValue) {
auto &odsProp = getProperties().extern_specifier;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void GlobalOp::setStaticSpecifier(bool attrValue) {
auto &odsProp = getProperties().static_specifier;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void GlobalOp::setConstSpecifier(bool attrValue) {
auto &odsProp = getProperties().const_specifier;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier, /*optional*/::mlir::UnitAttr static_specifier, /*optional*/::mlir::UnitAttr const_specifier) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().type = type;
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
if (extern_specifier) {
odsState.getOrAddProperties<Properties>().extern_specifier = extern_specifier;
}
if (static_specifier) {
odsState.getOrAddProperties<Properties>().static_specifier = static_specifier;
}
if (const_specifier) {
odsState.getOrAddProperties<Properties>().const_specifier = const_specifier;
}
}
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier, /*optional*/::mlir::UnitAttr static_specifier, /*optional*/::mlir::UnitAttr const_specifier) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier, /*optional*/::mlir::UnitAttr static_specifier, /*optional*/::mlir::UnitAttr const_specifier) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
}
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier, /*optional*/::mlir::UnitAttr static_specifier, /*optional*/::mlir::UnitAttr const_specifier) {
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
odsState.getOrAddProperties<Properties>().type = type;
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
if (extern_specifier) {
odsState.getOrAddProperties<Properties>().extern_specifier = extern_specifier;
}
if (static_specifier) {
odsState.getOrAddProperties<Properties>().static_specifier = static_specifier;
}
if (const_specifier) {
odsState.getOrAddProperties<Properties>().const_specifier = const_specifier;
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier, /*optional*/::mlir::UnitAttr static_specifier, /*optional*/::mlir::UnitAttr const_specifier) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier, /*optional*/::mlir::UnitAttr static_specifier, /*optional*/::mlir::UnitAttr const_specifier) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
}
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier, /*optional*/bool static_specifier, /*optional*/bool const_specifier) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().type = ::mlir::TypeAttr::get(type);
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
if (extern_specifier) {
odsState.getOrAddProperties<Properties>().extern_specifier = ((extern_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
if (static_specifier) {
odsState.getOrAddProperties<Properties>().static_specifier = ((static_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
if (const_specifier) {
odsState.getOrAddProperties<Properties>().const_specifier = ((const_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
}
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier, /*optional*/bool static_specifier, /*optional*/bool const_specifier) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier, /*optional*/bool static_specifier, /*optional*/bool const_specifier) {
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
}
void GlobalOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier, /*optional*/bool static_specifier, /*optional*/bool const_specifier) {
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
odsState.getOrAddProperties<Properties>().type = ::mlir::TypeAttr::get(type);
if (initial_value) {
odsState.getOrAddProperties<Properties>().initial_value = initial_value;
}
if (extern_specifier) {
odsState.getOrAddProperties<Properties>().extern_specifier = ((extern_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
if (static_specifier) {
odsState.getOrAddProperties<Properties>().static_specifier = ((static_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
if (const_specifier) {
odsState.getOrAddProperties<Properties>().const_specifier = ((const_specifier) ? odsBuilder.getUnitAttr() : nullptr);
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier, /*optional*/bool static_specifier, /*optional*/bool const_specifier) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier, /*optional*/bool static_specifier, /*optional*/bool const_specifier) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(type)>(type), std::forward<decltype(initial_value)>(initial_value), std::forward<decltype(extern_specifier)>(extern_specifier), std::forward<decltype(static_specifier)>(static_specifier), std::forward<decltype(const_specifier)>(const_specifier));
}
void GlobalOp::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()) {
(void)odsState.getOrAddProperties<GlobalOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void GlobalOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
GlobalOp GlobalOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<GlobalOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
GlobalOp GlobalOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult GlobalOp::verifyInvariantsImpl() {
auto tblgen_const_specifier = getProperties().const_specifier; (void)tblgen_const_specifier;
auto tblgen_extern_specifier = getProperties().extern_specifier; (void)tblgen_extern_specifier;
auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
auto tblgen_static_specifier = getProperties().static_specifier; (void)tblgen_static_specifier;
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
auto tblgen_type = getProperties().type; (void)tblgen_type;
if (!tblgen_type) return emitOpError("requires attribute 'type'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_sym_name, "sym_name")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC9(*this, tblgen_type, "type")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(*this, tblgen_initial_value, "initial_value")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_extern_specifier, "extern_specifier")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_static_specifier, "static_specifier")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_const_specifier, "const_specifier")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult GlobalOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult GlobalOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::StringAttr sym_nameAttr;
::mlir::TypeAttr typeAttr;
::mlir::Attribute initial_valueAttr;
if (::mlir::succeeded(parser.parseOptionalKeyword("extern"))) {
result.getOrAddProperties<GlobalOp::Properties>().extern_specifier = parser.getBuilder().getUnitAttr(); }
if (::mlir::succeeded(parser.parseOptionalKeyword("static"))) {
result.getOrAddProperties<GlobalOp::Properties>().static_specifier = parser.getBuilder().getUnitAttr(); }
if (::mlir::succeeded(parser.parseOptionalKeyword("const"))) {
result.getOrAddProperties<GlobalOp::Properties>().const_specifier = parser.getBuilder().getUnitAttr(); }
if (parser.parseSymbolName(sym_nameAttr))
return ::mlir::failure();
if (sym_nameAttr) result.getOrAddProperties<GlobalOp::Properties>().sym_name = sym_nameAttr;
if (parser.parseColon())
return ::mlir::failure();
{
auto odsResult = parseEmitCGlobalOpTypeAndInitialValue(parser, typeAttr, initial_valueAttr);
if (odsResult) return ::mlir::failure();
result.getOrAddProperties<GlobalOp::Properties>().type = typeAttr;
if (initial_valueAttr)
result.getOrAddProperties<GlobalOp::Properties>().initial_value = initial_valueAttr;
}
{
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 GlobalOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
if ((getExternSpecifierAttr() && getExternSpecifierAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
_odsPrinter << ' ' << "extern";
}
if ((getStaticSpecifierAttr() && getStaticSpecifierAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
_odsPrinter << ' ' << "static";
}
if ((getConstSpecifierAttr() && getConstSpecifierAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
_odsPrinter << ' ' << "const";
}
_odsPrinter << ' ';
_odsPrinter.printSymbolName(getSymNameAttr().getValue());
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
printEmitCGlobalOpTypeAndInitialValue(_odsPrinter, *this, getTypeAttr(), getInitialValueAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("extern_specifier");
elidedAttrs.push_back("static_specifier");
elidedAttrs.push_back("const_specifier");
elidedAttrs.push_back("sym_name");
elidedAttrs.push_back("type");
elidedAttrs.push_back("initial_value");
{
::mlir::Builder odsBuilder(getContext());
::mlir::Attribute attr = getExternSpecifierAttr();
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
elidedAttrs.push_back("extern_specifier");
}
{
::mlir::Builder odsBuilder(getContext());
::mlir::Attribute attr = getStaticSpecifierAttr();
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
elidedAttrs.push_back("static_specifier");
}
{
::mlir::Builder odsBuilder(getContext());
::mlir::Attribute attr = getConstSpecifierAttr();
if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
elidedAttrs.push_back("const_specifier");
}
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::GlobalOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::GlobalOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::IfOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
IfOpGenericAdaptorBase::IfOpGenericAdaptorBase(IfOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
IfOpAdaptor::IfOpAdaptor(IfOp op) : IfOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IfOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult IfOp::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();
}
return ::mlir::success();
}
::mlir::Attribute IfOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code IfOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> IfOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void IfOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void IfOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult IfOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
IfOp IfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value cond, bool addThenBlock, bool addElseBlock) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(cond)>(cond), std::forward<decltype(addThenBlock)>(addThenBlock), std::forward<decltype(addElseBlock)>(addElseBlock));
auto __res__ = ::llvm::dyn_cast<IfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IfOp IfOp::create(::mlir::ImplicitLocOpBuilder &builder, Value cond, bool addThenBlock, bool addElseBlock) {
return create(builder, builder.getLoc(), std::forward<decltype(cond)>(cond), std::forward<decltype(addThenBlock)>(addThenBlock), std::forward<decltype(addElseBlock)>(addElseBlock));
}
IfOp IfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value cond, bool withElseRegion) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(cond)>(cond), std::forward<decltype(withElseRegion)>(withElseRegion));
auto __res__ = ::llvm::dyn_cast<IfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IfOp IfOp::create(::mlir::ImplicitLocOpBuilder &builder, Value cond, bool withElseRegion) {
return create(builder, builder.getLoc(), std::forward<decltype(cond)>(cond), std::forward<decltype(withElseRegion)>(withElseRegion));
}
IfOp IfOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, Value cond, function_ref<void(OpBuilder &, Location)> thenBuilder, function_ref<void(OpBuilder &, Location)> elseBuilder) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(cond)>(cond), std::forward<decltype(thenBuilder)>(thenBuilder), std::forward<decltype(elseBuilder)>(elseBuilder));
auto __res__ = ::llvm::dyn_cast<IfOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IfOp IfOp::create(::mlir::ImplicitLocOpBuilder &builder, Value cond, function_ref<void(OpBuilder &, Location)> thenBuilder, function_ref<void(OpBuilder &, Location)> elseBuilder) {
return create(builder, builder.getLoc(), std::forward<decltype(cond)>(cond), std::forward<decltype(thenBuilder)>(thenBuilder), std::forward<decltype(elseBuilder)>(elseBuilder));
}
::llvm::LogicalResult IfOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC6(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "thenRegion", index++)))
return ::mlir::failure();
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(1)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC3(*this, region, "elseRegion", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult IfOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult IfOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::IfOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::IncludeOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
IncludeOpGenericAdaptorBase::IncludeOpGenericAdaptorBase(IncludeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef IncludeOpGenericAdaptorBase::getInclude() {
auto attr = getIncludeAttr();
return attr.getValue();
}
::mlir::UnitAttr IncludeOpGenericAdaptorBase::getIsStandardIncludeAttr() {
auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_standard_include);
if (!attr)
attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
return attr;
}
bool IncludeOpGenericAdaptorBase::getIsStandardInclude() {
auto attr = getIsStandardIncludeAttr();
if (!attr)
return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
} // namespace detail
IncludeOpAdaptor::IncludeOpAdaptor(IncludeOp op) : IncludeOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult IncludeOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_include = getProperties().include; (void)tblgen_include;
if (!tblgen_include) return emitError(loc, "'emitc.include' op requires attribute 'include'");
auto tblgen_is_standard_include = getProperties().is_standard_include; (void)tblgen_is_standard_include;
if (tblgen_include && !((::llvm::isa<::mlir::StringAttr>(tblgen_include))))
return emitError(loc, "'emitc.include' op attribute 'include' failed to satisfy constraint: string attribute");
if (tblgen_is_standard_include && !((::llvm::isa<::mlir::UnitAttr>(tblgen_is_standard_include))))
return emitError(loc, "'emitc.include' op attribute 'is_standard_include' failed to satisfy constraint: unit attribute");
return ::mlir::success();
}
::llvm::LogicalResult IncludeOp::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.include;
auto attr = dict.get("include");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `include` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.is_standard_include;
auto attr = dict.get("is_standard_include");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `is_standard_include` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute IncludeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.include;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("include",
propStorage));
}
{
const auto &propStorage = prop.is_standard_include;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("is_standard_include",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code IncludeOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.include.getAsOpaquePointer()),
llvm::hash_value(prop.is_standard_include.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> IncludeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "include")
return prop.include;
if (name == "is_standard_include")
return prop.is_standard_include;
return std::nullopt;
}
void IncludeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "include") {
prop.include = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.include)>>(value);
return;
}
if (name == "is_standard_include") {
prop.is_standard_include = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.is_standard_include)>>(value);
return;
}
}
void IncludeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.include) attrs.append("include", prop.include);
if (prop.is_standard_include) attrs.append("is_standard_include", prop.is_standard_include);
}
::llvm::LogicalResult IncludeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getIncludeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "include", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getIsStandardIncludeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(attr, "is_standard_include", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult IncludeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.include)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.is_standard_include)))
return ::mlir::failure();
return ::mlir::success();
}
void IncludeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.include);
writer.writeOptionalAttribute(prop.is_standard_include);
}
::llvm::StringRef IncludeOp::getInclude() {
auto attr = getIncludeAttr();
return attr.getValue();
}
bool IncludeOp::getIsStandardInclude() {
auto attr = getIsStandardIncludeAttr();
if (!attr)
return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
return attr != nullptr;
}
void IncludeOp::setInclude(::llvm::StringRef attrValue) {
getProperties().include = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void IncludeOp::setIsStandardInclude(bool attrValue) {
auto &odsProp = getProperties().is_standard_include;
if (attrValue)
odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
else
odsProp = nullptr;
}
void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include) {
odsState.getOrAddProperties<Properties>().include = include;
if (is_standard_include) {
odsState.getOrAddProperties<Properties>().is_standard_include = is_standard_include;
}
}
IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include) {
return create(builder, builder.getLoc(), std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
}
void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include) {
odsState.getOrAddProperties<Properties>().include = include;
if (is_standard_include) {
odsState.getOrAddProperties<Properties>().is_standard_include = is_standard_include;
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
}
void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef include, /*optional*/bool is_standard_include) {
odsState.getOrAddProperties<Properties>().include = odsBuilder.getStringAttr(include);
if (is_standard_include) {
odsState.getOrAddProperties<Properties>().is_standard_include = ((is_standard_include) ? odsBuilder.getUnitAttr() : nullptr);
}
}
IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef include, /*optional*/bool is_standard_include) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef include, /*optional*/bool is_standard_include) {
return create(builder, builder.getLoc(), std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
}
void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef include, /*optional*/bool is_standard_include) {
odsState.getOrAddProperties<Properties>().include = odsBuilder.getStringAttr(include);
if (is_standard_include) {
odsState.getOrAddProperties<Properties>().is_standard_include = ((is_standard_include) ? odsBuilder.getUnitAttr() : nullptr);
}
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef include, /*optional*/bool is_standard_include) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef include, /*optional*/bool is_standard_include) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(include)>(include), std::forward<decltype(is_standard_include)>(is_standard_include));
}
void IncludeOp::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()) {
(void)odsState.getOrAddProperties<IncludeOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void IncludeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult IncludeOp::verifyInvariantsImpl() {
auto tblgen_include = getProperties().include; (void)tblgen_include;
if (!tblgen_include) return emitOpError("requires attribute 'include'");
auto tblgen_is_standard_include = getProperties().is_standard_include; (void)tblgen_is_standard_include;
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_include, "include")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC5(*this, tblgen_is_standard_include, "is_standard_include")))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult IncludeOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult IncludeOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.include;
auto includeAttrName = ::mlir::StringAttr::get(ctx, "include");
auto attr = dict.get(includeAttrName);
usedKeys.insert(includeAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for include in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `include` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.is_standard_include;
auto is_standard_includeAttrName = ::mlir::StringAttr::get(ctx, "is_standard_include");
auto attr = dict.get(is_standard_includeAttrName);
usedKeys.insert(is_standard_includeAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for is_standard_include in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `is_standard_include` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::IncludeOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::IncludeOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::LiteralOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
LiteralOpGenericAdaptorBase::LiteralOpGenericAdaptorBase(LiteralOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef LiteralOpGenericAdaptorBase::getValue() {
auto attr = getValueAttr();
return attr.getValue();
}
} // namespace detail
LiteralOpAdaptor::LiteralOpAdaptor(LiteralOp op) : LiteralOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult LiteralOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitError(loc, "'emitc.literal' op requires attribute 'value'");
if (tblgen_value && !((::llvm::isa<::mlir::StringAttr>(tblgen_value))))
return emitError(loc, "'emitc.literal' op attribute 'value' failed to satisfy constraint: string attribute");
return ::mlir::success();
}
::llvm::LogicalResult LiteralOp::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.value;
auto attr = dict.get("value");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute LiteralOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.value;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("value",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code LiteralOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.value.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> LiteralOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "value")
return prop.value;
return std::nullopt;
}
void LiteralOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "value") {
prop.value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.value)>>(value);
return;
}
}
void LiteralOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.value) attrs.append("value", prop.value);
}
::llvm::LogicalResult LiteralOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getValueAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "value", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult LiteralOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.value)))
return ::mlir::failure();
return ::mlir::success();
}
void LiteralOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.value);
}
::llvm::StringRef LiteralOp::getValue() {
auto attr = getValueAttr();
return attr.getValue();
}
void LiteralOp::setValue(::llvm::StringRef attrValue) {
getProperties().value = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void LiteralOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr value) {
odsState.getOrAddProperties<Properties>().value = value;
odsState.addTypes(result);
}
LiteralOp LiteralOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::StringAttr value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<LiteralOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LiteralOp LiteralOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::StringAttr value) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(value)>(value));
}
void LiteralOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value) {
odsState.getOrAddProperties<Properties>().value = value;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
LiteralOp LiteralOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<LiteralOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LiteralOp LiteralOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
}
void LiteralOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef value) {
odsState.getOrAddProperties<Properties>().value = odsBuilder.getStringAttr(value);
odsState.addTypes(result);
}
LiteralOp LiteralOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<LiteralOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LiteralOp LiteralOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef value) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(value)>(value));
}
void LiteralOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value) {
odsState.getOrAddProperties<Properties>().value = odsBuilder.getStringAttr(value);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
LiteralOp LiteralOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<LiteralOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LiteralOp LiteralOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
}
void LiteralOp::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()) {
(void)odsState.getOrAddProperties<LiteralOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
LiteralOp LiteralOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<LiteralOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LiteralOp LiteralOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void LiteralOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
LiteralOp LiteralOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<LiteralOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LiteralOp LiteralOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult LiteralOp::verifyInvariantsImpl() {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitOpError("requires attribute 'value'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_value, "value")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult LiteralOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult LiteralOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::StringAttr valueAttr;
::mlir::Type resultRawType{};
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (valueAttr) result.getOrAddProperties<LiteralOp::Properties>().value = valueAttr;
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
resultRawType = type;
}
result.addTypes(resultTypes);
return ::mlir::success();
}
void LiteralOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getValueAttr());
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("value");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getResult().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
}
void LiteralOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::LiteralOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::LiteralOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::LoadOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
LoadOpGenericAdaptorBase::LoadOpGenericAdaptorBase(LoadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
LoadOpAdaptor::LoadOpAdaptor(LoadOp op) : LoadOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult LoadOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult LoadOp::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();
}
return ::mlir::success();
}
::mlir::Attribute LoadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code LoadOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> LoadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void LoadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void LoadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult LoadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.addTypes(result);
}
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(operand)>(operand));
}
void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand) {
odsState.addOperands(operand);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand));
}
void LoadOp::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);
}
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void LoadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
LoadOp LoadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<LoadOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LoadOp LoadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult LoadOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC2(*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_EmitC11(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
if (!((std::equal_to<>()(::llvm::cast<LValueType>((*this->getODSOperands(0).begin()).getType()).getValueType(), (*this->getODSResults(0).begin()).getType()))))
return emitOpError("failed to verify that result type matches value type of 'operand'");
return ::mlir::success();
}
::llvm::LogicalResult LoadOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult LoadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand operandRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> operandOperands(&operandRawOperand, 1); ::llvm::SMLoc operandOperandsLoc;
(void)operandOperandsLoc;
::mlir::Type operandRawType{};
::llvm::ArrayRef<::mlir::Type> operandTypes(&operandRawType, 1);
operandOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(operandRawOperand))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::emitc::LValueType type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
operandRawType = type;
}
for (::mlir::Type type : operandTypes) {
(void)type;
if (!((::llvm::isa<::mlir::emitc::LValueType>(type)))) {
return parser.emitError(parser.getNameLoc()) << "'operand' must be EmitC lvalue type, but got " << type;
}
}
result.addTypes(::llvm::cast<LValueType>(operandTypes[0]).getValueType());
if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void LoadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperand();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getOperand().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::emitc::LValueType>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
}
void LoadOp::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, true, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::LoadOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::LogicalAndOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
LogicalAndOpGenericAdaptorBase::LogicalAndOpGenericAdaptorBase(LogicalAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
LogicalAndOpAdaptor::LogicalAndOpAdaptor(LogicalAndOp op) : LogicalAndOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult LogicalAndOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult LogicalAndOp::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();
}
return ::mlir::success();
}
::mlir::Attribute LogicalAndOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code LogicalAndOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> LogicalAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void LogicalAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void LogicalAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult LogicalAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void LogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<LogicalAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void LogicalAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<LogicalAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void LogicalAndOp::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);
}
LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<LogicalAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void LogicalAndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
LogicalAndOp LogicalAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<LogicalAndOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalAndOp LogicalAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult LogicalAndOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult LogicalAndOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult LogicalAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::SmallVector<::mlir::Type, 1> allOperandTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allOperandTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
result.addTypes(odsBuildableType0);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void LogicalAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperandTypes();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::LogicalAndOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::LogicalNotOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
LogicalNotOpGenericAdaptorBase::LogicalNotOpGenericAdaptorBase(LogicalNotOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
LogicalNotOpAdaptor::LogicalNotOpAdaptor(LogicalNotOp op) : LogicalNotOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult LogicalNotOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult LogicalNotOp::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();
}
return ::mlir::success();
}
::mlir::Attribute LogicalNotOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code LogicalNotOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> LogicalNotOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void LogicalNotOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void LogicalNotOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult LogicalNotOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void LogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
odsState.addTypes(resultType0);
}
LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<LogicalNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void LogicalNotOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<LogicalNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void LogicalNotOp::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);
}
LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<LogicalNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void LogicalNotOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
LogicalNotOp LogicalNotOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<LogicalNotOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalNotOp LogicalNotOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult LogicalNotOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult LogicalNotOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult LogicalNotOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::SmallVector<::mlir::Type, 1> allOperandTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allOperandTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
result.addTypes(odsBuildableType0);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void LogicalNotOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperandTypes();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::LogicalNotOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::LogicalOrOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
LogicalOrOpGenericAdaptorBase::LogicalOrOpGenericAdaptorBase(LogicalOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
LogicalOrOpAdaptor::LogicalOrOpAdaptor(LogicalOrOp op) : LogicalOrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult LogicalOrOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult LogicalOrOp::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();
}
return ::mlir::success();
}
::mlir::Attribute LogicalOrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code LogicalOrOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> LogicalOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void LogicalOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void LogicalOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult LogicalOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void LogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<LogicalOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void LogicalOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<LogicalOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void LogicalOrOp::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);
}
LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<LogicalOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void LogicalOrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
LogicalOrOp LogicalOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<LogicalOrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
LogicalOrOp LogicalOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult LogicalOrOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC6(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult LogicalOrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult LogicalOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::SmallVector<::mlir::Type, 1> allOperandTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(allOperandTypes))
return ::mlir::failure();
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
result.addTypes(odsBuildableType0);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void LogicalOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperandTypes();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::LogicalOrOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::MemberCallOpaqueOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
MemberCallOpaqueOpGenericAdaptorBase::MemberCallOpaqueOpGenericAdaptorBase(MemberCallOpaqueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> MemberCallOpaqueOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {false, true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::StringRef MemberCallOpaqueOpGenericAdaptorBase::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
::std::optional< ::mlir::ArrayAttr > MemberCallOpaqueOpGenericAdaptorBase::getArgs() {
auto attr = getArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > MemberCallOpaqueOpGenericAdaptorBase::getTemplateArgs() {
auto attr = getTemplateArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
} // namespace detail
MemberCallOpaqueOpAdaptor::MemberCallOpaqueOpAdaptor(MemberCallOpaqueOp op) : MemberCallOpaqueOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult MemberCallOpaqueOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_args = getProperties().args; (void)tblgen_args;
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitError(loc, "'emitc.member_call_opaque' op requires attribute 'callee'");
auto tblgen_template_args = getProperties().template_args; (void)tblgen_template_args;
if (tblgen_callee && !((::llvm::isa<::mlir::StringAttr>(tblgen_callee))))
return emitError(loc, "'emitc.member_call_opaque' op attribute 'callee' failed to satisfy constraint: string attribute");
if (tblgen_args && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_args))))
return emitError(loc, "'emitc.member_call_opaque' op attribute 'args' failed to satisfy constraint: array attribute");
if (tblgen_template_args && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_template_args))))
return emitError(loc, "'emitc.member_call_opaque' op attribute 'template_args' failed to satisfy constraint: array attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> MemberCallOpaqueOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {false, true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange MemberCallOpaqueOp::getArgOperandsMutable() {
auto range = getODSOperandIndexAndLength(1);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
std::pair<unsigned, unsigned> MemberCallOpaqueOp::getODSResultIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumResults() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::LogicalResult MemberCallOpaqueOp::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.args;
auto attr = dict.get("args");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `args` in property conversion: " << attr;
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();
}
}
}
{
auto &propStorage = prop.template_args;
auto attr = dict.get("template_args");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `template_args` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute MemberCallOpaqueOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.args;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("args",
propStorage));
}
{
const auto &propStorage = prop.callee;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("callee",
propStorage));
}
{
const auto &propStorage = prop.template_args;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("template_args",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code MemberCallOpaqueOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.args.getAsOpaquePointer()),
llvm::hash_value(prop.callee.getAsOpaquePointer()),
llvm::hash_value(prop.template_args.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> MemberCallOpaqueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "args")
return prop.args;
if (name == "callee")
return prop.callee;
if (name == "template_args")
return prop.template_args;
return std::nullopt;
}
void MemberCallOpaqueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "args") {
prop.args = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.args)>>(value);
return;
}
if (name == "callee") {
prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
return;
}
if (name == "template_args") {
prop.template_args = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.template_args)>>(value);
return;
}
}
void MemberCallOpaqueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.args) attrs.append("args", prop.args);
if (prop.callee) attrs.append("callee", prop.callee);
if (prop.template_args) attrs.append("template_args", prop.template_args);
}
::llvm::LogicalResult MemberCallOpaqueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getArgsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(attr, "args", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "callee", emitError)))
return ::mlir::failure();
}
{
::mlir::Attribute attr = attrs.get(getTemplateArgsAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(attr, "template_args", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult MemberCallOpaqueOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readOptionalAttribute(prop.args)))
return ::mlir::failure();
if (::mlir::failed(reader.readAttribute(prop.callee)))
return ::mlir::failure();
if (::mlir::failed(reader.readOptionalAttribute(prop.template_args)))
return ::mlir::failure();
return ::mlir::success();
}
void MemberCallOpaqueOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeOptionalAttribute(prop.args);
writer.writeAttribute(prop.callee);
writer.writeOptionalAttribute(prop.template_args);
}
::llvm::StringRef MemberCallOpaqueOp::getCallee() {
auto attr = getCalleeAttr();
return attr.getValue();
}
::std::optional< ::mlir::ArrayAttr > MemberCallOpaqueOp::getArgs() {
auto attr = getArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
::std::optional< ::mlir::ArrayAttr > MemberCallOpaqueOp::getTemplateArgs() {
auto attr = getTemplateArgsAttr();
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
}
void MemberCallOpaqueOp::setCallee(::llvm::StringRef attrValue) {
getProperties().callee = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void MemberCallOpaqueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
odsState.addOperands(receiver);
odsState.addOperands(arg_operands);
odsState.getOrAddProperties<Properties>().callee = callee;
if (args) {
odsState.getOrAddProperties<Properties>().args = args;
}
if (template_args) {
odsState.getOrAddProperties<Properties>().template_args = template_args;
}
odsState.addTypes(resultType0);
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(receiver)>(receiver), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
auto __res__ = ::llvm::dyn_cast<MemberCallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(receiver)>(receiver), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
}
void MemberCallOpaqueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
odsState.addOperands(receiver);
odsState.addOperands(arg_operands);
odsState.getOrAddProperties<Properties>().callee = odsBuilder.getStringAttr(callee);
if (args) {
odsState.getOrAddProperties<Properties>().args = args;
}
if (template_args) {
odsState.getOrAddProperties<Properties>().template_args = template_args;
}
odsState.addTypes(resultType0);
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(receiver)>(receiver), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
auto __res__ = ::llvm::dyn_cast<MemberCallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(receiver)>(receiver), std::forward<decltype(callee)>(callee), std::forward<decltype(args)>(args), std::forward<decltype(template_args)>(template_args), std::forward<decltype(arg_operands)>(arg_operands));
}
void MemberCallOpaqueOp::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);
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<MemberCallOpaqueOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<MemberCallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void MemberCallOpaqueOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() >= 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
odsState.addTypes(resultTypes);
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<MemberCallOpaqueOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberCallOpaqueOp MemberCallOpaqueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult MemberCallOpaqueOp::verifyInvariantsImpl() {
auto tblgen_args = getProperties().args; (void)tblgen_args;
auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
auto tblgen_template_args = getProperties().template_args; (void)tblgen_template_args;
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_callee, "callee")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(*this, tblgen_args, "args")))
return ::mlir::failure();
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC4(*this, tblgen_template_args, "template_args")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC5(*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_EmitC4(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult MemberCallOpaqueOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult MemberCallOpaqueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand receiverRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> receiverOperands(&receiverRawOperand, 1); ::llvm::SMLoc receiverOperandsLoc;
(void)receiverOperandsLoc;
::mlir::StringAttr calleeAttr;
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> arg_operandsOperands;
::llvm::SMLoc arg_operandsOperandsLoc;
(void)arg_operandsOperandsLoc;
::mlir::Type receiverRawType{};
::llvm::ArrayRef<::mlir::Type> receiverTypes(&receiverRawType, 1);
::llvm::ArrayRef<::mlir::Type> arg_operandsTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
receiverOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(receiverRawOperand))
return ::mlir::failure();
if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (calleeAttr) result.getOrAddProperties<MemberCallOpaqueOp::Properties>().callee = calleeAttr;
if (parser.parseLParen())
return ::mlir::failure();
arg_operandsOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperandList(arg_operandsOperands))
return ::mlir::failure();
if (parser.parseRParen())
return ::mlir::failure();
if (parseProperties(parser, result))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
receiverRawType = type;
}
if (parser.parseComma())
return ::mlir::failure();
::mlir::FunctionType arg_operands__allResult_functionType;
if (parser.parseType(arg_operands__allResult_functionType))
return ::mlir::failure();
arg_operandsTypes = arg_operands__allResult_functionType.getInputs();
allResultTypes = arg_operands__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(receiverOperands, receiverTypes, receiverOperandsLoc, result.operands))
return ::mlir::failure();
if (parser.resolveOperands(arg_operandsOperands, arg_operandsTypes, arg_operandsOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
::llvm::LogicalResult MemberCallOpaqueOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.args;
auto argsAttrName = ::mlir::StringAttr::get(ctx, "args");
auto attr = dict.get(argsAttrName);
usedKeys.insert(argsAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for args in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `args` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
{
auto &propStorage = prop.template_args;
auto template_argsAttrName = ::mlir::StringAttr::get(ctx, "template_args");
auto attr = dict.get(template_argsAttrName);
usedKeys.insert(template_argsAttrName);
if (attr || /*isRequired=*/false) {
if (!attr) {
emitError() << "expected key entry for template_args in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `template_args` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
void MemberCallOpaqueOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getReceiver();
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getCalleeAttr());
_odsPrinter << "(";
_odsPrinter << getArgOperands();
_odsPrinter << ")";
::llvm::SmallVector<::llvm::StringRef, 2> elidedProps;
elidedProps.push_back("callee");
_odsPrinter << " ";
printProperties(this->getContext(), _odsPrinter, getProperties(), elidedProps);
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("callee");
_odsPrinter.printOptionalAttrDict(llvm::to_vector((*this)->getDiscardableAttrs()), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getReceiver().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
_odsPrinter << ",";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getArgOperands().getTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::MemberCallOpaqueOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::MemberCallOpaqueOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::MemberOfPtrOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
MemberOfPtrOpGenericAdaptorBase::MemberOfPtrOpGenericAdaptorBase(MemberOfPtrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef MemberOfPtrOpGenericAdaptorBase::getMember() {
auto attr = getMemberAttr();
return attr.getValue();
}
} // namespace detail
MemberOfPtrOpAdaptor::MemberOfPtrOpAdaptor(MemberOfPtrOp op) : MemberOfPtrOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult MemberOfPtrOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_member = getProperties().member; (void)tblgen_member;
if (!tblgen_member) return emitError(loc, "'emitc.member_of_ptr' op requires attribute 'member'");
if (tblgen_member && !((::llvm::isa<::mlir::StringAttr>(tblgen_member))))
return emitError(loc, "'emitc.member_of_ptr' op attribute 'member' failed to satisfy constraint: string attribute");
return ::mlir::success();
}
::llvm::LogicalResult MemberOfPtrOp::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.member;
auto attr = dict.get("member");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `member` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute MemberOfPtrOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.member;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("member",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code MemberOfPtrOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.member.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> MemberOfPtrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "member")
return prop.member;
return std::nullopt;
}
void MemberOfPtrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "member") {
prop.member = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.member)>>(value);
return;
}
}
void MemberOfPtrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.member) attrs.append("member", prop.member);
}
::llvm::LogicalResult MemberOfPtrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getMemberAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "member", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult MemberOfPtrOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.member)))
return ::mlir::failure();
return ::mlir::success();
}
void MemberOfPtrOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.member);
}
::llvm::StringRef MemberOfPtrOp::getMember() {
auto attr = getMemberAttr();
return attr.getValue();
}
void MemberOfPtrOp::setMember(::llvm::StringRef attrValue) {
getProperties().member = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void MemberOfPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = member;
odsState.addTypes(resultType0);
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOfPtrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOfPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = member;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOfPtrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOfPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = odsBuilder.getStringAttr(member);
odsState.addTypes(resultType0);
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOfPtrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOfPtrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = odsBuilder.getStringAttr(member);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOfPtrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOfPtrOp::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()) {
(void)odsState.getOrAddProperties<MemberOfPtrOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<MemberOfPtrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void MemberOfPtrOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<MemberOfPtrOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOfPtrOp MemberOfPtrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult MemberOfPtrOp::verifyInvariantsImpl() {
auto tblgen_member = getProperties().member; (void)tblgen_member;
if (!tblgen_member) return emitOpError("requires attribute 'member'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_member, "member")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC12(*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_EmitC10(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult MemberOfPtrOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::llvm::LogicalResult MemberOfPtrOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.member;
auto memberAttrName = ::mlir::StringAttr::get(ctx, "member");
auto attr = dict.get(memberAttrName);
usedKeys.insert(memberAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for member in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `member` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::MemberOfPtrOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::MemberOfPtrOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::MemberOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
MemberOpGenericAdaptorBase::MemberOpGenericAdaptorBase(MemberOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::StringRef MemberOpGenericAdaptorBase::getMember() {
auto attr = getMemberAttr();
return attr.getValue();
}
} // namespace detail
MemberOpAdaptor::MemberOpAdaptor(MemberOp op) : MemberOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult MemberOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_member = getProperties().member; (void)tblgen_member;
if (!tblgen_member) return emitError(loc, "'emitc.member' op requires attribute 'member'");
if (tblgen_member && !((::llvm::isa<::mlir::StringAttr>(tblgen_member))))
return emitError(loc, "'emitc.member' op attribute 'member' failed to satisfy constraint: string attribute");
return ::mlir::success();
}
::llvm::LogicalResult MemberOp::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.member;
auto attr = dict.get("member");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `member` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute MemberOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.member;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("member",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code MemberOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.member.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> MemberOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "member")
return prop.member;
return std::nullopt;
}
void MemberOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "member") {
prop.member = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.member)>>(value);
return;
}
}
void MemberOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.member) attrs.append("member", prop.member);
}
::llvm::LogicalResult MemberOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getMemberAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "member", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult MemberOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.member)))
return ::mlir::failure();
return ::mlir::success();
}
void MemberOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.member);
}
::llvm::StringRef MemberOp::getMember() {
auto attr = getMemberAttr();
return attr.getValue();
}
void MemberOp::setMember(::llvm::StringRef attrValue) {
getProperties().member = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void MemberOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = member;
odsState.addTypes(resultType0);
}
MemberOp MemberOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOp MemberOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = member;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
MemberOp MemberOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOp MemberOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = odsBuilder.getStringAttr(member);
odsState.addTypes(resultType0);
}
MemberOp MemberOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOp MemberOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand) {
odsState.addOperands(operand);
odsState.getOrAddProperties<Properties>().member = odsBuilder.getStringAttr(member);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
MemberOp MemberOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<MemberOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOp MemberOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(member)>(member), std::forward<decltype(operand)>(operand));
}
void MemberOp::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()) {
(void)odsState.getOrAddProperties<MemberOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
MemberOp MemberOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<MemberOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOp MemberOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void MemberOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
MemberOp MemberOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<MemberOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MemberOp MemberOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult MemberOp::verifyInvariantsImpl() {
auto tblgen_member = getProperties().member; (void)tblgen_member;
if (!tblgen_member) return emitOpError("requires attribute 'member'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_member, "member")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC13(*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_EmitC8(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult MemberOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::llvm::LogicalResult MemberOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.member;
auto memberAttrName = ::mlir::StringAttr::get(ctx, "member");
auto attr = dict.get(memberAttrName);
usedKeys.insert(memberAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for member in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `member` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::MemberOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::MemberOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::MulOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
MulOpGenericAdaptorBase::MulOpGenericAdaptorBase(MulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
MulOpAdaptor::MulOpAdaptor(MulOp op) : MulOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult MulOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult MulOp::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();
}
return ::mlir::success();
}
::mlir::Attribute MulOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code MulOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> MulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void MulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void MulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult MulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
odsState.addOperands(odsArg_0);
odsState.addOperands(odsArg_1);
odsState.addTypes(resultType0);
}
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
}
void MulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
odsState.addOperands(odsArg_0);
odsState.addOperands(odsArg_1);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
}
void MulOp::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);
}
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void MulOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
MulOp MulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<MulOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
MulOp MulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult MulOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC7(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC7(*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_EmitC7(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult MulOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult MulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void MulOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::MulOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::RemOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
RemOpGenericAdaptorBase::RemOpGenericAdaptorBase(RemOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
RemOpAdaptor::RemOpAdaptor(RemOp op) : RemOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult RemOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult RemOp::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();
}
return ::mlir::success();
}
::mlir::Attribute RemOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code RemOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> RemOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void RemOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void RemOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult RemOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void RemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
odsState.addOperands(odsArg_0);
odsState.addOperands(odsArg_1);
odsState.addTypes(resultType0);
}
RemOp RemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
auto __res__ = ::llvm::dyn_cast<RemOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RemOp RemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
}
void RemOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
odsState.addOperands(odsArg_0);
odsState.addOperands(odsArg_1);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
RemOp RemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
auto __res__ = ::llvm::dyn_cast<RemOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RemOp RemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0), std::forward<decltype(odsArg_1)>(odsArg_1));
}
void RemOp::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);
}
RemOp RemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<RemOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RemOp RemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void RemOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
RemOp RemOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<RemOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
RemOp RemOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult RemOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC9(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC9(*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_EmitC9(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult RemOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult RemOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void RemOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::RemOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::ReturnOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
} // namespace detail
ReturnOpAdaptor::ReturnOpAdaptor(ReturnOp op) : ReturnOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> ReturnOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange ReturnOp::getOperandMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
::llvm::LogicalResult ReturnOp::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();
}
return ::mlir::success();
}
::mlir::Attribute ReturnOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code ReturnOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> ReturnOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void ReturnOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void ReturnOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult ReturnOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value operand) {
if (operand)
odsState.addOperands(operand);
}
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(operand)>(operand));
}
void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value operand) {
if (operand)
odsState.addOperands(operand);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value operand) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand));
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value operand) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operand)>(operand));
}
void ReturnOp::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);
}
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
ReturnOp ReturnOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<ReturnOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
ReturnOp ReturnOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult ReturnOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
if (valueGroup0.size() > 1) {
return emitOpError("operand group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult ReturnOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandOperands;
::llvm::SMLoc operandOperandsLoc;
(void)operandOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> operandTypes;
{
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();
}
{
operandOperandsLoc = parser.getCurrentLocation();
::mlir::OpAsmParser::UnresolvedOperand operand;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalOperand(operand);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
operandOperands.push_back(operand);
}
}
if (!operandOperands.empty()) {
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
operandTypes.push_back(optionalType);
}
}
}
if (!operandOperands.empty()) {
if (parser.resolveOperands(operandOperands, operandTypes, operandOperandsLoc, result.operands))
return ::mlir::failure();
}
return ::mlir::success();
}
void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
if (getOperand()) {
_odsPrinter << ' ';
if (::mlir::Value value = getOperand())
_odsPrinter << value;
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << (getOperand() ? ::llvm::ArrayRef<::mlir::Type>(getOperand().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::ReturnOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::SubOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
SubOpGenericAdaptorBase::SubOpGenericAdaptorBase(SubOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
SubOpAdaptor::SubOpAdaptor(SubOp op) : SubOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult SubOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult SubOp::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();
}
return ::mlir::success();
}
::mlir::Attribute SubOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code SubOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> SubOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void SubOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void SubOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult SubOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
odsState.addTypes(resultType0);
}
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void SubOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
odsState.addOperands(lhs);
odsState.addOperands(rhs);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
}
void SubOp::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);
}
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void SubOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 2u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
SubOp SubOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<SubOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubOp SubOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult SubOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult SubOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult SubOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void SubOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::SubOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::SubscriptOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
SubscriptOpGenericAdaptorBase::SubscriptOpGenericAdaptorBase(SubscriptOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> SubscriptOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {false, true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
} // namespace detail
SubscriptOpAdaptor::SubscriptOpAdaptor(SubscriptOp op) : SubscriptOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult SubscriptOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> SubscriptOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {false, true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 1) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange SubscriptOp::getIndicesMutable() {
auto range = getODSOperandIndexAndLength(1);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
::llvm::LogicalResult SubscriptOp::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();
}
return ::mlir::success();
}
::mlir::Attribute SubscriptOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code SubscriptOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> SubscriptOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void SubscriptOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void SubscriptOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult SubscriptOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void SubscriptOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypedValue<ArrayType> array, ValueRange indices) {
build(
odsBuilder,
odsState,
emitc::LValueType::get(array.getType().getElementType()),
array,
indices
);
}
SubscriptOp SubscriptOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypedValue<ArrayType> array, ValueRange indices) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(array)>(array), std::forward<decltype(indices)>(indices));
auto __res__ = ::llvm::dyn_cast<SubscriptOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubscriptOp SubscriptOp::create(::mlir::ImplicitLocOpBuilder &builder, TypedValue<ArrayType> array, ValueRange indices) {
return create(builder, builder.getLoc(), std::forward<decltype(array)>(array), std::forward<decltype(indices)>(indices));
}
void SubscriptOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypedValue<PointerType> pointer, Value index) {
build(
odsBuilder,
odsState,
emitc::LValueType::get(pointer.getType().getPointee()),
pointer,
ValueRange{index}
);
}
SubscriptOp SubscriptOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, TypedValue<PointerType> pointer, Value index) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(pointer)>(pointer), std::forward<decltype(index)>(index));
auto __res__ = ::llvm::dyn_cast<SubscriptOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubscriptOp SubscriptOp::create(::mlir::ImplicitLocOpBuilder &builder, TypedValue<PointerType> pointer, Value index) {
return create(builder, builder.getLoc(), std::forward<decltype(pointer)>(pointer), std::forward<decltype(index)>(index));
}
void SubscriptOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value, ::mlir::ValueRange indices) {
odsState.addOperands(value);
odsState.addOperands(indices);
odsState.addTypes(result);
}
SubscriptOp SubscriptOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value value, ::mlir::ValueRange indices) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(value)>(value), std::forward<decltype(indices)>(indices));
auto __res__ = ::llvm::dyn_cast<SubscriptOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubscriptOp SubscriptOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value value, ::mlir::ValueRange indices) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(value)>(value), std::forward<decltype(indices)>(indices));
}
void SubscriptOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange indices) {
odsState.addOperands(value);
odsState.addOperands(indices);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
SubscriptOp SubscriptOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange indices) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(indices)>(indices));
auto __res__ = ::llvm::dyn_cast<SubscriptOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubscriptOp SubscriptOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange indices) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(indices)>(indices));
}
void SubscriptOp::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);
}
SubscriptOp SubscriptOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<SubscriptOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubscriptOp SubscriptOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void SubscriptOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() >= 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
SubscriptOp SubscriptOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<SubscriptOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SubscriptOp SubscriptOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult SubscriptOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC14(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
auto valueGroup1 = getODSOperands(1);
for (auto v : valueGroup1) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC4(*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_EmitC2(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult SubscriptOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult SubscriptOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
(void)valueOperandsLoc;
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> indicesOperands;
::llvm::SMLoc indicesOperandsLoc;
(void)indicesOperandsLoc;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
valueOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(valueRawOperand))
return ::mlir::failure();
if (parser.parseLSquare())
return ::mlir::failure();
indicesOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperandList(indicesOperands))
return ::mlir::failure();
if (parser.parseRSquare())
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(::llvm::concat<const ::mlir::OpAsmParser::UnresolvedOperand>(valueOperands, indicesOperands), allOperandTypes, parser.getNameLoc(), result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void SubscriptOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getValue();
_odsPrinter << "[";
_odsPrinter << getIndices();
_odsPrinter << "]";
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::SubscriptOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::SwitchOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
SwitchOpGenericAdaptorBase::SwitchOpGenericAdaptorBase(SwitchOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::llvm::ArrayRef<int64_t> SwitchOpGenericAdaptorBase::getCases() {
auto attr = getCasesAttr();
return attr;
}
} // namespace detail
SwitchOpAdaptor::SwitchOpAdaptor(SwitchOp op) : SwitchOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult SwitchOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_cases = getProperties().cases; (void)tblgen_cases;
if (!tblgen_cases) return emitError(loc, "'emitc.switch' op requires attribute 'cases'");
if (tblgen_cases && !((::llvm::isa<::mlir::DenseI64ArrayAttr>(tblgen_cases))))
return emitError(loc, "'emitc.switch' op attribute 'cases' failed to satisfy constraint: i64 dense array attribute");
return ::mlir::success();
}
::llvm::LogicalResult SwitchOp::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.cases;
auto attr = dict.get("cases");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `cases` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute SwitchOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.cases;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("cases",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code SwitchOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.cases.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> SwitchOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "cases")
return prop.cases;
return std::nullopt;
}
void SwitchOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "cases") {
prop.cases = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.cases)>>(value);
return;
}
}
void SwitchOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.cases) attrs.append("cases", prop.cases);
}
::llvm::LogicalResult SwitchOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getCasesAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC13(attr, "cases", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult SwitchOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.cases)))
return ::mlir::failure();
return ::mlir::success();
}
void SwitchOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.cases);
}
::llvm::ArrayRef<int64_t> SwitchOp::getCases() {
auto attr = getCasesAttr();
return attr;
}
void SwitchOp::setCases(::llvm::ArrayRef<int64_t> attrValue) {
getProperties().cases = ::mlir::Builder((*this)->getContext()).getDenseI64ArrayAttr(attrValue);
}
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount) {
odsState.addOperands(arg);
odsState.getOrAddProperties<Properties>().cases = cases;
(void)odsState.addRegion();
for (unsigned i = 0; i < caseRegionsCount; ++i)
(void)odsState.addRegion();
}
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount) {
return create(builder, builder.getLoc(), std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
}
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount) {
odsState.addOperands(arg);
odsState.getOrAddProperties<Properties>().cases = cases;
(void)odsState.addRegion();
for (unsigned i = 0; i < caseRegionsCount; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
}
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::llvm::ArrayRef<int64_t> cases, unsigned caseRegionsCount) {
odsState.addOperands(arg);
odsState.getOrAddProperties<Properties>().cases = odsBuilder.getDenseI64ArrayAttr(cases);
(void)odsState.addRegion();
for (unsigned i = 0; i < caseRegionsCount; ++i)
(void)odsState.addRegion();
}
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value arg, ::llvm::ArrayRef<int64_t> cases, unsigned caseRegionsCount) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value arg, ::llvm::ArrayRef<int64_t> cases, unsigned caseRegionsCount) {
return create(builder, builder.getLoc(), std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
}
void SwitchOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::ArrayRef<int64_t> cases, unsigned caseRegionsCount) {
odsState.addOperands(arg);
odsState.getOrAddProperties<Properties>().cases = odsBuilder.getDenseI64ArrayAttr(cases);
(void)odsState.addRegion();
for (unsigned i = 0; i < caseRegionsCount; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::ArrayRef<int64_t> cases, unsigned caseRegionsCount) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::ArrayRef<int64_t> cases, unsigned caseRegionsCount) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(arg)>(arg), std::forward<decltype(cases)>(cases), std::forward<decltype(caseRegionsCount)>(caseRegionsCount));
}
void SwitchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.addAttributes(attributes);
for (unsigned i = 0; i != numRegions; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
if (!attributes.empty()) {
(void)odsState.getOrAddProperties<SwitchOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes), std::forward<decltype(numRegions)>(numRegions));
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes), std::forward<decltype(numRegions)>(numRegions));
}
void SwitchOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes, unsigned numRegions) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
for (unsigned i = 0; i != numRegions; ++i)
(void)odsState.addRegion();
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
SwitchOp SwitchOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes, unsigned numRegions) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes), std::forward<decltype(numRegions)>(numRegions));
auto __res__ = ::llvm::dyn_cast<SwitchOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
SwitchOp SwitchOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes, unsigned numRegions) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes), std::forward<decltype(numRegions)>(numRegions));
}
::llvm::LogicalResult SwitchOp::verifyInvariantsImpl() {
auto tblgen_cases = getProperties().cases; (void)tblgen_cases;
if (!tblgen_cases) return emitOpError("requires attribute 'cases'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC13(*this, tblgen_cases, "cases")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC9(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
{
unsigned index = 0; (void)index;
for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "defaultRegion", index++)))
return ::mlir::failure();
for (auto &region : getCaseRegions())
if (::mlir::failed(__mlir_ods_local_region_constraint_EmitC2(*this, region, "caseRegions", index++)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult SwitchOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult SwitchOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::OpAsmParser::UnresolvedOperand argRawOperand{};
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> argOperands(&argRawOperand, 1); ::llvm::SMLoc argOperandsLoc;
(void)argOperandsLoc;
::mlir::Type argRawType{};
::llvm::ArrayRef<::mlir::Type> argTypes(&argRawType, 1);
::mlir::DenseI64ArrayAttr casesAttr;
::llvm::SmallVector<std::unique_ptr<::mlir::Region>, 2> caseRegionsRegions;
std::unique_ptr<::mlir::Region> defaultRegionRegion = std::make_unique<::mlir::Region>();
argOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperand(argRawOperand))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type type;
if (parser.parseCustomTypeWithFallback(type))
return ::mlir::failure();
argRawType = type;
}
{
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();
}
{
auto odsResult = parseSwitchCases(parser, casesAttr, caseRegionsRegions);
if (odsResult) return ::mlir::failure();
result.getOrAddProperties<SwitchOp::Properties>().cases = casesAttr;
}
if (parser.parseKeyword("default"))
return ::mlir::failure();
if (parser.parseRegion(*defaultRegionRegion))
return ::mlir::failure();
ensureTerminator(*defaultRegionRegion, parser.getBuilder(), result.location);
result.addRegion(std::move(defaultRegionRegion));
result.addRegions(caseRegionsRegions);
if (parser.resolveOperands(argOperands, argTypes, argOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void SwitchOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getArg();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
{
auto type = getArg().getType();
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
_odsPrinter.printStrippedAttrOrType(validType);
else
_odsPrinter << type;
}
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("cases");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ';
printSwitchCases(_odsPrinter, *this, getCasesAttr(), getCaseRegions());
_odsPrinter.printNewline();
_odsPrinter << "default";
_odsPrinter << ' ';
{
bool printTerminator = true;
if (auto *term = getDefaultRegion().empty() ? nullptr : getDefaultRegion().begin()->getTerminator()) {
printTerminator = !term->getAttrDictionary().empty() ||
term->getNumOperands() != 0 ||
term->getNumResults() != 0;
}
_odsPrinter.printRegion(getDefaultRegion(), /*printEntryBlockArgs=*/true,
/*printBlockTerminators=*/printTerminator);
}
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::SwitchOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::SwitchOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::UnaryMinusOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
UnaryMinusOpGenericAdaptorBase::UnaryMinusOpGenericAdaptorBase(UnaryMinusOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
UnaryMinusOpAdaptor::UnaryMinusOpAdaptor(UnaryMinusOp op) : UnaryMinusOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult UnaryMinusOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult UnaryMinusOp::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();
}
return ::mlir::success();
}
::mlir::Attribute UnaryMinusOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code UnaryMinusOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> UnaryMinusOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void UnaryMinusOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void UnaryMinusOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult UnaryMinusOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void UnaryMinusOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
odsState.addTypes(resultType0);
}
UnaryMinusOp UnaryMinusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<UnaryMinusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryMinusOp UnaryMinusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void UnaryMinusOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
UnaryMinusOp UnaryMinusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<UnaryMinusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryMinusOp UnaryMinusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void UnaryMinusOp::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);
}
UnaryMinusOp UnaryMinusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<UnaryMinusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryMinusOp UnaryMinusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void UnaryMinusOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
UnaryMinusOp UnaryMinusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<UnaryMinusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryMinusOp UnaryMinusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult UnaryMinusOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult UnaryMinusOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult UnaryMinusOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void UnaryMinusOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::UnaryMinusOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::UnaryPlusOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
UnaryPlusOpGenericAdaptorBase::UnaryPlusOpGenericAdaptorBase(UnaryPlusOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
} // namespace detail
UnaryPlusOpAdaptor::UnaryPlusOpAdaptor(UnaryPlusOp op) : UnaryPlusOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult UnaryPlusOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
::llvm::LogicalResult UnaryPlusOp::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();
}
return ::mlir::success();
}
::mlir::Attribute UnaryPlusOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code UnaryPlusOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> UnaryPlusOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void UnaryPlusOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void UnaryPlusOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult UnaryPlusOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void UnaryPlusOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
odsState.addTypes(resultType0);
}
UnaryPlusOp UnaryPlusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<UnaryPlusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryPlusOp UnaryPlusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void UnaryPlusOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
odsState.addOperands(odsArg_0);
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
UnaryPlusOp UnaryPlusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
auto __res__ = ::llvm::dyn_cast<UnaryPlusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryPlusOp UnaryPlusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(odsArg_0)>(odsArg_0));
}
void UnaryPlusOp::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);
}
UnaryPlusOp UnaryPlusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<UnaryPlusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryPlusOp UnaryPlusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void UnaryPlusOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 1u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
UnaryPlusOp UnaryPlusOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<UnaryPlusOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
UnaryPlusOp UnaryPlusOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult UnaryPlusOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC1(*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_EmitC1(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult UnaryPlusOp::verifyInvariants() {
return verifyInvariantsImpl();
}
::mlir::ParseResult UnaryPlusOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> allOperands;
::llvm::ArrayRef<::mlir::Type> allOperandTypes;
::llvm::ArrayRef<::mlir::Type> allResultTypes;
[[maybe_unused]] ::llvm::SMLoc allOperandLoc = parser.getCurrentLocation();
if (parser.parseOperandList(allOperands))
return ::mlir::failure();
{
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();
}
if (parser.parseColon())
return ::mlir::failure();
::mlir::FunctionType allOperand__allResult_functionType;
if (parser.parseType(allOperand__allResult_functionType))
return ::mlir::failure();
allOperandTypes = allOperand__allResult_functionType.getInputs();
allResultTypes = allOperand__allResult_functionType.getResults();
result.addTypes(allResultTypes);
if (parser.resolveOperands(allOperands, allOperandTypes, allOperandLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void UnaryPlusOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter << getOperation()->getOperands();
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter.printFunctionalType(getOperation()->getOperandTypes(), getOperation()->getResultTypes());
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::UnaryPlusOp)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::VariableOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
VariableOpGenericAdaptorBase::VariableOpGenericAdaptorBase(VariableOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
::mlir::Attribute VariableOpGenericAdaptorBase::getValue() {
auto attr = getValueAttr();
return attr;
}
} // namespace detail
VariableOpAdaptor::VariableOpAdaptor(VariableOp op) : VariableOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult VariableOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitError(loc, "'emitc.variable' op requires attribute 'value'");
if (tblgen_value && !(((::llvm::isa<::mlir::emitc::OpaqueAttr>(tblgen_value))) || ((::llvm::isa<::mlir::TypedAttr>(tblgen_value)))))
return emitError(loc, "'emitc.variable' op attribute 'value' failed to satisfy constraint: An opaque attribute or TypedAttr instance");
return ::mlir::success();
}
::llvm::LogicalResult VariableOp::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.value;
auto attr = dict.get("value");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute VariableOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.value;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("value",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code VariableOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.value.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> VariableOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "value")
return prop.value;
return std::nullopt;
}
void VariableOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "value") {
prop.value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.value)>>(value);
return;
}
}
void VariableOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.value) attrs.append("value", prop.value);
}
::llvm::LogicalResult VariableOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getValueAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(attr, "value", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult VariableOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.value)))
return ::mlir::failure();
return ::mlir::success();
}
void VariableOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.value);
}
::mlir::Attribute VariableOp::getValue() {
auto attr = getValueAttr();
return attr;
}
void VariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Attribute value) {
odsState.getOrAddProperties<Properties>().value = value;
odsState.addTypes(resultType0);
}
VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Attribute value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<VariableOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Attribute value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultType0)>(resultType0), std::forward<decltype(value)>(value));
}
void VariableOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
odsState.getOrAddProperties<Properties>().value = value;
assert(resultTypes.size() == 1u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<VariableOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value));
}
void VariableOp::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()) {
(void)odsState.getOrAddProperties<VariableOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<VariableOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void VariableOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
assert(operands.size() == 0u && "mismatched number of parameters");
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 1u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
VariableOp VariableOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<VariableOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VariableOp VariableOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult VariableOp::verifyInvariantsImpl() {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitOpError("requires attribute 'value'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC8(*this, tblgen_value, "value")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSResults(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC10(*this, v.getType(), "result", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult VariableOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::llvm::LogicalResult VariableOp::setPropertiesFromParsedAttr(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();
}
// keep track of used keys in the input dictionary to be able to error out
// if there are some unknown ones.
::mlir::DenseSet<::mlir::StringAttr> usedKeys;
::mlir::MLIRContext *ctx = dict.getContext();
(void)ctx;
{
auto &propStorage = prop.value;
auto valueAttrName = ::mlir::StringAttr::get(ctx, "value");
auto attr = dict.get(valueAttrName);
usedKeys.insert(valueAttrName);
if (attr || /*isRequired=*/true) {
if (!attr) {
emitError() << "expected key entry for value in DictionaryAttr to set "
"Properties.";
return ::mlir::failure();
}
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
for (::mlir::NamedAttribute attr : dict) {
if (!usedKeys.contains(attr.getName()))
return emitError() << "unknown key '" << attr.getName() <<
"' when parsing properties dictionary";
}
return ::mlir::success();
}
void VariableOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
{
auto valueRange = getODSResultIndexAndLength(0);
for (unsigned idx = valueRange.first; idx < valueRange.first + valueRange.second; idx++) {
effects.emplace_back(::mlir::MemoryEffects::Allocate::get(), getOperation()->getOpResult(idx), 0, true, ::mlir::SideEffects::DefaultResource::get());
}
}
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::VariableOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::VariableOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::VerbatimOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
VerbatimOpGenericAdaptorBase::VerbatimOpGenericAdaptorBase(VerbatimOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> VerbatimOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::llvm::StringRef VerbatimOpGenericAdaptorBase::getValue() {
auto attr = getValueAttr();
return attr.getValue();
}
} // namespace detail
VerbatimOpAdaptor::VerbatimOpAdaptor(VerbatimOp op) : VerbatimOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult VerbatimOpAdaptor::verify(::mlir::Location loc) {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitError(loc, "'emitc.verbatim' op requires attribute 'value'");
if (tblgen_value && !((::llvm::isa<::mlir::StringAttr>(tblgen_value))))
return emitError(loc, "'emitc.verbatim' op attribute 'value' failed to satisfy constraint: string attribute");
return ::mlir::success();
}
std::pair<unsigned, unsigned> VerbatimOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange VerbatimOp::getFmtArgsMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
::llvm::LogicalResult VerbatimOp::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.value;
auto attr = dict.get("value");
if (attr) {
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
if (convertedAttr) {
propStorage = convertedAttr;
} else {
emitError() << "Invalid attribute `value` in property conversion: " << attr;
return ::mlir::failure();
}
}
}
return ::mlir::success();
}
::mlir::Attribute VerbatimOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
{
const auto &propStorage = prop.value;
if (propStorage)
attrs.push_back(odsBuilder.getNamedAttr("value",
propStorage));
}
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code VerbatimOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine(
llvm::hash_value(prop.value.getAsOpaquePointer()));
}
std::optional<mlir::Attribute> VerbatimOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
if (name == "value")
return prop.value;
return std::nullopt;
}
void VerbatimOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
if (name == "value") {
prop.value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.value)>>(value);
return;
}
}
void VerbatimOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
if (prop.value) attrs.append("value", prop.value);
}
::llvm::LogicalResult VerbatimOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
{
::mlir::Attribute attr = attrs.get(getValueAttrName(opName));
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(attr, "value", emitError)))
return ::mlir::failure();
}
return ::mlir::success();
}
::llvm::LogicalResult VerbatimOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
if (::mlir::failed(reader.readAttribute(prop.value)))
return ::mlir::failure();
return ::mlir::success();
}
void VerbatimOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
auto &prop = getProperties(); (void)prop;
writer.writeAttribute(prop.value);
}
::llvm::StringRef VerbatimOp::getValue() {
auto attr = getValueAttr();
return attr.getValue();
}
void VerbatimOp::setValue(::llvm::StringRef attrValue) {
getProperties().value = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
}
void VerbatimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef value) {
build(odsBuilder, odsState, value, {});
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef value) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(value)>(value));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef value) {
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value));
}
void VerbatimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs) {
odsState.addOperands(fmtArgs);
odsState.getOrAddProperties<Properties>().value = value;
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs) {
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
}
void VerbatimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs) {
odsState.addOperands(fmtArgs);
odsState.getOrAddProperties<Properties>().value = value;
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
}
void VerbatimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs) {
odsState.addOperands(fmtArgs);
odsState.getOrAddProperties<Properties>().value = odsBuilder.getStringAttr(value);
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs) {
return create(builder, builder.getLoc(), std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
}
void VerbatimOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs) {
odsState.addOperands(fmtArgs);
odsState.getOrAddProperties<Properties>().value = odsBuilder.getStringAttr(value);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(value)>(value), std::forward<decltype(fmtArgs)>(fmtArgs));
}
void VerbatimOp::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()) {
(void)odsState.getOrAddProperties<VerbatimOp::Properties>();
::mlir::PropertyRef properties = odsState.getRawProperties();
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.");
}
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void VerbatimOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
VerbatimOp VerbatimOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<VerbatimOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
VerbatimOp VerbatimOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult VerbatimOp::verifyInvariantsImpl() {
auto tblgen_value = getProperties().value; (void)tblgen_value;
if (!tblgen_value) return emitOpError("requires attribute 'value'");
if (::mlir::failed(__mlir_ods_local_attr_constraint_EmitC3(*this, tblgen_value, "value")))
return ::mlir::failure();
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC5(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult VerbatimOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult VerbatimOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::mlir::StringAttr valueAttr;
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> fmtArgsOperands;
::llvm::SMLoc fmtArgsOperandsLoc;
(void)fmtArgsOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> fmtArgsTypes;
if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
return ::mlir::failure();
}
if (valueAttr) result.getOrAddProperties<VerbatimOp::Properties>().value = valueAttr;
if (::mlir::succeeded(parser.parseOptionalKeyword("args"))) {
fmtArgsOperandsLoc = parser.getCurrentLocation();
if (parser.parseOperandList(fmtArgsOperands))
return ::mlir::failure();
if (parser.parseColon())
return ::mlir::failure();
if (parser.parseTypeList(fmtArgsTypes))
return ::mlir::failure();
}
{
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();
}
if (parser.resolveOperands(fmtArgsOperands, fmtArgsTypes, fmtArgsOperandsLoc, result.operands))
return ::mlir::failure();
return ::mlir::success();
}
void VerbatimOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
_odsPrinter << ' ';
_odsPrinter.printAttributeWithoutType(getValueAttr());
if (!getFmtArgs().empty()) {
_odsPrinter << ' ' << "args";
_odsPrinter << ' ';
_odsPrinter << getFmtArgs();
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << getFmtArgs().getTypes();
}
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
elidedAttrs.push_back("value");
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::VerbatimOp)
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::VerbatimOpGenericAdaptorBase::Properties)
namespace mlir::emitc {
//===----------------------------------------------------------------------===//
// ::mlir::emitc::YieldOp definitions
//===----------------------------------------------------------------------===//
namespace detail {
YieldOpGenericAdaptorBase::YieldOpGenericAdaptorBase(YieldOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
std::pair<unsigned, unsigned> YieldOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (odsOperandsSize - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
} // namespace detail
YieldOpAdaptor::YieldOpAdaptor(YieldOp op) : YieldOpGenericAdaptor(op->getOperands(), op) {}
::llvm::LogicalResult YieldOpAdaptor::verify(::mlir::Location loc) {
return ::mlir::success();
}
std::pair<unsigned, unsigned> YieldOp::getODSOperandIndexAndLength(unsigned index) {
bool isVariadic[] = {true};
int prevVariadicCount = 0;
for (unsigned i = 0; i < index; ++i)
if (isVariadic[i]) ++prevVariadicCount;
// Calculate how many dynamic values a static variadic operand corresponds to.
// This assumes all static variadic operands have the same dynamic value count.
int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
// `index` passed in as the parameter is the static index which counts each
// operand (variadic or not) as size 1. So here for each previous static variadic
// operand, we need to offset by (variadicSize - 1) to get where the dynamic
// value pack for this static operand starts.
int start = index + (variadicSize - 1) * prevVariadicCount;
int size = isVariadic[index] ? variadicSize : 1;
return {start, size};
}
::mlir::MutableOperandRange YieldOp::getResultMutable() {
auto range = getODSOperandIndexAndLength(0);
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
return mutableRange;
}
::llvm::LogicalResult YieldOp::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();
}
return ::mlir::success();
}
::mlir::Attribute YieldOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
::mlir::Builder odsBuilder{ctx};
if (!attrs.empty())
return odsBuilder.getDictionaryAttr(attrs);
return {};
}
llvm::hash_code YieldOp::computePropertiesHash(const Properties &prop) {
using llvm::hash_value;
return llvm::hash_combine();
}
std::optional<mlir::Attribute> YieldOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
return std::nullopt;
}
void YieldOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
}
void YieldOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
}
::llvm::LogicalResult YieldOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
return ::mlir::success();
}
void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
/* nothing to do */
}
YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__);
auto __res__ = ::llvm::dyn_cast<YieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder) {
return create(builder, builder.getLoc());
}
void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value result) {
if (result)
odsState.addOperands(result);
}
YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value result) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(result)>(result));
auto __res__ = ::llvm::dyn_cast<YieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value result) {
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result));
}
void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value result) {
if (result)
odsState.addOperands(result);
assert(resultTypes.size() == 0u && "mismatched number of results");
odsState.addTypes(resultTypes);
}
YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value result) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(result)>(result));
auto __res__ = ::llvm::dyn_cast<YieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value result) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(result)>(result));
}
void YieldOp::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);
}
YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
auto __res__ = ::llvm::dyn_cast<YieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
}
void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
odsState.addOperands(operands);
odsState.useProperties(const_cast<Properties&>(properties));
odsState.addAttributes(discardableAttributes);
assert(resultTypes.size() == 0u && "mismatched number of return types");
odsState.addTypes(resultTypes);
}
YieldOp YieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
::mlir::OperationState __state__(location, getOperationName());
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
auto __res__ = ::llvm::dyn_cast<YieldOp>(builder.create(__state__));
assert(__res__ && "builder didn't return the right type");
return __res__;
}
YieldOp YieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
}
::llvm::LogicalResult YieldOp::verifyInvariantsImpl() {
{
unsigned index = 0; (void)index;
auto valueGroup0 = getODSOperands(0);
if (valueGroup0.size() > 1) {
return emitOpError("operand group starting at #") << index
<< " requires 0 or 1 element, but found " << valueGroup0.size();
}
for (auto v : valueGroup0) {
if (::mlir::failed(__mlir_ods_local_type_constraint_EmitC8(*this, v.getType(), "operand", index++)))
return ::mlir::failure();
}
}
return ::mlir::success();
}
::llvm::LogicalResult YieldOp::verifyInvariants() {
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
return ::mlir::success();
return ::mlir::failure();
}
::mlir::ParseResult YieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> resultOperands;
::llvm::SMLoc resultOperandsLoc;
(void)resultOperandsLoc;
::llvm::SmallVector<::mlir::Type, 1> resultTypes;
{
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();
}
{
resultOperandsLoc = parser.getCurrentLocation();
::mlir::OpAsmParser::UnresolvedOperand operand;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalOperand(operand);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
resultOperands.push_back(operand);
}
}
if (!resultOperands.empty()) {
if (parser.parseColon())
return ::mlir::failure();
{
::mlir::Type optionalType;
::mlir::OptionalParseResult parseResult =
parser.parseOptionalType(optionalType);
if (parseResult.has_value()) {
if (failed(*parseResult))
return ::mlir::failure();
resultTypes.push_back(optionalType);
}
}
}
if (!resultOperands.empty()) {
if (parser.resolveOperands(resultOperands, resultTypes, resultOperandsLoc, result.operands))
return ::mlir::failure();
}
return ::mlir::success();
}
void YieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
if (getResult()) {
_odsPrinter << ' ';
if (::mlir::Value value = getResult())
_odsPrinter << value;
_odsPrinter << ' ' << ":";
_odsPrinter << ' ';
_odsPrinter << (getResult() ? ::llvm::ArrayRef<::mlir::Type>(getResult().getType()) : ::llvm::ArrayRef<::mlir::Type>());
}
}
void YieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
}
} // namespace mlir::emitc
MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::emitc::YieldOp)
#endif // GET_OP_CLASSES