25static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
26 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
27 unsigned valueIndex) {
28 if (!((::llvm::isa<::llzk::string::StringType>(type)))) {
29 return op->emitOpError(valueKind) <<
" #" << valueIndex
30 <<
" must be string type, but got " << type;
32 return ::mlir::success();
35static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
36 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
37 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
38 return emitError() <<
"attribute '" << attrName
39 <<
"' failed to satisfy constraint: string attribute";
40 return ::mlir::success();
42static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
43 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
44 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
45 return op->emitOpError();
61 return attr.getValue();
70 if (!tblgen_value)
return emitError(loc,
"'string.new' op requires attribute 'value'");
72 if (tblgen_value && !((::llvm::isa<::mlir::StringAttr>(tblgen_value))))
73 return emitError(loc,
"'string.new' op attribute 'value' 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.
value;
86 auto attr = dict.get(
"value");
88 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
90 propStorage = convertedAttr;
92 emitError() <<
"Invalid attribute `value` in property conversion: " << attr;
93 return ::mlir::failure();
97 return ::mlir::success();
101 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
102 ::mlir::Builder odsBuilder{ctx};
105 const auto &propStorage = prop.
value;
107 attrs.push_back(odsBuilder.getNamedAttr(
"value",
112 return odsBuilder.getDictionaryAttr(attrs);
117 using llvm::hash_value;
118 return llvm::hash_combine(
119 llvm::hash_value(prop.
value.getAsOpaquePointer()));
129 if (name ==
"value") {
130 prop.
value = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
value)>>(value);
136 if (prop.
value) attrs.append(
"value", prop.
value);
139::llvm::LogicalResult
LitStringOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
142 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"value", emitError)))
143 return ::mlir::failure();
145 return ::mlir::success();
149 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
150 if (::mlir::failed(reader.readAttribute(prop.
value)))
151 return ::mlir::failure();
152 return ::mlir::success();
156 auto &prop = getProperties(); (void)prop;
157 writer.writeAttribute(prop.
value);
162 return attr.getValue();
166 getProperties().value = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
169void LitStringOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr value) {
170 odsState.getOrAddProperties<
Properties>().value = value;
171 odsState.addTypes(result);
176 build(builder, __state__, std::forward<
decltype(result)>(result), std::forward<
decltype(value)>(value));
177 auto __res__ = ::llvm::dyn_cast<LitStringOp>(builder.create(__state__));
178 assert(__res__ &&
"builder didn't return the right type");
183 return create(builder, builder.getLoc(), std::forward<
decltype(result)>(result), std::forward<
decltype(value)>(value));
186void LitStringOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value) {
187 odsState.getOrAddProperties<
Properties>().value = value;
188 assert(resultTypes.size() == 1u &&
"mismatched number of results");
189 odsState.addTypes(resultTypes);
194 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(value)>(value));
195 auto __res__ = ::llvm::dyn_cast<LitStringOp>(builder.create(__state__));
196 assert(__res__ &&
"builder didn't return the right type");
201 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(value)>(value));
204void LitStringOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef value) {
205 odsState.getOrAddProperties<
Properties>().value = odsBuilder.getStringAttr(value);
206 odsState.addTypes(result);
211 build(builder, __state__, std::forward<
decltype(result)>(result), std::forward<
decltype(value)>(value));
212 auto __res__ = ::llvm::dyn_cast<LitStringOp>(builder.create(__state__));
213 assert(__res__ &&
"builder didn't return the right type");
218 return create(builder, builder.getLoc(), std::forward<
decltype(result)>(result), std::forward<
decltype(value)>(value));
221void LitStringOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value) {
222 odsState.getOrAddProperties<
Properties>().value = odsBuilder.getStringAttr(value);
223 assert(resultTypes.size() == 1u &&
"mismatched number of results");
224 odsState.addTypes(resultTypes);
229 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(value)>(value));
230 auto __res__ = ::llvm::dyn_cast<LitStringOp>(builder.create(__state__));
231 assert(__res__ &&
"builder didn't return the right type");
236 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(value)>(value));
239void LitStringOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
240 assert(operands.size() == 0u &&
"mismatched number of parameters");
241 odsState.addOperands(operands);
242 odsState.addAttributes(attributes);
243 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
244 odsState.addTypes(resultTypes);
246 if (!attributes.empty()) {
248 ::mlir::PropertyRef properties = odsState.getRawProperties();
249 std::optional<::mlir::RegisteredOperationName> info =
250 odsState.name.getRegisteredInfo();
251 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
252 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
253 ::llvm::report_fatal_error(
"Property conversion failed.");
257LitStringOp LitStringOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
259 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
260 auto __res__ = ::llvm::dyn_cast<LitStringOp>(builder.create(__state__));
261 assert(__res__ &&
"builder didn't return the right type");
265LitStringOp LitStringOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
266 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
269void LitStringOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
270 assert(operands.size() == 0u &&
"mismatched number of parameters");
271 odsState.addOperands(operands);
272 odsState.useProperties(
const_cast<Properties&
>(properties));
273 odsState.addAttributes(discardableAttributes);
274 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
275 odsState.addTypes(resultTypes);
278LitStringOp LitStringOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
280 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
281 auto __res__ = ::llvm::dyn_cast<LitStringOp>(builder.create(__state__));
282 assert(__res__ &&
"builder didn't return the right type");
286LitStringOp LitStringOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
287 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));
291 auto tblgen_value = getProperties().value; (void)tblgen_value;
292 if (!tblgen_value)
return emitOpError(
"requires attribute 'value'");
294 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_value,
"value")))
295 return ::mlir::failure();
297 unsigned index = 0; (void)index;
300 for (
auto v : valueGroup0) {
301 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
302 return ::mlir::failure();
305 return ::mlir::success();
313 ::mlir::StringAttr valueAttr;
315 if (parser.parseCustomAttributeWithFallback(valueAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
316 return ::mlir::failure();
320 auto loc = parser.getCurrentLocation();(void)loc;
321 if (parser.parseOptionalAttrDict(result.attributes))
322 return ::mlir::failure();
324 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
326 return ::mlir::failure();
329 result.addTypes(odsBuildableType0);
330 return ::mlir::success();
336 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
337 elidedAttrs.push_back(
"value");
338 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
341void LitStringOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
LitStringOpAdaptor(LitStringOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
static llvm::hash_code computePropertiesHash(const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr value)
void print(::mlir::OpAsmPrinter &_odsPrinter)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::LogicalResult verifyInvariantsImpl()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::Operation::result_range getODSResults(unsigned index)
static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::StringAttr value)
::mlir::StringAttr getValueAttr()
static constexpr ::llvm::StringLiteral getOperationName()
void setValue(::llvm::StringRef attrValue)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::StringAttr getValueAttrName()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
FoldAdaptor::Properties Properties
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::StringRef getValue()
::mlir::DictionaryAttr odsAttrs
::mlir::StringAttr getValueAttr()
::llvm::StringRef getValue()
::std::optional<::mlir::OperationName > odsOpName
LitStringOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
const Properties & getProperties()