27static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
28 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
29 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
30 return emitError() <<
"attribute '" << attrName
31 <<
"' failed to satisfy constraint: string attribute";
32 return ::mlir::success();
34static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
35 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
36 return __mlir_ods_local_attr_constraint_Ops0(attr, attrName, [op]() {
37 return op->emitOpError();
65 auto attr = ::llvm::cast<::mlir::StringAttr>(
getProperties().sym_name);
71 return attr.getValue();
75 auto attr = ::llvm::cast<::mlir::StringAttr>(
getProperties().path);
81 return attr.getValue();
89 if (!tblgen_path)
return emitError(loc,
"'include.from' op ""requires attribute 'path'");
91 if (!tblgen_sym_name)
return emitError(loc,
"'include.from' op ""requires attribute 'sym_name'");
93 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
94 return emitError(loc,
"'include.from' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
96 if (tblgen_path && !((::llvm::isa<::mlir::StringAttr>(tblgen_path))))
97 return emitError(loc,
"'include.from' op ""attribute 'path' failed to satisfy constraint: string attribute");
98 return ::mlir::success();
107 return {std::next(getOperation()->operand_begin(), valueRange.first),
108 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
117 return {std::next(getOperation()->result_begin(), valueRange.first),
118 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
122 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
124 emitError() <<
"expected DictionaryAttr to set properties";
125 return ::mlir::failure();
129 auto &propStorage = prop.
path;
130 auto attr = dict.get(
"path");
133 emitError() <<
"expected key entry for path in DictionaryAttr to set "
135 return ::mlir::failure();
137 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
139 propStorage = convertedAttr;
141 emitError() <<
"Invalid attribute `path` in property conversion: " << attr;
142 return ::mlir::failure();
149 auto attr = dict.get(
"sym_name");
152 emitError() <<
"expected key entry for sym_name in DictionaryAttr to set "
154 return ::mlir::failure();
156 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
158 propStorage = convertedAttr;
160 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
161 return ::mlir::failure();
165 return ::mlir::success();
169 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
170 ::mlir::Builder odsBuilder{ctx};
173 const auto &propStorage = prop.
path;
175 attrs.push_back(odsBuilder.getNamedAttr(
"path",
180 const auto &propStorage = prop.
sym_name;
182 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
187 return odsBuilder.getDictionaryAttr(attrs);
192 return llvm::hash_combine(
193 llvm::hash_value(prop.
path.getAsOpaquePointer()),
194 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
201 if (name ==
"sym_name")
207 if (name ==
"path") {
208 prop.
path = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
path)>>(value);
212 if (name ==
"sym_name") {
213 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
219 if (prop.
path) attrs.append(
"path", prop.
path);
224::mlir::LogicalResult
IncludeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
227 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr,
"path", emitError)))
228 return ::mlir::failure();
233 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr,
"sym_name", emitError)))
234 return ::mlir::failure();
236 return ::mlir::success();
240 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
241 if (::mlir::failed(reader.readAttribute(prop.
path)))
242 return ::mlir::failure();
244 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
245 return ::mlir::failure();
246 return ::mlir::success();
250 auto &prop = getProperties(); (void)prop;
251 writer.writeAttribute(prop.
path);
252 writer.writeAttribute(prop.
sym_name);
256 return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
261 return attr.getValue();
265 return ::llvm::cast<::mlir::StringAttr>(getProperties().path);
270 return attr.getValue();
278 (*this)->setAttr(
getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue));
286 (*this)->setAttr(
getPathAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue));
289void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
290 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
291 odsState.getOrAddProperties<
Properties>().path = path;
294void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
295 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
296 odsState.getOrAddProperties<
Properties>().path = path;
297 assert(resultTypes.size() == 0u &&
"mismatched number of results");
298 odsState.addTypes(resultTypes);
301void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
302 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
303 odsState.getOrAddProperties<
Properties>().path = odsBuilder.getStringAttr(path);
306void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
307 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
308 odsState.getOrAddProperties<
Properties>().path = odsBuilder.getStringAttr(path);
309 assert(resultTypes.size() == 0u &&
"mismatched number of results");
310 odsState.addTypes(resultTypes);
313void IncludeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
314 assert(operands.size() == 0u &&
"mismatched number of parameters");
315 odsState.addOperands(operands);
316 odsState.addAttributes(attributes);
317 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
318 odsState.addTypes(resultTypes);
322 auto tblgen_path = getProperties().path; (void)tblgen_path;
323 if (!tblgen_path)
return emitOpError(
"requires attribute 'path'");
324 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
325 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
327 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*
this, tblgen_sym_name,
"sym_name")))
328 return ::mlir::failure();
330 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*
this, tblgen_path,
"path")))
331 return ::mlir::failure();
332 return ::mlir::success();
339::mlir::ParseResult
IncludeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
340 ::mlir::StringAttr pathAttr;
341 ::mlir::StringAttr sym_nameAttr;
343 if (parser.parseCustomAttributeWithFallback(pathAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
344 return ::mlir::failure();
347 if (parser.parseKeyword(
"as"))
348 return ::mlir::failure();
350 if (parser.parseSymbolName(sym_nameAttr))
351 return ::mlir::failure();
354 auto loc = parser.getCurrentLocation();(void)loc;
355 if (parser.parseOptionalAttrDict(result.attributes))
356 return ::mlir::failure();
358 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
360 return ::mlir::failure();
362 return ::mlir::success();
367 _odsPrinter.printAttributeWithoutType(
getPathAttr());
368 _odsPrinter <<
' ' <<
"as";
371 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
372 elidedAttrs.push_back(
"path");
373 elidedAttrs.push_back(
"sym_name");
374 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
IncludeOpAdaptor(IncludeOp op)
IncludeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
::mlir::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::mlir::StringAttr getPathAttrName()
void setPathAttr(::mlir::StringAttr attr)
::mlir::LogicalResult verifyInvariants()
::llvm::StringRef getSymName()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
static llvm::hash_code computePropertiesHash(const Properties &prop)
FoldAdaptor::Properties Properties
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
void setSymName(::llvm::StringRef attrValue)
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::StringRef getPath()
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::StringAttr getSymNameAttr()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::StringAttr getSymNameAttrName()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr path)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
void setSymNameAttr(::mlir::StringAttr attr)
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
::mlir::StringAttr getPathAttr()
::mlir::Operation::result_range getODSResults(unsigned index)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::Operation::operand_range getODSOperands(unsigned index)
void setPath(::llvm::StringRef attrValue)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::LogicalResult verifyInvariantsImpl()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
const Properties & getProperties()
::llvm::StringRef getPath()
::mlir::DictionaryAttr getAttributes()
::mlir::StringAttr getSymNameAttr()
::mlir::RegionRange odsRegions
::mlir::StringAttr getPathAttr()
IncludeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
::llvm::StringRef getSymName()