10563 lines
517 KiB
C++
10563 lines
517 KiB
C++
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|
|
|* *|
|
|
|* Op Definitions *|
|
|
|* *|
|
|
|* Automatically generated file, do not edit! *|
|
|
|* From: OM.td *|
|
|
|* *|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
#ifdef GET_OP_LIST
|
|
#undef GET_OP_LIST
|
|
|
|
::circt::om::AnyCastOp,
|
|
::circt::om::BasePathCreateOp,
|
|
::circt::om::ClassExternOp,
|
|
::circt::om::ClassFieldsOp,
|
|
::circt::om::ClassOp,
|
|
::circt::om::ConstantOp,
|
|
::circt::om::ElaboratedObjectOp,
|
|
::circt::om::EmptyPathOp,
|
|
::circt::om::FrozenBasePathCreateOp,
|
|
::circt::om::FrozenEmptyPathOp,
|
|
::circt::om::FrozenPathCreateOp,
|
|
::circt::om::IntegerAddOp,
|
|
::circt::om::IntegerAndOp,
|
|
::circt::om::IntegerMulOp,
|
|
::circt::om::IntegerOrOp,
|
|
::circt::om::IntegerShlOp,
|
|
::circt::om::IntegerShrOp,
|
|
::circt::om::IntegerXorOp,
|
|
::circt::om::ListConcatOp,
|
|
::circt::om::ListCreateOp,
|
|
::circt::om::ObjectFieldOp,
|
|
::circt::om::ObjectOp,
|
|
::circt::om::PathCreateOp,
|
|
::circt::om::PropEqOp,
|
|
::circt::om::PropertyAssertOp,
|
|
::circt::om::StringConcatOp,
|
|
::circt::om::UnknownValueOp
|
|
#endif // GET_OP_LIST
|
|
|
|
#ifdef GET_OP_CLASSES
|
|
#undef GET_OP_CLASSES
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Local Utility Method Definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM1(
|
|
::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_OM2(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::AnyType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A type that represents any valid OM type., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM3(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::BasePathType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A fragment of a path to a hardware component, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM4(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(!((::llvm::isa<::mlir::TokenType>(type))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of any non-token type, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM5(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::ClassType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A type that represents a reference to a Class., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM6(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::PathType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A path to a hardware component, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM7(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::FrozenBasePathType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A frozen fragment of a path to a hardware component, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM8(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::FrozenPathType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A frozen path to a hardware component, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM9(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::OMIntegerType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A type that represents an arbitrary width integer., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM10(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::mlir::IntegerType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM11(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::ListType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of A type that represents a list., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM12(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::ListType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A type that represents a list., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM13(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!(((::llvm::isa<::circt::om::StringType>(type))) || ((::llvm::isa<::circt::om::OMIntegerType>(type))) || ((type.isSignlessInteger(1))))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A type that represents a string. or A type that represents an arbitrary width integer. or 1-bit signless integer, but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM14(
|
|
::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_OM15(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::StringType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be variadic of A type that represents a string., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_type_constraint_OM16(
|
|
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
|
|
unsigned valueIndex) {
|
|
if (!((::llvm::isa<::circt::om::StringType>(type)))) {
|
|
return op->emitOpError(valueKind) << " #" << valueIndex
|
|
<< " must be A type that represents a string., but got " << type;
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM1(
|
|
::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_OM1(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM1(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM2(
|
|
::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_OM2(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM2(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM3(
|
|
::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_OM3(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM3(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM4(
|
|
::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_OM4(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM4(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM5(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::DictionaryAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: dictionary of named attribute values";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM5(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM5(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM6(
|
|
::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::LocationAttr>(attr))); }))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: location array attribute";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM6(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM6(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM7(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::mlir::TypedAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: TypedAttr instance";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM7(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM7(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM8(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::circt::om::PathAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: An attribute that represents an instance path";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM8(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM8(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM9(
|
|
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
if (attr && !((::llvm::isa<::circt::om::TargetKindAttr>(attr))))
|
|
return emitError() << "attribute '" << attrName
|
|
<< "' failed to satisfy constraint: object model target kind";
|
|
return ::mlir::success();
|
|
}
|
|
static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_OM9(
|
|
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
|
|
return __mlir_ods_local_attr_constraint_OM9(attr, attrName, [op]() {
|
|
return op->emitOpError();
|
|
});
|
|
}
|
|
|
|
static ::llvm::LogicalResult __mlir_ods_local_region_constraint_OM1(
|
|
::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
|
|
unsigned regionIndex) {
|
|
if (!((::llvm::hasNItems(region, 1)))) {
|
|
return op->emitOpError("region #") << regionIndex
|
|
<< (regionName.empty() ? " " : " ('" + regionName + "') ")
|
|
<< "failed to verify constraint: region with 1 blocks";
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::AnyCastOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
AnyCastOpGenericAdaptorBase::AnyCastOpGenericAdaptorBase(AnyCastOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
AnyCastOpAdaptor::AnyCastOpAdaptor(AnyCastOp op) : AnyCastOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult AnyCastOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AnyCastOp::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 AnyCastOp::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 AnyCastOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> AnyCastOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void AnyCastOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void AnyCastOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult AnyCastOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AnyCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value input) {
|
|
odsState.addOperands(input);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value input) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(input)>(input));
|
|
auto __res__ = ::llvm::dyn_cast<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value input) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(input)>(input));
|
|
}
|
|
|
|
void AnyCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input) {
|
|
odsState.addOperands(input);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AnyCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value input) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(input)>(input));
|
|
auto __res__ = ::llvm::dyn_cast<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value input) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(input)>(input));
|
|
}
|
|
|
|
void AnyCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) {
|
|
odsState.addOperands(input);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value input) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(input)>(input));
|
|
auto __res__ = ::llvm::dyn_cast<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value input) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(input)>(input));
|
|
}
|
|
|
|
void AnyCastOp::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);
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::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<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::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 AnyCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AnyCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void AnyCastOp::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);
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::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<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::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 AnyCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(AnyCastOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<AnyCastOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
AnyCastOp AnyCastOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult AnyCastOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM1(*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_OM2(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult AnyCastOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult AnyCastOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::AnyType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult AnyCastOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc;
|
|
(void)inputOperandsLoc;
|
|
::llvm::ArrayRef<::mlir::Type> inputTypes;
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes;
|
|
|
|
inputOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(inputRawOperand))
|
|
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 input__result_functionType;
|
|
if (parser.parseType(input__result_functionType))
|
|
return ::mlir::failure();
|
|
inputTypes = input__result_functionType.getInputs();
|
|
resultTypes = input__result_functionType.getResults();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void AnyCastOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getInput();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getInput().getType()), ::llvm::ArrayRef<::mlir::Type>(getResult().getType()));
|
|
}
|
|
|
|
void AnyCastOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::AnyCastOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::BasePathCreateOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
BasePathCreateOpGenericAdaptorBase::BasePathCreateOpGenericAdaptorBase(BasePathCreateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef BasePathCreateOpGenericAdaptorBase::getTarget() {
|
|
auto attr = getTargetAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
BasePathCreateOpAdaptor::BasePathCreateOpAdaptor(BasePathCreateOp op) : BasePathCreateOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult BasePathCreateOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_target = getProperties().target; (void)tblgen_target;
|
|
if (!tblgen_target) return emitError(loc, "'om.basepath_create' op requires attribute 'target'");
|
|
|
|
if (tblgen_target && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_target))))
|
|
return emitError(loc, "'om.basepath_create' op attribute 'target' failed to satisfy constraint: flat symbol reference attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BasePathCreateOp::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.target;
|
|
auto attr = dict.get("target");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute BasePathCreateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.target;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("target",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code BasePathCreateOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.target.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> BasePathCreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "target")
|
|
return prop.target;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void BasePathCreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "target") {
|
|
prop.target = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.target)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void BasePathCreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.target) attrs.append("target", prop.target);
|
|
}
|
|
|
|
::llvm::LogicalResult BasePathCreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM1(attr, "target", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BasePathCreateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.target)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BasePathCreateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.target);
|
|
}
|
|
|
|
::llvm::StringRef BasePathCreateOp::getTarget() {
|
|
auto attr = getTargetAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void BasePathCreateOp::setTarget(::llvm::StringRef attrValue) {
|
|
getProperties().target = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().target = target;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().target = target;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(BasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().target = target;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().target = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), target);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().target = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), target);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(BasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().target = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), target);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void BasePathCreateOp::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<BasePathCreateOp::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.");
|
|
}
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::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<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::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 BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<BasePathCreateOp::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.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(BasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void BasePathCreateOp::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);
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::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<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::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 BasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(BasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<BasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
BasePathCreateOp BasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult BasePathCreateOp::verifyInvariantsImpl() {
|
|
auto tblgen_target = getProperties().target; (void)tblgen_target;
|
|
if (!tblgen_target) return emitOpError("requires attribute 'target'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM1(*this, tblgen_target, "target")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM3(*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_OM3(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult BasePathCreateOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult BasePathCreateOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::BasePathType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult BasePathCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand basePathRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> basePathOperands(&basePathRawOperand, 1); ::llvm::SMLoc basePathOperandsLoc;
|
|
(void)basePathOperandsLoc;
|
|
::mlir::FlatSymbolRefAttr targetAttr;
|
|
|
|
basePathOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(basePathRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(targetAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (targetAttr) result.getOrAddProperties<BasePathCreateOp::Properties>().target = targetAttr;
|
|
{
|
|
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();
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::BasePathType>();
|
|
result.addTypes(odsBuildableType0);
|
|
if (parser.resolveOperands(basePathOperands, odsBuildableType0, basePathOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void BasePathCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBasePath();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getTargetAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("target");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void BasePathCreateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::BasePathCreateOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::BasePathCreateOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ClassExternOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ClassExternOpGenericAdaptorBase::ClassExternOpGenericAdaptorBase(ClassExternOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef ClassExternOpGenericAdaptorBase::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassExternOpGenericAdaptorBase::getFormalParamNames() {
|
|
auto attr = getFormalParamNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassExternOpGenericAdaptorBase::getFieldNames() {
|
|
auto attr = getFieldNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::DictionaryAttr ClassExternOpGenericAdaptorBase::getFieldTypes() {
|
|
auto attr = getFieldTypesAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ClassExternOpAdaptor::ClassExternOpAdaptor(ClassExternOp op) : ClassExternOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ClassExternOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fieldNames = getProperties().fieldNames; (void)tblgen_fieldNames;
|
|
if (!tblgen_fieldNames) return emitError(loc, "'om.class.extern' op requires attribute 'fieldNames'");
|
|
auto tblgen_fieldTypes = getProperties().fieldTypes; (void)tblgen_fieldTypes;
|
|
if (!tblgen_fieldTypes) return emitError(loc, "'om.class.extern' op requires attribute 'fieldTypes'");
|
|
auto tblgen_formalParamNames = getProperties().formalParamNames; (void)tblgen_formalParamNames;
|
|
if (!tblgen_formalParamNames) return emitError(loc, "'om.class.extern' op requires attribute 'formalParamNames'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'om.class.extern' op requires attribute 'sym_name'");
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'om.class.extern' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_formalParamNames && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_formalParamNames))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_formalParamNames), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
|
|
return emitError(loc, "'om.class.extern' op attribute 'formalParamNames' failed to satisfy constraint: string array attribute");
|
|
|
|
if (tblgen_fieldNames && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_fieldNames))))
|
|
return emitError(loc, "'om.class.extern' op attribute 'fieldNames' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_fieldTypes && !((::llvm::isa<::mlir::DictionaryAttr>(tblgen_fieldTypes))))
|
|
return emitError(loc, "'om.class.extern' op attribute 'fieldTypes' failed to satisfy constraint: dictionary of named attribute values");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassExternOp::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.fieldNames;
|
|
auto attr = dict.get("fieldNames");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fieldNames` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fieldTypes;
|
|
auto attr = dict.get("fieldTypes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fieldTypes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.formalParamNames;
|
|
auto attr = dict.get("formalParamNames");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `formalParamNames` 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 ClassExternOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.fieldNames;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fieldNames",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fieldTypes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fieldTypes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.formalParamNames;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("formalParamNames",
|
|
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 ClassExternOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.fieldNames.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fieldTypes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.formalParamNames.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ClassExternOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "fieldNames")
|
|
return prop.fieldNames;
|
|
|
|
if (name == "fieldTypes")
|
|
return prop.fieldTypes;
|
|
|
|
if (name == "formalParamNames")
|
|
return prop.formalParamNames;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ClassExternOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fieldNames") {
|
|
prop.fieldNames = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fieldNames)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fieldTypes") {
|
|
prop.fieldTypes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fieldTypes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "formalParamNames") {
|
|
prop.formalParamNames = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.formalParamNames)>>(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 ClassExternOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.fieldNames) attrs.append("fieldNames", prop.fieldNames);
|
|
|
|
if (prop.fieldTypes) attrs.append("fieldTypes", prop.fieldTypes);
|
|
|
|
if (prop.formalParamNames) attrs.append("formalParamNames", prop.formalParamNames);
|
|
|
|
if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
|
|
}
|
|
|
|
::llvm::LogicalResult ClassExternOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFieldNamesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM4(attr, "fieldNames", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFieldTypesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM5(attr, "fieldTypes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFormalParamNamesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM3(attr, "formalParamNames", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(attr, "sym_name", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassExternOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.fieldNames)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.fieldTypes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.formalParamNames)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.sym_name)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ClassExternOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.fieldNames);
|
|
writer.writeAttribute(prop.fieldTypes);
|
|
writer.writeAttribute(prop.formalParamNames);
|
|
writer.writeAttribute(prop.sym_name);
|
|
}
|
|
|
|
::llvm::StringRef ClassExternOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassExternOp::getFormalParamNames() {
|
|
auto attr = getFormalParamNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassExternOp::getFieldNames() {
|
|
auto attr = getFieldNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::DictionaryAttr ClassExternOp::getFieldTypes() {
|
|
auto attr = getFieldTypesAttr();
|
|
return attr;
|
|
}
|
|
|
|
void ClassExternOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayRef<::mlir::Attribute> fieldNames, ::mlir::ArrayRef<::mlir::NamedAttribute> fieldTypes) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr(formalParamNames),
|
|
odsBuilder.getArrayAttr(fieldNames),
|
|
odsBuilder.getDictionaryAttr(fieldTypes));
|
|
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayRef<::mlir::Attribute> fieldNames, ::mlir::ArrayRef<::mlir::NamedAttribute> fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayRef<::mlir::Attribute> fieldNames, ::mlir::ArrayRef<::mlir::NamedAttribute> fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr(formalParamNames));
|
|
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr({}));
|
|
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Twine name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr({}), fieldNames, fieldTypes);
|
|
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Twine name, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr(formalParamNames), fieldNames,
|
|
fieldTypes);
|
|
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::ArrayAttr formalParamNames) {
|
|
build(odsBuilder, odsState, name, formalParamNames,
|
|
odsBuilder.getArrayAttr({}), odsBuilder.getDictionaryAttr({}));
|
|
|
|
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr name, ::mlir::ArrayAttr formalParamNames) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr name, ::mlir::ArrayAttr formalParamNames) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(void)odsState.addRegion();
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
auto __res__ = ::llvm::dyn_cast<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassExternOp::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<ClassExternOp::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.");
|
|
}
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::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<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::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 ClassExternOp::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);
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::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<ClassExternOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassExternOp ClassExternOp::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 ClassExternOp::verifyInvariantsImpl() {
|
|
auto tblgen_fieldNames = getProperties().fieldNames; (void)tblgen_fieldNames;
|
|
if (!tblgen_fieldNames) return emitOpError("requires attribute 'fieldNames'");
|
|
auto tblgen_fieldTypes = getProperties().fieldTypes; (void)tblgen_fieldTypes;
|
|
if (!tblgen_fieldTypes) return emitOpError("requires attribute 'fieldTypes'");
|
|
auto tblgen_formalParamNames = getProperties().formalParamNames; (void)tblgen_formalParamNames;
|
|
if (!tblgen_formalParamNames) return emitOpError("requires attribute 'formalParamNames'");
|
|
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_OM2(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM3(*this, tblgen_formalParamNames, "formalParamNames")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM4(*this, tblgen_fieldNames, "fieldNames")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM5(*this, tblgen_fieldTypes, "fieldTypes")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
|
|
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
|
|
if (::mlir::failed(__mlir_ods_local_region_constraint_OM1(*this, region, "body", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassExternOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassExternOp::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.formalParamNames;
|
|
auto formalParamNamesAttrName = ::mlir::StringAttr::get(ctx, "formalParamNames");
|
|
auto attr = dict.get(formalParamNamesAttrName);
|
|
usedKeys.insert(formalParamNamesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for formalParamNames 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 `formalParamNames` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fieldNames;
|
|
auto fieldNamesAttrName = ::mlir::StringAttr::get(ctx, "fieldNames");
|
|
auto attr = dict.get(fieldNamesAttrName);
|
|
usedKeys.insert(fieldNamesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fieldNames 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 `fieldNames` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fieldTypes;
|
|
auto fieldTypesAttrName = ::mlir::StringAttr::get(ctx, "fieldTypes");
|
|
auto attr = dict.get(fieldTypesAttrName);
|
|
usedKeys.insert(fieldTypesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fieldTypes 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 `fieldTypes` 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 circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ClassExternOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ClassExternOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ClassFieldsOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ClassFieldsOpGenericAdaptorBase::ClassFieldsOpGenericAdaptorBase(ClassFieldsOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> ClassFieldsOpGenericAdaptorBase::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};
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > ClassFieldsOpGenericAdaptorBase::getFieldLocs() {
|
|
auto attr = getFieldLocsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ClassFieldsOpAdaptor::ClassFieldsOpAdaptor(ClassFieldsOp op) : ClassFieldsOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ClassFieldsOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_field_locs = getProperties().field_locs; (void)tblgen_field_locs;
|
|
|
|
if (tblgen_field_locs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_field_locs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_field_locs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::LocationAttr>(attr))); }))))
|
|
return emitError(loc, "'om.class.fields' op attribute 'field_locs' failed to satisfy constraint: location array attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> ClassFieldsOp::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 ClassFieldsOp::getFieldsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult ClassFieldsOp::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_locs;
|
|
auto attr = dict.get("field_locs");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `field_locs` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ClassFieldsOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.field_locs;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("field_locs",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ClassFieldsOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.field_locs.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ClassFieldsOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "field_locs")
|
|
return prop.field_locs;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ClassFieldsOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "field_locs") {
|
|
prop.field_locs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.field_locs)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ClassFieldsOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.field_locs) attrs.append("field_locs", prop.field_locs);
|
|
}
|
|
|
|
::llvm::LogicalResult ClassFieldsOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFieldLocsAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM6(attr, "field_locs", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassFieldsOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readOptionalAttribute(prop.field_locs)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ClassFieldsOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
|
|
writer.writeOptionalAttribute(prop.field_locs);
|
|
}
|
|
|
|
::std::optional< ::mlir::ArrayAttr > ClassFieldsOp::getFieldLocs() {
|
|
auto attr = getFieldLocsAttr();
|
|
return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
|
|
}
|
|
|
|
void ClassFieldsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange fields, /*optional*/::mlir::ArrayAttr field_locs) {
|
|
odsState.addOperands(fields);
|
|
if (field_locs) {
|
|
odsState.getOrAddProperties<Properties>().field_locs = field_locs;
|
|
}
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange fields, /*optional*/::mlir::ArrayAttr field_locs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(fields)>(fields), std::forward<decltype(field_locs)>(field_locs));
|
|
auto __res__ = ::llvm::dyn_cast<ClassFieldsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange fields, /*optional*/::mlir::ArrayAttr field_locs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(fields)>(fields), std::forward<decltype(field_locs)>(field_locs));
|
|
}
|
|
|
|
void ClassFieldsOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange fields, /*optional*/::mlir::ArrayAttr field_locs) {
|
|
odsState.addOperands(fields);
|
|
if (field_locs) {
|
|
odsState.getOrAddProperties<Properties>().field_locs = field_locs;
|
|
}
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange fields, /*optional*/::mlir::ArrayAttr field_locs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(fields)>(fields), std::forward<decltype(field_locs)>(field_locs));
|
|
auto __res__ = ::llvm::dyn_cast<ClassFieldsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange fields, /*optional*/::mlir::ArrayAttr field_locs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(fields)>(fields), std::forward<decltype(field_locs)>(field_locs));
|
|
}
|
|
|
|
void ClassFieldsOp::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<ClassFieldsOp::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.");
|
|
}
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::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<ClassFieldsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::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 ClassFieldsOp::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);
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::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<ClassFieldsOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ClassFieldsOp ClassFieldsOp::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 ClassFieldsOp::verifyInvariantsImpl() {
|
|
auto tblgen_field_locs = getProperties().field_locs; (void)tblgen_field_locs;
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM6(*this, tblgen_field_locs, "field_locs")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM4(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassFieldsOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::mlir::ParseResult ClassFieldsOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> fieldsOperands;
|
|
::llvm::SMLoc fieldsOperandsLoc;
|
|
(void)fieldsOperandsLoc;
|
|
::llvm::SmallVector<::mlir::Type, 1> fieldsTypes;
|
|
::mlir::ArrayAttr field_locsAttr;
|
|
{
|
|
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();
|
|
}
|
|
|
|
fieldsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(fieldsOperands))
|
|
return ::mlir::failure();
|
|
if (!fieldsOperands.empty()) {
|
|
if (parser.parseColon())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseTypeList(fieldsTypes))
|
|
return ::mlir::failure();
|
|
}
|
|
{
|
|
auto odsResult = parseFieldLocs(parser, field_locsAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
if (field_locsAttr)
|
|
result.getOrAddProperties<ClassFieldsOp::Properties>().field_locs = field_locsAttr;
|
|
}
|
|
if (parser.resolveOperands(fieldsOperands, fieldsTypes, fieldsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ClassFieldsOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("field_locs");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
if (!getFields().empty()) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getFields();
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getFields().getTypes();
|
|
}
|
|
_odsPrinter << ' ';
|
|
printFieldLocs(_odsPrinter, *this, getFieldLocsAttr());
|
|
}
|
|
|
|
void ClassFieldsOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ClassFieldsOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ClassFieldsOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::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::ArrayAttr ClassOpGenericAdaptorBase::getFormalParamNames() {
|
|
auto attr = getFormalParamNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassOpGenericAdaptorBase::getFieldNames() {
|
|
auto attr = getFieldNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::DictionaryAttr ClassOpGenericAdaptorBase::getFieldTypes() {
|
|
auto attr = getFieldTypesAttr();
|
|
return attr;
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ClassOpAdaptor::ClassOpAdaptor(ClassOp op) : ClassOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ClassOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_fieldNames = getProperties().fieldNames; (void)tblgen_fieldNames;
|
|
if (!tblgen_fieldNames) return emitError(loc, "'om.class' op requires attribute 'fieldNames'");
|
|
auto tblgen_fieldTypes = getProperties().fieldTypes; (void)tblgen_fieldTypes;
|
|
if (!tblgen_fieldTypes) return emitError(loc, "'om.class' op requires attribute 'fieldTypes'");
|
|
auto tblgen_formalParamNames = getProperties().formalParamNames; (void)tblgen_formalParamNames;
|
|
if (!tblgen_formalParamNames) return emitError(loc, "'om.class' op requires attribute 'formalParamNames'");
|
|
auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
|
|
if (!tblgen_sym_name) return emitError(loc, "'om.class' op requires attribute 'sym_name'");
|
|
|
|
if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
|
|
return emitError(loc, "'om.class' op attribute 'sym_name' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_formalParamNames && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_formalParamNames))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_formalParamNames), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
|
|
return emitError(loc, "'om.class' op attribute 'formalParamNames' failed to satisfy constraint: string array attribute");
|
|
|
|
if (tblgen_fieldNames && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_fieldNames))))
|
|
return emitError(loc, "'om.class' op attribute 'fieldNames' failed to satisfy constraint: array attribute");
|
|
|
|
if (tblgen_fieldTypes && !((::llvm::isa<::mlir::DictionaryAttr>(tblgen_fieldTypes))))
|
|
return emitError(loc, "'om.class' op attribute 'fieldTypes' failed to satisfy constraint: dictionary of named attribute values");
|
|
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.fieldNames;
|
|
auto attr = dict.get("fieldNames");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fieldNames` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.fieldTypes;
|
|
auto attr = dict.get("fieldTypes");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `fieldTypes` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.formalParamNames;
|
|
auto attr = dict.get("formalParamNames");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `formalParamNames` 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.fieldNames;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fieldNames",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.fieldTypes;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("fieldTypes",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.formalParamNames;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("formalParamNames",
|
|
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.fieldNames.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.fieldTypes.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.formalParamNames.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 == "fieldNames")
|
|
return prop.fieldNames;
|
|
|
|
if (name == "fieldTypes")
|
|
return prop.fieldTypes;
|
|
|
|
if (name == "formalParamNames")
|
|
return prop.formalParamNames;
|
|
|
|
if (name == "sym_name")
|
|
return prop.sym_name;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ClassOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "fieldNames") {
|
|
prop.fieldNames = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fieldNames)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "fieldTypes") {
|
|
prop.fieldTypes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.fieldTypes)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "formalParamNames") {
|
|
prop.formalParamNames = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.formalParamNames)>>(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.fieldNames) attrs.append("fieldNames", prop.fieldNames);
|
|
|
|
if (prop.fieldTypes) attrs.append("fieldTypes", prop.fieldTypes);
|
|
|
|
if (prop.formalParamNames) attrs.append("formalParamNames", prop.formalParamNames);
|
|
|
|
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(getFieldNamesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM4(attr, "fieldNames", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFieldTypesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM5(attr, "fieldTypes", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFormalParamNamesAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM3(attr, "formalParamNames", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(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.readAttribute(prop.fieldNames)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.fieldTypes)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.formalParamNames)))
|
|
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.writeAttribute(prop.fieldNames);
|
|
writer.writeAttribute(prop.fieldTypes);
|
|
writer.writeAttribute(prop.formalParamNames);
|
|
writer.writeAttribute(prop.sym_name);
|
|
}
|
|
|
|
::llvm::StringRef ClassOp::getSymName() {
|
|
auto attr = getSymNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassOp::getFormalParamNames() {
|
|
auto attr = getFormalParamNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::ArrayAttr ClassOp::getFieldNames() {
|
|
auto attr = getFieldNamesAttr();
|
|
return attr;
|
|
}
|
|
|
|
::mlir::DictionaryAttr ClassOp::getFieldTypes() {
|
|
auto attr = getFieldTypesAttr();
|
|
return attr;
|
|
}
|
|
|
|
void ClassOp::setSymName(::llvm::StringRef attrValue) {
|
|
getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayRef<::mlir::Attribute> fieldNames, ::mlir::ArrayRef<::mlir::NamedAttribute> fieldTypes) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr(formalParamNames),
|
|
odsBuilder.getArrayAttr(fieldNames),
|
|
odsBuilder.getDictionaryAttr(fieldTypes));
|
|
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayRef<::mlir::Attribute> fieldNames, ::mlir::ArrayRef<::mlir::NamedAttribute> fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayRef<::mlir::Attribute> fieldNames, ::mlir::ArrayRef<::mlir::NamedAttribute> fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr(formalParamNames));
|
|
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
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::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr({}));
|
|
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name));
|
|
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::Twine name) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr({}), fieldNames, fieldTypes);
|
|
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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::Twine name, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
build(odsBuilder, odsState, odsBuilder.getStringAttr(name),
|
|
odsBuilder.getStrArrayAttr(formalParamNames), fieldNames,
|
|
fieldTypes);
|
|
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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::Twine name, ::mlir::ArrayRef<::mlir::StringRef> formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr name, ::mlir::ArrayAttr formalParamNames) {
|
|
build(odsBuilder, odsState, name, formalParamNames,
|
|
odsBuilder.getArrayAttr({}), odsBuilder.getDictionaryAttr({}));
|
|
|
|
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr name, ::mlir::ArrayAttr formalParamNames) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
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 name, ::mlir::ArrayAttr formalParamNames) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(name)>(name), std::forward<decltype(formalParamNames)>(formalParamNames));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = sym_name;
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(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, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(void)odsState.addRegion();
|
|
}
|
|
|
|
ClassOp ClassOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
void ClassOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
|
|
odsState.getOrAddProperties<Properties>().formalParamNames = formalParamNames;
|
|
odsState.getOrAddProperties<Properties>().fieldNames = fieldNames;
|
|
odsState.getOrAddProperties<Properties>().fieldTypes = fieldTypes;
|
|
(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, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
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, ::mlir::ArrayAttr formalParamNames, ::mlir::ArrayAttr fieldNames, ::mlir::DictionaryAttr fieldTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(sym_name)>(sym_name), std::forward<decltype(formalParamNames)>(formalParamNames), std::forward<decltype(fieldNames)>(fieldNames), std::forward<decltype(fieldTypes)>(fieldTypes));
|
|
}
|
|
|
|
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));
|
|
}
|
|
|
|
::llvm::LogicalResult ClassOp::verifyInvariantsImpl() {
|
|
auto tblgen_fieldNames = getProperties().fieldNames; (void)tblgen_fieldNames;
|
|
if (!tblgen_fieldNames) return emitOpError("requires attribute 'fieldNames'");
|
|
auto tblgen_fieldTypes = getProperties().fieldTypes; (void)tblgen_fieldTypes;
|
|
if (!tblgen_fieldTypes) return emitOpError("requires attribute 'fieldTypes'");
|
|
auto tblgen_formalParamNames = getProperties().formalParamNames; (void)tblgen_formalParamNames;
|
|
if (!tblgen_formalParamNames) return emitOpError("requires attribute 'formalParamNames'");
|
|
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_OM2(*this, tblgen_sym_name, "sym_name")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM3(*this, tblgen_formalParamNames, "formalParamNames")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM4(*this, tblgen_fieldNames, "fieldNames")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM5(*this, tblgen_fieldTypes, "fieldTypes")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
|
|
for (auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
|
|
if (::mlir::failed(__mlir_ods_local_region_constraint_OM1(*this, region, "body", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassOp::verifyInvariants() {
|
|
if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
|
|
return ::mlir::success();
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
::llvm::LogicalResult ClassOp::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.formalParamNames;
|
|
auto formalParamNamesAttrName = ::mlir::StringAttr::get(ctx, "formalParamNames");
|
|
auto attr = dict.get(formalParamNamesAttrName);
|
|
usedKeys.insert(formalParamNamesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for formalParamNames 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 `formalParamNames` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fieldNames;
|
|
auto fieldNamesAttrName = ::mlir::StringAttr::get(ctx, "fieldNames");
|
|
auto attr = dict.get(fieldNamesAttrName);
|
|
usedKeys.insert(fieldNamesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fieldNames 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 `fieldNames` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
{
|
|
|
|
auto &propStorage = prop.fieldTypes;
|
|
auto fieldTypesAttrName = ::mlir::StringAttr::get(ctx, "fieldTypes");
|
|
auto attr = dict.get(fieldTypesAttrName);
|
|
usedKeys.insert(fieldTypesAttrName);
|
|
if (attr || /*isRequired=*/true) {
|
|
if (!attr) {
|
|
emitError() << "expected key entry for fieldTypes 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 `fieldTypes` 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 circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ClassOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ClassOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ConstantOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ConstantOpGenericAdaptorBase::ConstantOpGenericAdaptorBase(ConstantOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::mlir::TypedAttr 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, "'om.constant' op requires attribute 'value'");
|
|
|
|
if (tblgen_value && !((::llvm::isa<::mlir::TypedAttr>(tblgen_value))))
|
|
return emitError(loc, "'om.constant' op attribute 'value' failed to satisfy constraint: 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_OM7(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::TypedAttr ConstantOp::getValue() {
|
|
auto attr = getValueAttr();
|
|
return attr;
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypedAttr constVal) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(constVal)>(constVal));
|
|
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::TypedAttr constVal) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(constVal)>(constVal));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::TypedAttr value) {
|
|
odsState.getOrAddProperties<Properties>().value = value;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::TypedAttr value) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), 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 result, ::mlir::TypedAttr value) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(value)>(value));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::TypedAttr 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::TypedAttr 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::TypedAttr 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 &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(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.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, 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::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), 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));
|
|
}
|
|
|
|
void ConstantOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(ConstantOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
ConstantOp ConstantOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, 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::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), 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_OM7(*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_OM1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!(((getValue().getType()) == ((*this->getODSResults(0).begin()).getType()) && ((*this->getODSResults(0).begin()).getType()) == (getValue().getType()))))
|
|
return emitOpError("failed to verify that all of {value, result} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult ConstantOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::TypedAttr odsInferredTypeAttr0 = (properties ? properties.as<Properties *>()->value : ::llvm::dyn_cast_or_null<::mlir::TypedAttr>(attributes.get("value")));
|
|
if (!odsInferredTypeAttr0) return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = odsInferredTypeAttr0.getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult ConstantOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::TypedAttr valueAttr;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(valueAttr, ::mlir::Type{})) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (valueAttr) result.getOrAddProperties<ConstantOp::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();
|
|
}
|
|
result.addTypes(valueAttr.getType());
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ConstantOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printStrippedAttrOrType(getValueAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("value");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void ConstantOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ConstantOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ConstantOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ElaboratedObjectOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ElaboratedObjectOpGenericAdaptorBase::ElaboratedObjectOpGenericAdaptorBase(ElaboratedObjectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> ElaboratedObjectOpGenericAdaptorBase::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 ElaboratedObjectOpGenericAdaptorBase::getClassName() {
|
|
auto attr = getClassNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ElaboratedObjectOpAdaptor::ElaboratedObjectOpAdaptor(ElaboratedObjectOp op) : ElaboratedObjectOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ElaboratedObjectOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_className = getProperties().className; (void)tblgen_className;
|
|
if (!tblgen_className) return emitError(loc, "'om.elaborated_object' op requires attribute 'className'");
|
|
|
|
if (tblgen_className && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_className))))
|
|
return emitError(loc, "'om.elaborated_object' op attribute 'className' failed to satisfy constraint: flat symbol reference attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> ElaboratedObjectOp::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 ElaboratedObjectOp::getFieldValuesMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult ElaboratedObjectOp::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.className;
|
|
auto attr = dict.get("className");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `className` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ElaboratedObjectOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.className;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("className",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ElaboratedObjectOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.className.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ElaboratedObjectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "className")
|
|
return prop.className;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ElaboratedObjectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "className") {
|
|
prop.className = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.className)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ElaboratedObjectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.className) attrs.append("className", prop.className);
|
|
}
|
|
|
|
::llvm::LogicalResult ElaboratedObjectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getClassNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM1(attr, "className", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ElaboratedObjectOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.className)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ElaboratedObjectOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.className);
|
|
}
|
|
|
|
::llvm::StringRef ElaboratedObjectOp::getClassName() {
|
|
auto attr = getClassNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void ElaboratedObjectOp::setClassName(::llvm::StringRef attrValue) {
|
|
getProperties().className = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, om::ClassLike classOp, ::mlir::ValueRange fieldValues) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(classOp)>(classOp), std::forward<decltype(fieldValues)>(fieldValues));
|
|
auto __res__ = ::llvm::dyn_cast<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, om::ClassLike classOp, ::mlir::ValueRange fieldValues) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(classOp)>(classOp), std::forward<decltype(fieldValues)>(fieldValues));
|
|
}
|
|
|
|
void ElaboratedObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange fieldValues) {
|
|
odsState.addOperands(fieldValues);
|
|
odsState.getOrAddProperties<Properties>().className = className;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange fieldValues) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
auto __res__ = ::llvm::dyn_cast<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange fieldValues) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
}
|
|
|
|
void ElaboratedObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange fieldValues) {
|
|
odsState.addOperands(fieldValues);
|
|
odsState.getOrAddProperties<Properties>().className = className;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange fieldValues) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
auto __res__ = ::llvm::dyn_cast<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange fieldValues) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
}
|
|
|
|
void ElaboratedObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef className, ::mlir::ValueRange fieldValues) {
|
|
odsState.addOperands(fieldValues);
|
|
odsState.getOrAddProperties<Properties>().className = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), className);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef className, ::mlir::ValueRange fieldValues) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
auto __res__ = ::llvm::dyn_cast<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef className, ::mlir::ValueRange fieldValues) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
}
|
|
|
|
void ElaboratedObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef className, ::mlir::ValueRange fieldValues) {
|
|
odsState.addOperands(fieldValues);
|
|
odsState.getOrAddProperties<Properties>().className = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), className);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef className, ::mlir::ValueRange fieldValues) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
auto __res__ = ::llvm::dyn_cast<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef className, ::mlir::ValueRange fieldValues) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(fieldValues)>(fieldValues));
|
|
}
|
|
|
|
void ElaboratedObjectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ElaboratedObjectOp::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.");
|
|
}
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::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<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::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 ElaboratedObjectOp::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() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::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<ElaboratedObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ElaboratedObjectOp ElaboratedObjectOp::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 ElaboratedObjectOp::verifyInvariantsImpl() {
|
|
auto tblgen_className = getProperties().className; (void)tblgen_className;
|
|
if (!tblgen_className) return emitOpError("requires attribute 'className'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM1(*this, tblgen_className, "className")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM4(*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_OM5(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ElaboratedObjectOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ElaboratedObjectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::FlatSymbolRefAttr classNameAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> fieldValuesOperands;
|
|
::llvm::SMLoc fieldValuesOperandsLoc;
|
|
(void)fieldValuesOperandsLoc;
|
|
::llvm::ArrayRef<::mlir::Type> fieldValuesTypes;
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(classNameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (classNameAttr) result.getOrAddProperties<ElaboratedObjectOp::Properties>().className = classNameAttr;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
fieldValuesOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(fieldValuesOperands))
|
|
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 fieldValues__result_functionType;
|
|
if (parser.parseType(fieldValues__result_functionType))
|
|
return ::mlir::failure();
|
|
fieldValuesTypes = fieldValues__result_functionType.getInputs();
|
|
resultTypes = fieldValues__result_functionType.getResults();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(fieldValuesOperands, fieldValuesTypes, fieldValuesOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ElaboratedObjectOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getClassNameAttr());
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getFieldValues();
|
|
_odsPrinter << ")";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("className");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(getFieldValues().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getResult().getType()));
|
|
}
|
|
|
|
void ElaboratedObjectOp::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, false, ::mlir::SideEffects::DefaultResource::get());
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ElaboratedObjectOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ElaboratedObjectOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::EmptyPathOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
EmptyPathOpGenericAdaptorBase::EmptyPathOpGenericAdaptorBase(EmptyPathOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
EmptyPathOpAdaptor::EmptyPathOpAdaptor(EmptyPathOp op) : EmptyPathOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult EmptyPathOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult EmptyPathOp::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 EmptyPathOp::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 EmptyPathOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> EmptyPathOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void EmptyPathOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void EmptyPathOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult EmptyPathOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void EmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) {
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result));
|
|
auto __res__ = ::llvm::dyn_cast<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result));
|
|
}
|
|
|
|
void EmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(EmptyPathOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__);
|
|
auto __res__ = ::llvm::dyn_cast<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder) {
|
|
return create(builder, builder.getLoc());
|
|
}
|
|
|
|
void EmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::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<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void EmptyPathOp::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);
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::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<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::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 EmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(EmptyPathOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void EmptyPathOp::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);
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::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<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::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 EmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(EmptyPathOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<EmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
EmptyPathOp EmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult EmptyPathOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM6(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult EmptyPathOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult EmptyPathOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::PathType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult EmptyPathOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
{
|
|
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();
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::PathType>();
|
|
result.addTypes(odsBuildableType0);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void EmptyPathOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void EmptyPathOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::EmptyPathOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::FrozenBasePathCreateOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FrozenBasePathCreateOpGenericAdaptorBase::FrozenBasePathCreateOpGenericAdaptorBase(FrozenBasePathCreateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::circt::om::PathAttr FrozenBasePathCreateOpGenericAdaptorBase::getPath() {
|
|
auto attr = getPathAttr();
|
|
return ::llvm::cast<::circt::om::PathAttr>(attr);
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FrozenBasePathCreateOpAdaptor::FrozenBasePathCreateOpAdaptor(FrozenBasePathCreateOp op) : FrozenBasePathCreateOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_path = getProperties().path; (void)tblgen_path;
|
|
if (!tblgen_path) return emitError(loc, "'om.frozenbasepath_create' op requires attribute 'path'");
|
|
|
|
if (tblgen_path && !((::llvm::isa<::circt::om::PathAttr>(tblgen_path))))
|
|
return emitError(loc, "'om.frozenbasepath_create' op attribute 'path' failed to satisfy constraint: An attribute that represents an instance path");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOp::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.path;
|
|
auto attr = dict.get("path");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `path` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FrozenBasePathCreateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.path;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("path",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FrozenBasePathCreateOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.path.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FrozenBasePathCreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "path")
|
|
return prop.path;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "path") {
|
|
prop.path = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.path)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.path) attrs.append("path", prop.path);
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPathAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM8(attr, "path", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.path)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.path);
|
|
}
|
|
|
|
::circt::om::PathAttr FrozenBasePathCreateOp::getPath() {
|
|
auto attr = getPathAttr();
|
|
return ::llvm::cast<::circt::om::PathAttr>(attr);
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path));
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenBasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path));
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value basePath, ::circt::om::PathAttr path) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path));
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::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<FrozenBasePathCreateOp::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.");
|
|
}
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::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<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::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 FrozenBasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FrozenBasePathCreateOp::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.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenBasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::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);
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::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<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::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 FrozenBasePathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenBasePathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenBasePathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenBasePathCreateOp FrozenBasePathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOp::verifyInvariantsImpl() {
|
|
auto tblgen_path = getProperties().path; (void)tblgen_path;
|
|
if (!tblgen_path) return emitOpError("requires attribute 'path'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM8(*this, tblgen_path, "path")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM7(*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_OM7(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenBasePathCreateOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::FrozenBasePathType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FrozenBasePathCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand basePathRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> basePathOperands(&basePathRawOperand, 1); ::llvm::SMLoc basePathOperandsLoc;
|
|
(void)basePathOperandsLoc;
|
|
::circt::om::PathAttr pathAttr;
|
|
|
|
basePathOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(basePathRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto odsResult = parseBasePathString(parser, pathAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<FrozenBasePathCreateOp::Properties>().path = pathAttr;
|
|
}
|
|
{
|
|
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();
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::FrozenBasePathType>();
|
|
result.addTypes(odsBuildableType0);
|
|
if (parser.resolveOperands(basePathOperands, odsBuildableType0, basePathOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBasePath();
|
|
_odsPrinter << ' ';
|
|
printBasePathString(_odsPrinter, *this, getPathAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("path");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void FrozenBasePathCreateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::FrozenBasePathCreateOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::FrozenBasePathCreateOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::FrozenEmptyPathOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FrozenEmptyPathOpGenericAdaptorBase::FrozenEmptyPathOpGenericAdaptorBase(FrozenEmptyPathOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
FrozenEmptyPathOpAdaptor::FrozenEmptyPathOpAdaptor(FrozenEmptyPathOp op) : FrozenEmptyPathOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FrozenEmptyPathOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenEmptyPathOp::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 FrozenEmptyPathOp::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 FrozenEmptyPathOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FrozenEmptyPathOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FrozenEmptyPathOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void FrozenEmptyPathOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenEmptyPathOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FrozenEmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) {
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result));
|
|
}
|
|
|
|
void FrozenEmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenEmptyPathOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__);
|
|
auto __res__ = ::llvm::dyn_cast<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder) {
|
|
return create(builder, builder.getLoc());
|
|
}
|
|
|
|
void FrozenEmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::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<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void FrozenEmptyPathOp::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);
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::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<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::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 FrozenEmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 0u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenEmptyPathOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FrozenEmptyPathOp::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);
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::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<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::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 FrozenEmptyPathOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenEmptyPathOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenEmptyPathOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenEmptyPathOp FrozenEmptyPathOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenEmptyPathOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM8(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenEmptyPathOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenEmptyPathOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::FrozenPathType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FrozenEmptyPathOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
{
|
|
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();
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::FrozenPathType>();
|
|
result.addTypes(odsBuildableType0);
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FrozenEmptyPathOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void FrozenEmptyPathOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::FrozenEmptyPathOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::FrozenPathCreateOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
FrozenPathCreateOpGenericAdaptorBase::FrozenPathCreateOpGenericAdaptorBase(FrozenPathCreateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::circt::om::TargetKind FrozenPathCreateOpGenericAdaptorBase::getTargetKind() {
|
|
auto attr = getTargetKindAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::circt::om::PathAttr FrozenPathCreateOpGenericAdaptorBase::getPath() {
|
|
auto attr = getPathAttr();
|
|
return ::llvm::cast<::circt::om::PathAttr>(attr);
|
|
}
|
|
|
|
::llvm::StringRef FrozenPathCreateOpGenericAdaptorBase::getModule() {
|
|
auto attr = getModuleAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef FrozenPathCreateOpGenericAdaptorBase::getRef() {
|
|
auto attr = getRefAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef FrozenPathCreateOpGenericAdaptorBase::getField() {
|
|
auto attr = getFieldAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
FrozenPathCreateOpAdaptor::FrozenPathCreateOpAdaptor(FrozenPathCreateOp op) : FrozenPathCreateOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_field = getProperties().field; (void)tblgen_field;
|
|
if (!tblgen_field) return emitError(loc, "'om.frozenpath_create' op requires attribute 'field'");
|
|
auto tblgen_module = getProperties().module; (void)tblgen_module;
|
|
if (!tblgen_module) return emitError(loc, "'om.frozenpath_create' op requires attribute 'module'");
|
|
auto tblgen_path = getProperties().path; (void)tblgen_path;
|
|
if (!tblgen_path) return emitError(loc, "'om.frozenpath_create' op requires attribute 'path'");
|
|
auto tblgen_ref = getProperties().ref; (void)tblgen_ref;
|
|
if (!tblgen_ref) return emitError(loc, "'om.frozenpath_create' op requires attribute 'ref'");
|
|
auto tblgen_targetKind = getProperties().targetKind; (void)tblgen_targetKind;
|
|
if (!tblgen_targetKind) return emitError(loc, "'om.frozenpath_create' op requires attribute 'targetKind'");
|
|
|
|
if (tblgen_targetKind && !((::llvm::isa<::circt::om::TargetKindAttr>(tblgen_targetKind))))
|
|
return emitError(loc, "'om.frozenpath_create' op attribute 'targetKind' failed to satisfy constraint: object model target kind");
|
|
|
|
if (tblgen_path && !((::llvm::isa<::circt::om::PathAttr>(tblgen_path))))
|
|
return emitError(loc, "'om.frozenpath_create' op attribute 'path' failed to satisfy constraint: An attribute that represents an instance path");
|
|
|
|
if (tblgen_module && !((::llvm::isa<::mlir::StringAttr>(tblgen_module))))
|
|
return emitError(loc, "'om.frozenpath_create' op attribute 'module' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_ref && !((::llvm::isa<::mlir::StringAttr>(tblgen_ref))))
|
|
return emitError(loc, "'om.frozenpath_create' op attribute 'ref' failed to satisfy constraint: string attribute");
|
|
|
|
if (tblgen_field && !((::llvm::isa<::mlir::StringAttr>(tblgen_field))))
|
|
return emitError(loc, "'om.frozenpath_create' op attribute 'field' failed to satisfy constraint: string attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOp::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;
|
|
auto attr = dict.get("field");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `field` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.module;
|
|
auto attr = dict.get("module");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `module` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.path;
|
|
auto attr = dict.get("path");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `path` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.ref;
|
|
auto attr = dict.get("ref");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `ref` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.targetKind;
|
|
auto attr = dict.get("targetKind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `targetKind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute FrozenPathCreateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.field;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("field",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.module;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("module",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.path;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("path",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.ref;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("ref",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.targetKind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("targetKind",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code FrozenPathCreateOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.field.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.module.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.path.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.ref.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.targetKind.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> FrozenPathCreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "field")
|
|
return prop.field;
|
|
|
|
if (name == "module")
|
|
return prop.module;
|
|
|
|
if (name == "path")
|
|
return prop.path;
|
|
|
|
if (name == "ref")
|
|
return prop.ref;
|
|
|
|
if (name == "targetKind")
|
|
return prop.targetKind;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void FrozenPathCreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "field") {
|
|
prop.field = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.field)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "module") {
|
|
prop.module = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.module)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "path") {
|
|
prop.path = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.path)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "ref") {
|
|
prop.ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.ref)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "targetKind") {
|
|
prop.targetKind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.targetKind)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void FrozenPathCreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.field) attrs.append("field", prop.field);
|
|
|
|
if (prop.module) attrs.append("module", prop.module);
|
|
|
|
if (prop.path) attrs.append("path", prop.path);
|
|
|
|
if (prop.ref) attrs.append("ref", prop.ref);
|
|
|
|
if (prop.targetKind) attrs.append("targetKind", prop.targetKind);
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFieldAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(attr, "field", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getModuleAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(attr, "module", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getPathAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM8(attr, "path", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getRefAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(attr, "ref", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetKindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM9(attr, "targetKind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.field)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.module)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.path)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.ref)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.targetKind)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FrozenPathCreateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.field);
|
|
writer.writeAttribute(prop.module);
|
|
writer.writeAttribute(prop.path);
|
|
writer.writeAttribute(prop.ref);
|
|
writer.writeAttribute(prop.targetKind);
|
|
}
|
|
|
|
::circt::om::TargetKind FrozenPathCreateOp::getTargetKind() {
|
|
auto attr = getTargetKindAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::circt::om::PathAttr FrozenPathCreateOp::getPath() {
|
|
auto attr = getPathAttr();
|
|
return ::llvm::cast<::circt::om::PathAttr>(attr);
|
|
}
|
|
|
|
::llvm::StringRef FrozenPathCreateOp::getModule() {
|
|
auto attr = getModuleAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef FrozenPathCreateOp::getRef() {
|
|
auto attr = getRefAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef FrozenPathCreateOp::getField() {
|
|
auto attr = getFieldAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void FrozenPathCreateOp::setTargetKind(::circt::om::TargetKind attrValue) {
|
|
getProperties().targetKind = ::circt::om::TargetKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void FrozenPathCreateOp::setModule(::llvm::StringRef attrValue) {
|
|
getProperties().module = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void FrozenPathCreateOp::setRef(::llvm::StringRef attrValue) {
|
|
getProperties().ref = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void FrozenPathCreateOp::setField(::llvm::StringRef attrValue) {
|
|
getProperties().field = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = targetKind;
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.getOrAddProperties<Properties>().module = module;
|
|
odsState.getOrAddProperties<Properties>().ref = ref;
|
|
odsState.getOrAddProperties<Properties>().field = field;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = targetKind;
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.getOrAddProperties<Properties>().module = module;
|
|
odsState.getOrAddProperties<Properties>().ref = ref;
|
|
odsState.getOrAddProperties<Properties>().field = field;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenPathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = targetKind;
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.getOrAddProperties<Properties>().module = module;
|
|
odsState.getOrAddProperties<Properties>().ref = ref;
|
|
odsState.getOrAddProperties<Properties>().field = field;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::mlir::StringAttr module, ::mlir::StringAttr ref, ::mlir::StringAttr field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = ::circt::om::TargetKindAttr::get(odsBuilder.getContext(), targetKind);
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.getOrAddProperties<Properties>().module = odsBuilder.getStringAttr(module);
|
|
odsState.getOrAddProperties<Properties>().ref = odsBuilder.getStringAttr(ref);
|
|
odsState.getOrAddProperties<Properties>().field = odsBuilder.getStringAttr(field);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = ::circt::om::TargetKindAttr::get(odsBuilder.getContext(), targetKind);
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.getOrAddProperties<Properties>().module = odsBuilder.getStringAttr(module);
|
|
odsState.getOrAddProperties<Properties>().ref = odsBuilder.getStringAttr(ref);
|
|
odsState.getOrAddProperties<Properties>().field = odsBuilder.getStringAttr(field);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenPathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = ::circt::om::TargetKindAttr::get(odsBuilder.getContext(), targetKind);
|
|
odsState.getOrAddProperties<Properties>().path = path;
|
|
odsState.getOrAddProperties<Properties>().module = odsBuilder.getStringAttr(module);
|
|
odsState.getOrAddProperties<Properties>().ref = odsBuilder.getStringAttr(ref);
|
|
odsState.getOrAddProperties<Properties>().field = odsBuilder.getStringAttr(field);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::circt::om::PathAttr path, ::llvm::StringRef module, ::llvm::StringRef ref, ::llvm::StringRef field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(path)>(path), std::forward<decltype(module)>(module), std::forward<decltype(ref)>(ref), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void FrozenPathCreateOp::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<FrozenPathCreateOp::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.");
|
|
}
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::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<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::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 FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<FrozenPathCreateOp::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.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenPathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void FrozenPathCreateOp::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);
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::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<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::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 FrozenPathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(FrozenPathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<FrozenPathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
FrozenPathCreateOp FrozenPathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOp::verifyInvariantsImpl() {
|
|
auto tblgen_field = getProperties().field; (void)tblgen_field;
|
|
if (!tblgen_field) return emitOpError("requires attribute 'field'");
|
|
auto tblgen_module = getProperties().module; (void)tblgen_module;
|
|
if (!tblgen_module) return emitOpError("requires attribute 'module'");
|
|
auto tblgen_path = getProperties().path; (void)tblgen_path;
|
|
if (!tblgen_path) return emitOpError("requires attribute 'path'");
|
|
auto tblgen_ref = getProperties().ref; (void)tblgen_ref;
|
|
if (!tblgen_ref) return emitOpError("requires attribute 'ref'");
|
|
auto tblgen_targetKind = getProperties().targetKind; (void)tblgen_targetKind;
|
|
if (!tblgen_targetKind) return emitOpError("requires attribute 'targetKind'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM9(*this, tblgen_targetKind, "targetKind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM8(*this, tblgen_path, "path")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM2(*this, tblgen_module, "module")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM2(*this, tblgen_ref, "ref")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM2(*this, tblgen_field, "field")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM7(*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_OM8(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult FrozenPathCreateOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::FrozenPathType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult FrozenPathCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::circt::om::TargetKindAttr targetKindAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand basePathRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> basePathOperands(&basePathRawOperand, 1); ::llvm::SMLoc basePathOperandsLoc;
|
|
(void)basePathOperandsLoc;
|
|
::circt::om::PathAttr pathAttr;
|
|
::mlir::StringAttr moduleAttr;
|
|
::mlir::StringAttr refAttr;
|
|
::mlir::StringAttr fieldAttr;
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"dont_touch","instance","member_instance","member_reference","reference"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"targetKind", 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 'targetKind' [dont_touch, instance, member_instance, member_reference, reference]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::circt::om::symbolizeTargetKind(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "targetKind attribute specification: \"" << attrStr << '"';;
|
|
|
|
targetKindAttr = ::circt::om::TargetKindAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<FrozenPathCreateOp::Properties>().targetKind = targetKindAttr;
|
|
}
|
|
}
|
|
|
|
basePathOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(basePathRawOperand))
|
|
return ::mlir::failure();
|
|
{
|
|
auto odsResult = parsePathString(parser, pathAttr, moduleAttr, refAttr, fieldAttr);
|
|
if (odsResult) return ::mlir::failure();
|
|
result.getOrAddProperties<FrozenPathCreateOp::Properties>().path = pathAttr;
|
|
result.getOrAddProperties<FrozenPathCreateOp::Properties>().module = moduleAttr;
|
|
result.getOrAddProperties<FrozenPathCreateOp::Properties>().ref = refAttr;
|
|
result.getOrAddProperties<FrozenPathCreateOp::Properties>().field = fieldAttr;
|
|
}
|
|
{
|
|
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();
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::FrozenPathType>();
|
|
::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::circt::om::FrozenBasePathType>();
|
|
result.addTypes(odsBuildableType0);
|
|
if (parser.resolveOperands(basePathOperands, odsBuildableType1, basePathOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void FrozenPathCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getTargetKind();
|
|
auto caseValueStr = stringifyTargetKind(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBasePath();
|
|
_odsPrinter << ' ';
|
|
printPathString(_odsPrinter, *this, getPathAttr(), getModuleAttr(), getRefAttr(), getFieldAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("targetKind");
|
|
elidedAttrs.push_back("path");
|
|
elidedAttrs.push_back("module");
|
|
elidedAttrs.push_back("ref");
|
|
elidedAttrs.push_back("field");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void FrozenPathCreateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::FrozenPathCreateOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::FrozenPathCreateOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerAddOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerAddOpGenericAdaptorBase::IntegerAddOpGenericAdaptorBase(IntegerAddOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerAddOpAdaptor::IntegerAddOpAdaptor(IntegerAddOp op) : IntegerAddOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerAddOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAddOp::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 IntegerAddOp::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 IntegerAddOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerAddOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerAddOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerAddOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAddOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerAddOp::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);
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::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<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::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 IntegerAddOp::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);
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::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<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::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 IntegerAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerAddOp::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);
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::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<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::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 IntegerAddOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerAddOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAddOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAddOp IntegerAddOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAddOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*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_OM9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAddOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAddOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::OMIntegerType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerAddOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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();
|
|
|
|
{
|
|
::circt::om::OMIntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::OMIntegerType>();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerAddOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::circt::om::OMIntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerAddOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerAddOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerAndOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerAndOpGenericAdaptorBase::IntegerAndOpGenericAdaptorBase(IntegerAndOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerAndOpAdaptor::IntegerAndOpAdaptor(IntegerAndOp op) : IntegerAndOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerAndOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAndOp::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 IntegerAndOp::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 IntegerAndOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerAndOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerAndOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerAndOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAndOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerAndOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerAndOp::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);
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::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<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::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 IntegerAndOp::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);
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::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<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::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 IntegerAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerAndOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerAndOp::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);
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::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<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::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 IntegerAndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerAndOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerAndOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerAndOp IntegerAndOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAndOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM10(*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_OM10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAndOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerAndOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerAndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerAndOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerAndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerAndOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerMulOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerMulOpGenericAdaptorBase::IntegerMulOpGenericAdaptorBase(IntegerMulOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerMulOpAdaptor::IntegerMulOpAdaptor(IntegerMulOp op) : IntegerMulOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerMulOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerMulOp::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 IntegerMulOp::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 IntegerMulOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerMulOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerMulOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerMulOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerMulOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerMulOp::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);
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::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<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::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 IntegerMulOp::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);
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::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<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::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 IntegerMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerMulOp::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);
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::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<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::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 IntegerMulOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerMulOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerMulOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerMulOp IntegerMulOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerMulOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*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_OM9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerMulOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerMulOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::OMIntegerType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerMulOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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();
|
|
|
|
{
|
|
::circt::om::OMIntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::OMIntegerType>();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerMulOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::circt::om::OMIntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerMulOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerMulOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerOrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerOrOpGenericAdaptorBase::IntegerOrOpGenericAdaptorBase(IntegerOrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerOrOpAdaptor::IntegerOrOpAdaptor(IntegerOrOp op) : IntegerOrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerOrOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerOrOp::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 IntegerOrOp::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 IntegerOrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerOrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerOrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerOrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerOrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerOrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerOrOp::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);
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::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<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::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 IntegerOrOp::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);
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::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<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::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 IntegerOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerOrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerOrOp::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);
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::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<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::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 IntegerOrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerOrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerOrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerOrOp IntegerOrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerOrOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM10(*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_OM10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerOrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerOrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerOrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerOrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerOrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerOrOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerShlOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerShlOpGenericAdaptorBase::IntegerShlOpGenericAdaptorBase(IntegerShlOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerShlOpAdaptor::IntegerShlOpAdaptor(IntegerShlOp op) : IntegerShlOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerShlOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShlOp::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 IntegerShlOp::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 IntegerShlOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerShlOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerShlOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerShlOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShlOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerShlOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerShlOp::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);
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::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<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::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 IntegerShlOp::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);
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::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<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::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 IntegerShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerShlOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerShlOp::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);
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::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<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::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 IntegerShlOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerShlOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShlOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShlOp IntegerShlOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShlOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*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_OM9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShlOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShlOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::OMIntegerType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerShlOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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();
|
|
|
|
{
|
|
::circt::om::OMIntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::OMIntegerType>();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerShlOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::circt::om::OMIntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerShlOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerShlOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerShrOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerShrOpGenericAdaptorBase::IntegerShrOpGenericAdaptorBase(IntegerShrOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerShrOpAdaptor::IntegerShrOpAdaptor(IntegerShrOp op) : IntegerShrOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerShrOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShrOp::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 IntegerShrOp::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 IntegerShrOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerShrOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerShrOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerShrOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShrOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerShrOp::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);
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::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<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::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 IntegerShrOp::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);
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::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<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::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 IntegerShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerShrOp::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);
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::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<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::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 IntegerShrOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerShrOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerShrOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerShrOp IntegerShrOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShrOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM9(*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_OM9(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShrOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerShrOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::OMIntegerType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerShrOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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();
|
|
|
|
{
|
|
::circt::om::OMIntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::OMIntegerType>();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, odsBuildableType0, lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, odsBuildableType0, rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerShrOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::circt::om::OMIntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerShrOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerShrOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::IntegerXorOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
IntegerXorOpGenericAdaptorBase::IntegerXorOpGenericAdaptorBase(IntegerXorOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
IntegerXorOpAdaptor::IntegerXorOpAdaptor(IntegerXorOp op) : IntegerXorOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult IntegerXorOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerXorOp::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 IntegerXorOp::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 IntegerXorOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> IntegerXorOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void IntegerXorOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void IntegerXorOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerXorOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerXorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void IntegerXorOp::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);
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::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<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::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 IntegerXorOp::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);
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::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<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::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 IntegerXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerXorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void IntegerXorOp::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);
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::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<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::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 IntegerXorOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(IntegerXorOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<IntegerXorOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
IntegerXorOp IntegerXorOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerXorOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM10(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM10(*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_OM10(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerXorOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult IntegerXorOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
if (operands.size() <= 0)
|
|
return ::mlir::failure();
|
|
::mlir::Type odsInferredType0 = operands[0].getType();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult IntegerXorOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(lhsOperands, resultTypes[0], lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, resultTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void IntegerXorOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void IntegerXorOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::IntegerXorOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ListConcatOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ListConcatOpGenericAdaptorBase::ListConcatOpGenericAdaptorBase(ListConcatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> ListConcatOpGenericAdaptorBase::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
|
|
ListConcatOpAdaptor::ListConcatOpAdaptor(ListConcatOp op) : ListConcatOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ListConcatOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> ListConcatOp::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 ListConcatOp::getSubListsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult ListConcatOp::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 ListConcatOp::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 ListConcatOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ListConcatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ListConcatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ListConcatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ListConcatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ListConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange subLists) {
|
|
odsState.addOperands(subLists);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange subLists) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(subLists)>(subLists));
|
|
auto __res__ = ::llvm::dyn_cast<ListConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange subLists) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(subLists)>(subLists));
|
|
}
|
|
|
|
void ListConcatOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::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<ListConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::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 ListConcatOp::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() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::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<ListConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::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 ListConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
odsState.addTypes({operands[0].getType()});
|
|
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<ListConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void ListConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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({operands[0].getType()});
|
|
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<ListConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListConcatOp ListConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult ListConcatOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM11(*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_OM12(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ListConcatOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ListConcatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> subListsOperands;
|
|
::llvm::SMLoc subListsOperandsLoc;
|
|
(void)subListsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
subListsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(subListsOperands))
|
|
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();
|
|
|
|
{
|
|
::circt::om::ListType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(subListsOperands, resultTypes[0], subListsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ListConcatOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getSubLists();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::circt::om::ListType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void ListConcatOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ListConcatOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ListCreateOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ListCreateOpGenericAdaptorBase::ListCreateOpGenericAdaptorBase(ListCreateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> ListCreateOpGenericAdaptorBase::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
|
|
ListCreateOpAdaptor::ListCreateOpAdaptor(ListCreateOp op) : ListCreateOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ListCreateOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> ListCreateOp::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 ListCreateOp::getInputsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult ListCreateOp::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 ListCreateOp::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 ListCreateOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ListCreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ListCreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void ListCreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult ListCreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ListCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange inputs) {
|
|
odsState.addOperands(inputs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ListCreateOp ListCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange inputs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(inputs)>(inputs));
|
|
auto __res__ = ::llvm::dyn_cast<ListCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListCreateOp ListCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange inputs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(inputs)>(inputs));
|
|
}
|
|
|
|
void ListCreateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ListCreateOp ListCreateOp::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<ListCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListCreateOp ListCreateOp::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 ListCreateOp::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() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ListCreateOp ListCreateOp::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<ListCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ListCreateOp ListCreateOp::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 ListCreateOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM4(*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_OM12(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ListCreateOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult ListCreateOp::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();
|
|
}
|
|
|
|
void ListCreateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ListCreateOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ObjectFieldOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ObjectFieldOpGenericAdaptorBase::ObjectFieldOpGenericAdaptorBase(ObjectFieldOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef ObjectFieldOpGenericAdaptorBase::getField() {
|
|
auto attr = getFieldAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ObjectFieldOpAdaptor::ObjectFieldOpAdaptor(ObjectFieldOp op) : ObjectFieldOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ObjectFieldOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_field = getProperties().field; (void)tblgen_field;
|
|
if (!tblgen_field) return emitError(loc, "'om.object.field' op requires attribute 'field'");
|
|
|
|
if (tblgen_field && !((::llvm::isa<::mlir::StringAttr>(tblgen_field))))
|
|
return emitError(loc, "'om.object.field' op attribute 'field' failed to satisfy constraint: string attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectFieldOp::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;
|
|
auto attr = dict.get("field");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `field` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ObjectFieldOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.field;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("field",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ObjectFieldOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.field.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ObjectFieldOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "field")
|
|
return prop.field;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ObjectFieldOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "field") {
|
|
prop.field = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.field)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ObjectFieldOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.field) attrs.append("field", prop.field);
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectFieldOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getFieldAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(attr, "field", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectFieldOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.field)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ObjectFieldOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.field);
|
|
}
|
|
|
|
::llvm::StringRef ObjectFieldOp::getField() {
|
|
auto attr = getFieldAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void ObjectFieldOp::setField(::llvm::StringRef attrValue) {
|
|
getProperties().field = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void ObjectFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value object, ::mlir::StringAttr field) {
|
|
odsState.addOperands(object);
|
|
odsState.getOrAddProperties<Properties>().field = field;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value object, ::mlir::StringAttr field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectFieldOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value object, ::mlir::StringAttr field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void ObjectFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::mlir::StringAttr field) {
|
|
odsState.addOperands(object);
|
|
odsState.getOrAddProperties<Properties>().field = field;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::mlir::StringAttr field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectFieldOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::mlir::StringAttr field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void ObjectFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value object, ::llvm::StringRef field) {
|
|
odsState.addOperands(object);
|
|
odsState.getOrAddProperties<Properties>().field = odsBuilder.getStringAttr(field);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value object, ::llvm::StringRef field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectFieldOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value object, ::llvm::StringRef field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void ObjectFieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::llvm::StringRef field) {
|
|
odsState.addOperands(object);
|
|
odsState.getOrAddProperties<Properties>().field = odsBuilder.getStringAttr(field);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::llvm::StringRef field) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectFieldOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value object, ::llvm::StringRef field) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(object)>(object), std::forward<decltype(field)>(field));
|
|
}
|
|
|
|
void ObjectFieldOp::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<ObjectFieldOp::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.");
|
|
}
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::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<ObjectFieldOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::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 ObjectFieldOp::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);
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::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<ObjectFieldOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectFieldOp ObjectFieldOp::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 ObjectFieldOp::verifyInvariantsImpl() {
|
|
auto tblgen_field = getProperties().field; (void)tblgen_field;
|
|
if (!tblgen_field) return emitOpError("requires attribute 'field'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM2(*this, tblgen_field, "field")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM5(*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_OM1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectFieldOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ObjectFieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand objectRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> objectOperands(&objectRawOperand, 1); ::llvm::SMLoc objectOperandsLoc;
|
|
(void)objectOperandsLoc;
|
|
::mlir::StringAttr fieldAttr;
|
|
::llvm::ArrayRef<::mlir::Type> objectTypes;
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes;
|
|
|
|
objectOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(objectRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseLSquare())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(fieldAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (fieldAttr) result.getOrAddProperties<ObjectFieldOp::Properties>().field = fieldAttr;
|
|
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 object__result_functionType;
|
|
if (parser.parseType(object__result_functionType))
|
|
return ::mlir::failure();
|
|
objectTypes = object__result_functionType.getInputs();
|
|
resultTypes = object__result_functionType.getResults();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(objectOperands, objectTypes, objectOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ObjectFieldOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getObject();
|
|
_odsPrinter << "[";
|
|
_odsPrinter.printAttributeWithoutType(getFieldAttr());
|
|
_odsPrinter << "]";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("field");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(getObject().getType()), ::llvm::ArrayRef<::mlir::Type>(getResult().getType()));
|
|
}
|
|
|
|
void ObjectFieldOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ObjectFieldOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ObjectFieldOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::ObjectOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
ObjectOpGenericAdaptorBase::ObjectOpGenericAdaptorBase(ObjectOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> ObjectOpGenericAdaptorBase::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 ObjectOpGenericAdaptorBase::getClassName() {
|
|
auto attr = getClassNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
ObjectOpAdaptor::ObjectOpAdaptor(ObjectOp op) : ObjectOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult ObjectOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_className = getProperties().className; (void)tblgen_className;
|
|
if (!tblgen_className) return emitError(loc, "'om.object' op requires attribute 'className'");
|
|
|
|
if (tblgen_className && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_className))))
|
|
return emitError(loc, "'om.object' op attribute 'className' failed to satisfy constraint: flat symbol reference attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> ObjectOp::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 ObjectOp::getActualParamsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectOp::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.className;
|
|
auto attr = dict.get("className");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `className` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute ObjectOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.className;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("className",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code ObjectOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.className.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> ObjectOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "className")
|
|
return prop.className;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void ObjectOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "className") {
|
|
prop.className = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.className)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void ObjectOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.className) attrs.append("className", prop.className);
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getClassNameAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM1(attr, "className", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.className)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ObjectOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.className);
|
|
}
|
|
|
|
::llvm::StringRef ObjectOp::getClassName() {
|
|
auto attr = getClassNameAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void ObjectOp::setClassName(::llvm::StringRef attrValue) {
|
|
getProperties().className = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, om::ClassOp classOp, ::mlir::ValueRange actualParams) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(classOp)>(classOp), std::forward<decltype(actualParams)>(actualParams));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, om::ClassOp classOp, ::mlir::ValueRange actualParams) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(classOp)>(classOp), std::forward<decltype(actualParams)>(actualParams));
|
|
}
|
|
|
|
void ObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange actualParams) {
|
|
odsState.addOperands(actualParams);
|
|
odsState.getOrAddProperties<Properties>().className = className;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange actualParams) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange actualParams) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
}
|
|
|
|
void ObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange actualParams) {
|
|
odsState.addOperands(actualParams);
|
|
odsState.getOrAddProperties<Properties>().className = className;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange actualParams) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr className, ::mlir::ValueRange actualParams) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
}
|
|
|
|
void ObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef className, ::mlir::ValueRange actualParams) {
|
|
odsState.addOperands(actualParams);
|
|
odsState.getOrAddProperties<Properties>().className = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), className);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef className, ::mlir::ValueRange actualParams) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef className, ::mlir::ValueRange actualParams) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
}
|
|
|
|
void ObjectOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef className, ::mlir::ValueRange actualParams) {
|
|
odsState.addOperands(actualParams);
|
|
odsState.getOrAddProperties<Properties>().className = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), className);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef className, ::mlir::ValueRange actualParams) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
auto __res__ = ::llvm::dyn_cast<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef className, ::mlir::ValueRange actualParams) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(className)>(className), std::forward<decltype(actualParams)>(actualParams));
|
|
}
|
|
|
|
void ObjectOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<ObjectOp::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.");
|
|
}
|
|
}
|
|
|
|
ObjectOp ObjectOp::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<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::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 ObjectOp::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() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
ObjectOp ObjectOp::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<ObjectOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
ObjectOp ObjectOp::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 ObjectOp::verifyInvariantsImpl() {
|
|
auto tblgen_className = getProperties().className; (void)tblgen_className;
|
|
if (!tblgen_className) return emitOpError("requires attribute 'className'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM1(*this, tblgen_className, "className")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM4(*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_OM5(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult ObjectOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult ObjectOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::FlatSymbolRefAttr classNameAttr;
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> actualParamsOperands;
|
|
::llvm::SMLoc actualParamsOperandsLoc;
|
|
(void)actualParamsOperandsLoc;
|
|
::llvm::ArrayRef<::mlir::Type> actualParamsTypes;
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes;
|
|
|
|
if (parser.parseCustomAttributeWithFallback(classNameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (classNameAttr) result.getOrAddProperties<ObjectOp::Properties>().className = classNameAttr;
|
|
if (parser.parseLParen())
|
|
return ::mlir::failure();
|
|
|
|
actualParamsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(actualParamsOperands))
|
|
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 actualParams__result_functionType;
|
|
if (parser.parseType(actualParams__result_functionType))
|
|
return ::mlir::failure();
|
|
actualParamsTypes = actualParams__result_functionType.getInputs();
|
|
resultTypes = actualParams__result_functionType.getResults();
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(actualParamsOperands, actualParamsTypes, actualParamsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void ObjectOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getClassNameAttr());
|
|
_odsPrinter << "(";
|
|
_odsPrinter << getActualParams();
|
|
_odsPrinter << ")";
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("className");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printFunctionalType(getActualParams().getTypes(), ::llvm::ArrayRef<::mlir::Type>(getResult().getType()));
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::ObjectOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::ObjectOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::PathCreateOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PathCreateOpGenericAdaptorBase::PathCreateOpGenericAdaptorBase(PathCreateOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::circt::om::TargetKind PathCreateOpGenericAdaptorBase::getTargetKind() {
|
|
auto attr = getTargetKindAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef PathCreateOpGenericAdaptorBase::getTarget() {
|
|
auto attr = getTargetAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PathCreateOpAdaptor::PathCreateOpAdaptor(PathCreateOp op) : PathCreateOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PathCreateOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_target = getProperties().target; (void)tblgen_target;
|
|
if (!tblgen_target) return emitError(loc, "'om.path_create' op requires attribute 'target'");
|
|
auto tblgen_targetKind = getProperties().targetKind; (void)tblgen_targetKind;
|
|
if (!tblgen_targetKind) return emitError(loc, "'om.path_create' op requires attribute 'targetKind'");
|
|
|
|
if (tblgen_targetKind && !((::llvm::isa<::circt::om::TargetKindAttr>(tblgen_targetKind))))
|
|
return emitError(loc, "'om.path_create' op attribute 'targetKind' failed to satisfy constraint: object model target kind");
|
|
|
|
if (tblgen_target && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_target))))
|
|
return emitError(loc, "'om.path_create' op attribute 'target' failed to satisfy constraint: flat symbol reference attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PathCreateOp::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.target;
|
|
auto attr = dict.get("target");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `target` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
|
|
{
|
|
auto &propStorage = prop.targetKind;
|
|
auto attr = dict.get("targetKind");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `targetKind` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PathCreateOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.target;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("target",
|
|
propStorage));
|
|
}
|
|
|
|
{
|
|
const auto &propStorage = prop.targetKind;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("targetKind",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PathCreateOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.target.getAsOpaquePointer()),
|
|
llvm::hash_value(prop.targetKind.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PathCreateOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "target")
|
|
return prop.target;
|
|
|
|
if (name == "targetKind")
|
|
return prop.targetKind;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PathCreateOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "target") {
|
|
prop.target = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.target)>>(value);
|
|
return;
|
|
}
|
|
|
|
if (name == "targetKind") {
|
|
prop.targetKind = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.targetKind)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PathCreateOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.target) attrs.append("target", prop.target);
|
|
|
|
if (prop.targetKind) attrs.append("targetKind", prop.targetKind);
|
|
}
|
|
|
|
::llvm::LogicalResult PathCreateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM1(attr, "target", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getTargetKindAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM9(attr, "targetKind", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PathCreateOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.target)))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(reader.readAttribute(prop.targetKind)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PathCreateOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.target);
|
|
writer.writeAttribute(prop.targetKind);
|
|
}
|
|
|
|
::circt::om::TargetKind PathCreateOp::getTargetKind() {
|
|
auto attr = getTargetKindAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
::llvm::StringRef PathCreateOp::getTarget() {
|
|
auto attr = getTargetAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void PathCreateOp::setTargetKind(::circt::om::TargetKind attrValue) {
|
|
getProperties().targetKind = ::circt::om::TargetKindAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void PathCreateOp::setTarget(::llvm::StringRef attrValue) {
|
|
getProperties().target = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
|
|
}
|
|
|
|
void PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = targetKind;
|
|
odsState.getOrAddProperties<Properties>().target = target;
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = targetKind;
|
|
odsState.getOrAddProperties<Properties>().target = target;
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = targetKind;
|
|
odsState.getOrAddProperties<Properties>().target = target;
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::circt::om::TargetKindAttr targetKind, ::mlir::Value basePath, ::mlir::FlatSymbolRefAttr target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = ::circt::om::TargetKindAttr::get(odsBuilder.getContext(), targetKind);
|
|
odsState.getOrAddProperties<Properties>().target = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), target);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = ::circt::om::TargetKindAttr::get(odsBuilder.getContext(), targetKind);
|
|
odsState.getOrAddProperties<Properties>().target = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), target);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
odsState.addOperands(basePath);
|
|
odsState.getOrAddProperties<Properties>().targetKind = ::circt::om::TargetKindAttr::get(odsBuilder.getContext(), targetKind);
|
|
odsState.getOrAddProperties<Properties>().target = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), target);
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::circt::om::TargetKind targetKind, ::mlir::Value basePath, ::llvm::StringRef target) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(targetKind)>(targetKind), std::forward<decltype(basePath)>(basePath), std::forward<decltype(target)>(target));
|
|
}
|
|
|
|
void PathCreateOp::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<PathCreateOp::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.");
|
|
}
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::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<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::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 PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PathCreateOp::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.");
|
|
}
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PathCreateOp::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);
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::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<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::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 PathCreateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PathCreateOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PathCreateOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PathCreateOp PathCreateOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PathCreateOp::verifyInvariantsImpl() {
|
|
auto tblgen_target = getProperties().target; (void)tblgen_target;
|
|
if (!tblgen_target) return emitOpError("requires attribute 'target'");
|
|
auto tblgen_targetKind = getProperties().targetKind; (void)tblgen_targetKind;
|
|
if (!tblgen_targetKind) return emitOpError("requires attribute 'targetKind'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM9(*this, tblgen_targetKind, "targetKind")))
|
|
return ::mlir::failure();
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM1(*this, tblgen_target, "target")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM3(*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_OM6(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PathCreateOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult PathCreateOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getType<::circt::om::PathType>();
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult PathCreateOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::circt::om::TargetKindAttr targetKindAttr;
|
|
::mlir::OpAsmParser::UnresolvedOperand basePathRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> basePathOperands(&basePathRawOperand, 1); ::llvm::SMLoc basePathOperandsLoc;
|
|
(void)basePathOperandsLoc;
|
|
::mlir::FlatSymbolRefAttr targetAttr;
|
|
|
|
{
|
|
::llvm::StringRef attrStr;
|
|
::mlir::NamedAttrList attrStorage;
|
|
auto loc = parser.getCurrentLocation();
|
|
if (parser.parseOptionalKeyword(&attrStr, {"dont_touch","instance","member_instance","member_reference","reference"})) {
|
|
::mlir::StringAttr attrVal;
|
|
::mlir::OptionalParseResult parseResult =
|
|
parser.parseOptionalAttribute(attrVal,
|
|
parser.getBuilder().getNoneType(),
|
|
"targetKind", 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 'targetKind' [dont_touch, instance, member_instance, member_reference, reference]");
|
|
}
|
|
}
|
|
if (!attrStr.empty()) {
|
|
auto attrOptional = ::circt::om::symbolizeTargetKind(attrStr);
|
|
if (!attrOptional)
|
|
return parser.emitError(loc, "invalid ")
|
|
<< "targetKind attribute specification: \"" << attrStr << '"';;
|
|
|
|
targetKindAttr = ::circt::om::TargetKindAttr::get(parser.getBuilder().getContext(), *attrOptional);
|
|
result.getOrAddProperties<PathCreateOp::Properties>().targetKind = targetKindAttr;
|
|
}
|
|
}
|
|
|
|
basePathOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(basePathRawOperand))
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(targetAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (targetAttr) result.getOrAddProperties<PathCreateOp::Properties>().target = targetAttr;
|
|
{
|
|
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();
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getType<::circt::om::PathType>();
|
|
::mlir::Type odsBuildableType1 = parser.getBuilder().getType<::circt::om::BasePathType>();
|
|
result.addTypes(odsBuildableType0);
|
|
if (parser.resolveOperands(basePathOperands, odsBuildableType1, basePathOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PathCreateOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
|
|
{
|
|
auto caseValue = getTargetKind();
|
|
auto caseValueStr = stringifyTargetKind(caseValue);
|
|
_odsPrinter << caseValueStr;
|
|
}
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getBasePath();
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getTargetAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("targetKind");
|
|
elidedAttrs.push_back("target");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
}
|
|
|
|
void PathCreateOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::PathCreateOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::PathCreateOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::PropEqOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PropEqOpGenericAdaptorBase::PropEqOpGenericAdaptorBase(PropEqOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
PropEqOpAdaptor::PropEqOpAdaptor(PropEqOp op) : PropEqOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PropEqOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PropEqOp::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 PropEqOp::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 PropEqOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PropEqOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PropEqOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void PropEqOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult PropEqOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PropEqOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void PropEqOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
odsState.addOperands(lhs);
|
|
odsState.addOperands(rhs);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PropEqOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, odsState.operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes)))
|
|
odsState.addTypes(inferredReturnTypes);
|
|
else
|
|
::mlir::detail::reportFatalInferReturnTypesError(odsState);
|
|
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
auto __res__ = ::llvm::dyn_cast<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
|
|
}
|
|
|
|
void PropEqOp::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);
|
|
}
|
|
|
|
PropEqOp PropEqOp::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<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::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 PropEqOp::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);
|
|
}
|
|
|
|
PropEqOp PropEqOp::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<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::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 PropEqOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 2u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PropEqOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void PropEqOp::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);
|
|
}
|
|
|
|
PropEqOp PropEqOp::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<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::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 PropEqOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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);
|
|
|
|
::llvm::SmallVector<::mlir::Type, 2> inferredReturnTypes;
|
|
if (::mlir::succeeded(PropEqOp::inferReturnTypes(odsBuilder.getContext(),
|
|
odsState.location, operands,
|
|
odsState.attributes.getDictionary(odsState.getContext()),
|
|
odsState.getRawProperties(),
|
|
odsState.regions, inferredReturnTypes))) {
|
|
assert(inferredReturnTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(inferredReturnTypes);
|
|
} else {
|
|
::llvm::report_fatal_error("Failed to infer result type(s).");
|
|
}
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<PropEqOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropEqOp PropEqOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult PropEqOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM13(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
auto valueGroup1 = getODSOperands(1);
|
|
|
|
for (auto v : valueGroup1) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM13(*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_OM14(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
if (!((((*this->getODSOperands(0).begin()).getType()) == ((*this->getODSOperands(1).begin()).getType()) && ((*this->getODSOperands(1).begin()).getType()) == ((*this->getODSOperands(0).begin()).getType()))))
|
|
return emitOpError("failed to verify that all of {lhs, rhs} have same type");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PropEqOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::llvm::LogicalResult PropEqOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
|
|
inferredReturnTypes.resize(1);
|
|
::mlir::Builder odsBuilder(context);
|
|
::mlir::Type odsInferredType0 = odsBuilder.getIntegerType(1);
|
|
inferredReturnTypes[0] = odsInferredType0;
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::ParseResult PropEqOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
|
|
(void)lhsOperandsLoc;
|
|
::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
|
|
(void)rhsOperandsLoc;
|
|
::mlir::Type lhsRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
|
|
|
|
lhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(lhsRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
rhsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(rhsRawOperand))
|
|
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();
|
|
lhsRawType = type;
|
|
}
|
|
::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
|
|
result.addTypes(odsBuildableType0);
|
|
if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
if (parser.resolveOperands(rhsOperands, lhsTypes[0], rhsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PropEqOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getLhs();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getRhs();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getLhs().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void PropEqOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::PropEqOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::PropertyAssertOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
PropertyAssertOpGenericAdaptorBase::PropertyAssertOpGenericAdaptorBase(PropertyAssertOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
::llvm::StringRef PropertyAssertOpGenericAdaptorBase::getMessage() {
|
|
auto attr = getMessageAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
|
|
} // namespace detail
|
|
PropertyAssertOpAdaptor::PropertyAssertOpAdaptor(PropertyAssertOp op) : PropertyAssertOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult PropertyAssertOpAdaptor::verify(::mlir::Location loc) {
|
|
auto tblgen_message = getProperties().message; (void)tblgen_message;
|
|
if (!tblgen_message) return emitError(loc, "'om.property_assert' op requires attribute 'message'");
|
|
|
|
if (tblgen_message && !((::llvm::isa<::mlir::StringAttr>(tblgen_message))))
|
|
return emitError(loc, "'om.property_assert' op attribute 'message' failed to satisfy constraint: string attribute");
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PropertyAssertOp::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.message;
|
|
auto attr = dict.get("message");
|
|
if (attr) {
|
|
auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
|
|
if (convertedAttr) {
|
|
propStorage = convertedAttr;
|
|
} else {
|
|
emitError() << "Invalid attribute `message` in property conversion: " << attr;
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::mlir::Attribute PropertyAssertOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
|
|
::mlir::SmallVector<::mlir::NamedAttribute> attrs;
|
|
::mlir::Builder odsBuilder{ctx};
|
|
|
|
{
|
|
const auto &propStorage = prop.message;
|
|
if (propStorage)
|
|
attrs.push_back(odsBuilder.getNamedAttr("message",
|
|
propStorage));
|
|
}
|
|
|
|
if (!attrs.empty())
|
|
return odsBuilder.getDictionaryAttr(attrs);
|
|
return {};
|
|
}
|
|
|
|
llvm::hash_code PropertyAssertOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine(
|
|
llvm::hash_value(prop.message.getAsOpaquePointer()));
|
|
}
|
|
|
|
std::optional<mlir::Attribute> PropertyAssertOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
if (name == "message")
|
|
return prop.message;
|
|
return std::nullopt;
|
|
}
|
|
|
|
void PropertyAssertOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
if (name == "message") {
|
|
prop.message = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.message)>>(value);
|
|
return;
|
|
}
|
|
}
|
|
|
|
void PropertyAssertOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
if (prop.message) attrs.append("message", prop.message);
|
|
}
|
|
|
|
::llvm::LogicalResult PropertyAssertOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
{
|
|
::mlir::Attribute attr = attrs.get(getMessageAttrName(opName));
|
|
if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_OM2(attr, "message", emitError)))
|
|
return ::mlir::failure();
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PropertyAssertOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
|
|
auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
|
|
if (::mlir::failed(reader.readAttribute(prop.message)))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PropertyAssertOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
|
|
auto &prop = getProperties(); (void)prop;
|
|
writer.writeAttribute(prop.message);
|
|
}
|
|
|
|
::llvm::StringRef PropertyAssertOp::getMessage() {
|
|
auto attr = getMessageAttr();
|
|
return attr.getValue();
|
|
}
|
|
|
|
void PropertyAssertOp::setMessage(::llvm::StringRef attrValue) {
|
|
getProperties().message = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
|
|
}
|
|
|
|
void PropertyAssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::StringAttr message) {
|
|
odsState.addOperands(condition);
|
|
odsState.getOrAddProperties<Properties>().message = message;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::mlir::StringAttr message) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
auto __res__ = ::llvm::dyn_cast<PropertyAssertOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::mlir::StringAttr message) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
}
|
|
|
|
void PropertyAssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::StringAttr message) {
|
|
odsState.addOperands(condition);
|
|
odsState.getOrAddProperties<Properties>().message = message;
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::StringAttr message) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
auto __res__ = ::llvm::dyn_cast<PropertyAssertOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::StringAttr message) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
}
|
|
|
|
void PropertyAssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::llvm::StringRef message) {
|
|
odsState.addOperands(condition);
|
|
odsState.getOrAddProperties<Properties>().message = odsBuilder.getStringAttr(message);
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value condition, ::llvm::StringRef message) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
auto __res__ = ::llvm::dyn_cast<PropertyAssertOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value condition, ::llvm::StringRef message) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
}
|
|
|
|
void PropertyAssertOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::llvm::StringRef message) {
|
|
odsState.addOperands(condition);
|
|
odsState.getOrAddProperties<Properties>().message = odsBuilder.getStringAttr(message);
|
|
assert(resultTypes.size() == 0u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::llvm::StringRef message) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
auto __res__ = ::llvm::dyn_cast<PropertyAssertOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::llvm::StringRef message) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(condition)>(condition), std::forward<decltype(message)>(message));
|
|
}
|
|
|
|
void PropertyAssertOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
assert(operands.size() == 1u && "mismatched number of parameters");
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
|
|
if (!attributes.empty()) {
|
|
(void)odsState.getOrAddProperties<PropertyAssertOp::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.");
|
|
}
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::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<PropertyAssertOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::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 PropertyAssertOp::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() == 0u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::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<PropertyAssertOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
PropertyAssertOp PropertyAssertOp::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 PropertyAssertOp::verifyInvariantsImpl() {
|
|
auto tblgen_message = getProperties().message; (void)tblgen_message;
|
|
if (!tblgen_message) return emitOpError("requires attribute 'message'");
|
|
|
|
if (::mlir::failed(__mlir_ods_local_attr_constraint_OM2(*this, tblgen_message, "message")))
|
|
return ::mlir::failure();
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM14(*this, v.getType(), "operand", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult PropertyAssertOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult PropertyAssertOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{};
|
|
::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc;
|
|
(void)conditionOperandsLoc;
|
|
::mlir::StringAttr messageAttr;
|
|
::mlir::Type conditionRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> conditionTypes(&conditionRawType, 1);
|
|
|
|
conditionOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperand(conditionRawOperand))
|
|
return ::mlir::failure();
|
|
if (parser.parseComma())
|
|
return ::mlir::failure();
|
|
|
|
if (parser.parseCustomAttributeWithFallback(messageAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
|
|
return ::mlir::failure();
|
|
}
|
|
if (messageAttr) result.getOrAddProperties<PropertyAssertOp::Properties>().message = messageAttr;
|
|
{
|
|
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::IntegerType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
conditionRawType = type;
|
|
}
|
|
if (parser.resolveOperands(conditionOperands, conditionTypes, conditionOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void PropertyAssertOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getCondition();
|
|
_odsPrinter << ",";
|
|
_odsPrinter << ' ';
|
|
_odsPrinter.printAttributeWithoutType(getMessageAttr());
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
elidedAttrs.push_back("message");
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getCondition().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::mlir::IntegerType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::PropertyAssertOp)
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::detail::PropertyAssertOpGenericAdaptorBase::Properties)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::StringConcatOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
StringConcatOpGenericAdaptorBase::StringConcatOpGenericAdaptorBase(StringConcatOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
std::pair<unsigned, unsigned> StringConcatOpGenericAdaptorBase::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
|
|
StringConcatOpAdaptor::StringConcatOpAdaptor(StringConcatOp op) : StringConcatOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult StringConcatOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
std::pair<unsigned, unsigned> StringConcatOp::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 StringConcatOp::getStringsMutable() {
|
|
auto range = getODSOperandIndexAndLength(0);
|
|
auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
|
|
return mutableRange;
|
|
}
|
|
|
|
::llvm::LogicalResult StringConcatOp::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 StringConcatOp::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 StringConcatOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> StringConcatOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void StringConcatOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void StringConcatOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult StringConcatOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void StringConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange strings) {
|
|
odsState.addOperands(strings);
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange strings) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result), std::forward<decltype(strings)>(strings));
|
|
auto __res__ = ::llvm::dyn_cast<StringConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange strings) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result), std::forward<decltype(strings)>(strings));
|
|
}
|
|
|
|
void StringConcatOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
assert(resultTypes.size() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::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<StringConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::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 StringConcatOp::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() == 1u && "mismatched number of return types");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::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<StringConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::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 StringConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
odsState.addOperands(operands);
|
|
odsState.addAttributes(attributes);
|
|
odsState.addTypes({operands[0].getType()});
|
|
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
auto __res__ = ::llvm::dyn_cast<StringConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
|
|
}
|
|
|
|
void StringConcatOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::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({operands[0].getType()});
|
|
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
auto __res__ = ::llvm::dyn_cast<StringConcatOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
StringConcatOp StringConcatOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
|
|
}
|
|
|
|
::llvm::LogicalResult StringConcatOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSOperands(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM15(*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_OM16(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult StringConcatOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult StringConcatOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> stringsOperands;
|
|
::llvm::SMLoc stringsOperandsLoc;
|
|
(void)stringsOperandsLoc;
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
|
|
stringsOperandsLoc = parser.getCurrentLocation();
|
|
if (parser.parseOperandList(stringsOperands))
|
|
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();
|
|
|
|
{
|
|
::circt::om::StringType type;
|
|
if (parser.parseCustomTypeWithFallback(type))
|
|
return ::mlir::failure();
|
|
resultRawType = type;
|
|
}
|
|
result.addTypes(resultTypes);
|
|
if (parser.resolveOperands(stringsOperands, resultTypes[0], stringsOperandsLoc, result.operands))
|
|
return ::mlir::failure();
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void StringConcatOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
_odsPrinter << ' ';
|
|
_odsPrinter << getStrings();
|
|
::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
|
|
_odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
|
|
_odsPrinter << ' ' << ":";
|
|
_odsPrinter << ' ';
|
|
{
|
|
auto type = getResult().getType();
|
|
if (auto validType = ::llvm::dyn_cast<::circt::om::StringType>(type))
|
|
_odsPrinter.printStrippedAttrOrType(validType);
|
|
else
|
|
_odsPrinter << type;
|
|
}
|
|
}
|
|
|
|
void StringConcatOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
|
|
}
|
|
|
|
|
|
} // namespace circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::StringConcatOp)
|
|
|
|
namespace circt::om {
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// ::circt::om::UnknownValueOp definitions
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
namespace detail {
|
|
|
|
UnknownValueOpGenericAdaptorBase::UnknownValueOpGenericAdaptorBase(UnknownValueOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
|
|
|
|
|
|
} // namespace detail
|
|
UnknownValueOpAdaptor::UnknownValueOpAdaptor(UnknownValueOp op) : UnknownValueOpGenericAdaptor(op->getOperands(), op) {}
|
|
|
|
::llvm::LogicalResult UnknownValueOpAdaptor::verify(::mlir::Location loc) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UnknownValueOp::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 UnknownValueOp::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 UnknownValueOp::computePropertiesHash(const Properties &prop) {
|
|
using llvm::hash_value;
|
|
return llvm::hash_combine();
|
|
}
|
|
|
|
std::optional<mlir::Attribute> UnknownValueOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
void UnknownValueOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
|
|
}
|
|
|
|
void UnknownValueOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
|
|
}
|
|
|
|
::llvm::LogicalResult UnknownValueOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
|
|
return ::mlir::success();
|
|
}
|
|
|
|
void UnknownValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result) {
|
|
odsState.addTypes(result);
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result) {
|
|
::mlir::OperationState __state__(location, getOperationName());
|
|
build(builder, __state__, std::forward<decltype(result)>(result));
|
|
auto __res__ = ::llvm::dyn_cast<UnknownValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(result)>(result));
|
|
}
|
|
|
|
void UnknownValueOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
|
|
assert(resultTypes.size() == 1u && "mismatched number of results");
|
|
odsState.addTypes(resultTypes);
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::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<UnknownValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes) {
|
|
return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes));
|
|
}
|
|
|
|
void UnknownValueOp::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);
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::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<UnknownValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::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 UnknownValueOp::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);
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::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<UnknownValueOp>(builder.create(__state__));
|
|
assert(__res__ && "builder didn't return the right type");
|
|
return __res__;
|
|
}
|
|
|
|
UnknownValueOp UnknownValueOp::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 UnknownValueOp::verifyInvariantsImpl() {
|
|
{
|
|
unsigned index = 0; (void)index;
|
|
auto valueGroup0 = getODSResults(0);
|
|
|
|
for (auto v : valueGroup0) {
|
|
if (::mlir::failed(__mlir_ods_local_type_constraint_OM1(*this, v.getType(), "result", index++)))
|
|
return ::mlir::failure();
|
|
}
|
|
}
|
|
return ::mlir::success();
|
|
}
|
|
|
|
::llvm::LogicalResult UnknownValueOp::verifyInvariants() {
|
|
return verifyInvariantsImpl();
|
|
}
|
|
|
|
::mlir::ParseResult UnknownValueOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
|
|
::mlir::Type resultRawType{};
|
|
::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
|
|
{
|
|
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 UnknownValueOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
|
|
::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 circt::om
|
|
MLIR_DEFINE_EXPLICIT_TYPE_ID(::circt::om::UnknownValueOp)
|
|
|
|
|
|
#endif // GET_OP_CLASSES
|
|
|