25static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
26 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
27 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
28 return emitError() <<
"attribute '" << attrName
29 <<
"' failed to satisfy constraint: string attribute";
30 return ::mlir::success();
32static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
33 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
34 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
35 return op->emitOpError();
51 return attr.getValue();
56 return attr.getValue();
65 if (!tblgen_path)
return emitError(loc,
"'include.from' op requires attribute 'path'");
67 if (!tblgen_sym_name)
return emitError(loc,
"'include.from' op requires attribute 'sym_name'");
69 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
70 return emitError(loc,
"'include.from' op attribute 'sym_name' failed to satisfy constraint: string attribute");
72 if (tblgen_path && !((::llvm::isa<::mlir::StringAttr>(tblgen_path))))
73 return emitError(loc,
"'include.from' op attribute 'path' failed to satisfy constraint: string attribute");
74 return ::mlir::success();
78 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
80 emitError() <<
"expected DictionaryAttr to set properties";
81 return ::mlir::failure();
85 auto &propStorage = prop.
path;
86 auto attr = dict.get(
"path");
88 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
90 propStorage = convertedAttr;
92 emitError() <<
"Invalid attribute `path` in property conversion: " << attr;
93 return ::mlir::failure();
100 auto attr = dict.get(
"sym_name");
102 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
104 propStorage = convertedAttr;
106 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
107 return ::mlir::failure();
111 return ::mlir::success();
115 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
116 ::mlir::Builder odsBuilder{ctx};
119 const auto &propStorage = prop.
path;
121 attrs.push_back(odsBuilder.getNamedAttr(
"path",
126 const auto &propStorage = prop.
sym_name;
128 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
133 return odsBuilder.getDictionaryAttr(attrs);
138 using llvm::hash_value;
139 return llvm::hash_combine(
140 llvm::hash_value(prop.
path.getAsOpaquePointer()),
141 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
148 if (name ==
"sym_name")
154 if (name ==
"path") {
155 prop.
path = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
path)>>(value);
159 if (name ==
"sym_name") {
160 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
166 if (prop.
path) attrs.append(
"path", prop.
path);
171::llvm::LogicalResult
IncludeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
174 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"path", emitError)))
175 return ::mlir::failure();
180 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
181 return ::mlir::failure();
183 return ::mlir::success();
187 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
188 if (::mlir::failed(reader.readAttribute(prop.
path)))
189 return ::mlir::failure();
191 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
192 return ::mlir::failure();
193 return ::mlir::success();
197 auto &prop = getProperties(); (void)prop;
198 writer.writeAttribute(prop.
path);
199 writer.writeAttribute(prop.
sym_name);
204 return attr.getValue();
209 return attr.getValue();
213 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
217 getProperties().path = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
220void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
221 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
222 odsState.getOrAddProperties<
Properties>().path = path;
227 build(builder, __state__, std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
228 auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
229 assert(__res__ &&
"builder didn't return the right type");
234 return create(builder, builder.getLoc(), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
237void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
238 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
239 odsState.getOrAddProperties<
Properties>().path = path;
240 assert(resultTypes.size() == 0u &&
"mismatched number of results");
241 odsState.addTypes(resultTypes);
244IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
246 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
247 auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
248 assert(__res__ &&
"builder didn't return the right type");
252IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
253 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
256void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
257 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
258 odsState.getOrAddProperties<
Properties>().path = odsBuilder.getStringAttr(path);
263 build(builder, __state__, std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
264 auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
265 assert(__res__ &&
"builder didn't return the right type");
270 return create(builder, builder.getLoc(), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
273void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
274 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
275 odsState.getOrAddProperties<
Properties>().path = odsBuilder.getStringAttr(path);
276 assert(resultTypes.size() == 0u &&
"mismatched number of results");
277 odsState.addTypes(resultTypes);
280IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
282 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
283 auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
284 assert(__res__ &&
"builder didn't return the right type");
288IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
289 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(path)>(path));
292void IncludeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
293 assert(operands.size() == 0u &&
"mismatched number of parameters");
294 odsState.addOperands(operands);
295 odsState.addAttributes(attributes);
296 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
297 odsState.addTypes(resultTypes);
299 if (!attributes.empty()) {
301 ::mlir::PropertyRef properties = odsState.getRawProperties();
302 std::optional<::mlir::RegisteredOperationName> info =
303 odsState.name.getRegisteredInfo();
304 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
305 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
306 ::llvm::report_fatal_error(
"Property conversion failed.");
310IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
312 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
313 auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
314 assert(__res__ &&
"builder didn't return the right type");
318IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
319 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
322void IncludeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
323 assert(operands.size() == 0u &&
"mismatched number of parameters");
324 odsState.addOperands(operands);
325 odsState.useProperties(
const_cast<Properties&
>(properties));
326 odsState.addAttributes(discardableAttributes);
327 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
328 odsState.addTypes(resultTypes);
331IncludeOp IncludeOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
333 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
334 auto __res__ = ::llvm::dyn_cast<IncludeOp>(builder.create(__state__));
335 assert(__res__ &&
"builder didn't return the right type");
339IncludeOp IncludeOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
340 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));
344 auto tblgen_path = getProperties().path; (void)tblgen_path;
345 if (!tblgen_path)
return emitOpError(
"requires attribute 'path'");
346 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
347 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
349 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
350 return ::mlir::failure();
352 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_path,
"path")))
353 return ::mlir::failure();
354 return ::mlir::success();
361::mlir::ParseResult
IncludeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
362 ::mlir::StringAttr pathAttr;
363 ::mlir::StringAttr sym_nameAttr;
365 if (parser.parseCustomAttributeWithFallback(pathAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
366 return ::mlir::failure();
369 if (parser.parseKeyword(
"as"))
370 return ::mlir::failure();
372 if (parser.parseSymbolName(sym_nameAttr))
373 return ::mlir::failure();
376 auto loc = parser.getCurrentLocation();(void)loc;
377 if (parser.parseOptionalAttrDict(result.attributes))
378 return ::mlir::failure();
380 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
382 return ::mlir::failure();
384 return ::mlir::success();
389 _odsPrinter.printAttributeWithoutType(
getPathAttr());
390 _odsPrinter <<
' ' <<
"as";
393 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
394 elidedAttrs.push_back(
"path");
395 elidedAttrs.push_back(
"sym_name");
396 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
IncludeOpAdaptor(IncludeOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
IncludeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::StringAttr getPathAttrName()
::llvm::StringRef getSymName()
static constexpr ::llvm::StringLiteral getOperationName()
::llvm::LogicalResult verifyInvariantsImpl()
static llvm::hash_code computePropertiesHash(const Properties &prop)
FoldAdaptor::Properties Properties
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
void setSymName(::llvm::StringRef attrValue)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::StringRef getPath()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::StringAttr getPathAttr()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::StringAttr getSymNameAttrName()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr path)
::llvm::LogicalResult verifyInvariants()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::StringAttr getSymNameAttr()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
void setPath(::llvm::StringRef attrValue)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
static IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::StringAttr path)
IncludeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
const Properties & getProperties()
::llvm::StringRef getPath()
::mlir::StringAttr getPathAttr()
::mlir::RegionRange odsRegions
::mlir::StringAttr getSymNameAttr()
::llvm::StringRef getSymName()