27static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
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 ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
35 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
36 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
37 return op->emitOpError();
54 return attr.getValue();
59 return attr.getValue();
67 if (!tblgen_path)
return emitError(loc,
"'include.from' op ""requires attribute 'path'");
69 if (!tblgen_sym_name)
return emitError(loc,
"'include.from' op ""requires attribute 'sym_name'");
71 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
72 return emitError(loc,
"'include.from' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
74 if (tblgen_path && !((::llvm::isa<::mlir::StringAttr>(tblgen_path))))
75 return emitError(loc,
"'include.from' op ""attribute 'path' failed to satisfy constraint: string attribute");
76 return ::mlir::success();
80 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
82 emitError() <<
"expected DictionaryAttr to set properties";
83 return ::mlir::failure();
87 auto &propStorage = prop.
path;
88 auto attr = dict.get(
"path");
90 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
92 propStorage = convertedAttr;
94 emitError() <<
"Invalid attribute `path` in property conversion: " << attr;
95 return ::mlir::failure();
102 auto attr = dict.get(
"sym_name");
104 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
106 propStorage = convertedAttr;
108 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
109 return ::mlir::failure();
113 return ::mlir::success();
117 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
118 ::mlir::Builder odsBuilder{ctx};
121 const auto &propStorage = prop.
path;
123 attrs.push_back(odsBuilder.getNamedAttr(
"path",
128 const auto &propStorage = prop.
sym_name;
130 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
135 return odsBuilder.getDictionaryAttr(attrs);
140 return llvm::hash_combine(
141 llvm::hash_value(prop.
path.getAsOpaquePointer()),
142 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
149 if (
name ==
"sym_name")
155 if (
name ==
"path") {
156 prop.
path = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
path)>>(value);
160 if (
name ==
"sym_name") {
161 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
167 if (prop.
path) attrs.append(
"path", prop.
path);
172::llvm::LogicalResult
IncludeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
175 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"path", emitError)))
176 return ::mlir::failure();
181 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
182 return ::mlir::failure();
184 return ::mlir::success();
188 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
189 if (::mlir::failed(reader.readAttribute(prop.
path)))
190 return ::mlir::failure();
192 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
193 return ::mlir::failure();
194 return ::mlir::success();
198 auto &prop = getProperties(); (void)prop;
199 writer.writeAttribute(prop.
path);
200 writer.writeAttribute(prop.
sym_name);
205 return attr.getValue();
210 return attr.getValue();
214 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
218 getProperties().path = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
221void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
222 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
223 odsState.getOrAddProperties<
Properties>().path = path;
226void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr path) {
227 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
228 odsState.getOrAddProperties<
Properties>().path = path;
229 assert(resultTypes.size() == 0u &&
"mismatched number of results");
230 odsState.addTypes(resultTypes);
233void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
234 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
235 odsState.getOrAddProperties<
Properties>().path = odsBuilder.getStringAttr(path);
238void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef path) {
239 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
240 odsState.getOrAddProperties<
Properties>().path = odsBuilder.getStringAttr(path);
241 assert(resultTypes.size() == 0u &&
"mismatched number of results");
242 odsState.addTypes(resultTypes);
245void IncludeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
246 assert(operands.size() == 0u &&
"mismatched number of parameters");
247 odsState.addOperands(operands);
248 odsState.addAttributes(attributes);
249 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
250 odsState.addTypes(resultTypes);
252 if (!attributes.empty()) {
253 ::mlir::OpaqueProperties properties =
255 std::optional<::mlir::RegisteredOperationName> info =
256 odsState.name.getRegisteredInfo();
257 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
258 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
259 ::llvm::report_fatal_error(
"Property conversion failed.");
264 auto tblgen_path = getProperties().path; (void)tblgen_path;
265 if (!tblgen_path)
return emitOpError(
"requires attribute 'path'");
266 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
267 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
269 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
270 return ::mlir::failure();
272 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_path,
"path")))
273 return ::mlir::failure();
274 return ::mlir::success();
281::mlir::ParseResult
IncludeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
282 ::mlir::StringAttr pathAttr;
283 ::mlir::StringAttr sym_nameAttr;
285 if (parser.parseCustomAttributeWithFallback(pathAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
286 return ::mlir::failure();
289 if (parser.parseKeyword(
"as"))
290 return ::mlir::failure();
292 if (parser.parseSymbolName(sym_nameAttr))
293 return ::mlir::failure();
296 auto loc = parser.getCurrentLocation();(void)loc;
297 if (parser.parseOptionalAttrDict(result.attributes))
298 return ::mlir::failure();
300 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
302 return ::mlir::failure();
304 return ::mlir::success();
309 _odsPrinter.printAttributeWithoutType(
getPathAttr());
310 _odsPrinter <<
' ' <<
"as";
313 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
314 elidedAttrs.push_back(
"path");
315 elidedAttrs.push_back(
"sym_name");
316 _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()
::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)
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()