1// RUN: mlir-tblgen -gen-op-decls -I %S/../../include %s | FileCheck %s 2// RUN: mlir-tblgen -gen-op-decls -op-include-regex="test.a_op" -I %S/../../include %s | FileCheck %s --check-prefix=REDUCE_INC 3// RUN: mlir-tblgen -gen-op-decls -op-exclude-regex="test.a_op" -I %S/../../include %s | FileCheck %s --check-prefix=REDUCE_EXC 4 5// RUN: mlir-tblgen -gen-op-defs -I %S/../../include %s | FileCheck %s --check-prefix=DEFS 6 7include "mlir/IR/AttrTypeBase.td" 8include "mlir/IR/OpBase.td" 9include "mlir/Interfaces/InferTypeOpInterface.td" 10include "mlir/Interfaces/SideEffectInterfaces.td" 11 12def Test_Dialect : Dialect { 13 let name = "test"; 14 let cppNamespace = "NS"; 15 let usePropertiesForAttributes = 0; 16} 17class NS_Op<string mnemonic, list<Trait> traits> : 18 Op<Test_Dialect, mnemonic, traits>; 19 20// IsolatedFromAbove trait is included twice to ensure it gets uniqued during 21// emission. 22def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> { 23 let arguments = (ins 24 I32:$a, 25 Variadic<F32>:$b, 26 27 I32Attr:$attr1, 28 OptionalAttr<F32Attr>:$some_attr2 29 ); 30 31 let results = (outs 32 I32:$r, 33 Variadic<F32>:$s 34 ); 35 36 let regions = (region 37 AnyRegion:$someRegion, 38 VariadicRegion<AnyRegion>:$someRegions 39 ); 40 let builders = [OpBuilder<(ins "Value":$val)>, 41 OpBuilder<(ins CArg<"int", "0">:$integer)>, 42 DeprecatedOpBuilder<"the deprecation message", 43 (ins "float":$something)>]; 44 let hasCustomAssemblyFormat = 1; 45 46 let hasCanonicalizer = 1; 47 let hasFolder = 1; 48 let hasVerifier = 1; 49 50 let extraClassDeclaration = [{ 51 // Display a graph for debugging purposes. 52 void displayGraph(); 53 }]; 54} 55 56// CHECK-LABEL: NS::AOp declarations 57 58// CHECK: namespace detail { 59// CHECK: class AOpGenericAdaptorBase { 60// CHECK: public: 61// CHECK: AOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), odsRegions(regions) 62// CHECK: AOpGenericAdaptorBase(::mlir::Operation *op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), odsRegions(op->getRegions()) {} 63// CHECK: ::mlir::IntegerAttr getAttr1Attr(); 64// CHECK: uint32_t getAttr1(); 65// CHECK: ::mlir::FloatAttr getSomeAttr2Attr(); 66// CHECK: ::std::optional< ::llvm::APFloat > getSomeAttr2(); 67// CHECK: ::mlir::Region &getSomeRegion() { 68// CHECK: ::mlir::RegionRange getSomeRegions() { 69// CHECK: }; 70// CHECK: } 71 72// CHECK: template <typename RangeT> 73// CHECK: class AOpGenericAdaptor : public detail::AOpGenericAdaptorBase { 74// CHECK: public: 75// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} 76// CHECK: AOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} 77// CHECK: AOpGenericAdaptor(RangeT values, const AOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} 78// CHECK: RangeT getODSOperands(unsigned index) { 79// CHECK: ValueT getA() { 80// CHECK: RangeT getB() { 81// CHECK: private: 82// CHECK: RangeT odsOperands; 83// CHECK: }; 84 85// CHECK: class AOpAdaptor : public AOpGenericAdaptor<::mlir::ValueRange> { 86// CHECK: public: 87// CHECK: AOpAdaptor(AOp 88// CHECK: ::llvm::LogicalResult verify( 89// CHECK: }; 90 91// CHECK: class AOp : public ::mlir::Op<AOp, ::mlir::OpTrait::AtLeastNRegions<1>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsIsolatedFromAbove 92// CHECK-NOT: ::mlir::OpTrait::IsIsolatedFromAbove 93// CHECK: public: 94// CHECK: using Op::Op; 95// CHECK: using Adaptor = AOpAdaptor; 96// CHECK: static constexpr ::llvm::StringLiteral getOperationName() { 97// CHECK: return ::llvm::StringLiteral("test.a_op"); 98// CHECK: } 99// CHECK: ::mlir::Operation::operand_range getODSOperands(unsigned index) { 100// CHECK: ::mlir::TypedValue<::mlir::IntegerType> getA() { 101// CHECK: ::mlir::Operation::operand_range getB() { 102// CHECK: ::mlir::OpOperand &getAMutable() { 103// CHECK: ::mlir::MutableOperandRange getBMutable(); 104// CHECK: ::mlir::Operation::result_range getODSResults(unsigned index) { 105// CHECK: ::mlir::TypedValue<::mlir::IntegerType> getR() { 106// CHECK: ::mlir::Region &getSomeRegion() { 107// CHECK: ::mlir::MutableArrayRef<::mlir::Region> getSomeRegions() { 108// CHECK: ::mlir::IntegerAttr getAttr1Attr() { 109// CHECK: uint32_t getAttr1(); 110// CHECK: ::mlir::FloatAttr getSomeAttr2Attr() { 111// CHECK: ::std::optional< ::llvm::APFloat > getSomeAttr2(); 112// CHECK: ::mlir::Attribute removeSomeAttr2Attr() { 113// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value val); 114// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int integer = 0); 115// CHECK{LITERAL}: [[deprecated("the deprecation message")]] 116// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, float something); 117// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::TypeRange s, ::mlir::Value a, ::mlir::ValueRange b, ::mlir::IntegerAttr attr1, /*optional*/::mlir::FloatAttr some_attr2, unsigned someRegionsCount) 118// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::ValueRange b, ::mlir::IntegerAttr attr1, /*optional*/::mlir::FloatAttr some_attr2, unsigned someRegionsCount); 119// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::TypeRange s, ::mlir::Value a, ::mlir::ValueRange b, uint32_t attr1, /*optional*/::mlir::FloatAttr some_attr2, unsigned someRegionsCount) 120// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::ValueRange b, uint32_t attr1, /*optional*/::mlir::FloatAttr some_attr2, unsigned someRegionsCount); 121// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions) 122// CHECK: static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); 123// CHECK: void print(::mlir::OpAsmPrinter &p); 124// CHECK: ::llvm::LogicalResult verifyInvariants(); 125// CHECK: static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); 126// CHECK: ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); 127// CHECK: // Display a graph for debugging purposes. 128// CHECK: void displayGraph(); 129// CHECK: }; 130 131// DEFS-LABEL: NS::AOp definitions 132 133// Check that `getAttrDictionary()` is used when not using properties. 134 135// DECLS: ::mlir::RegionRange AOpGenericAdaptorBase::getSomeRegions() 136// DECLS-NEXT: return odsRegions.drop_front(1); 137// DECLS: ::mlir::RegionRange AOpGenericAdaptorBase::getRegions() 138 139// Check AttrSizedOperandSegments 140// --- 141 142def NS_AttrSizedOperandOp : NS_Op<"attr_sized_operands", 143 [AttrSizedOperandSegments]> { 144 let arguments = (ins 145 Variadic<I32>:$a, 146 Variadic<I32>:$b, 147 I32:$c, 148 Variadic<I32>:$d, 149 I32ElementsAttr:$operandSegmentSizes 150 ); 151} 152 153// CHECK-LABEL: class AttrSizedOperandOpGenericAdaptorBase { 154// CHECK: ::mlir::DenseIntElementsAttr getOperandSegmentSizes(); 155 156// CHECK-LABEL: AttrSizedOperandOpGenericAdaptor( 157// CHECK-SAME: RangeT values 158// CHECK-SAME: ::mlir::DictionaryAttr attrs 159// CHECK: RangeT getA() { 160// CHECK: RangeT getB() { 161// CHECK: ValueT getC() { 162// CHECK: RangeT getD() { 163 164// Check op trait for different number of operands 165// --- 166 167def NS_BOp : NS_Op<"op_with_no_operand", []> { 168 let arguments = (ins); 169} 170 171// CHECK-LABEL: NS::BOp declarations 172// CHECK: OpTrait::ZeroOperands 173 174def NS_COp : NS_Op<"op_with_one_operand", []> { 175 let arguments = (ins I32:$operand); 176} 177 178// CHECK-LABEL: NS::COp declarations 179// CHECK: OpTrait::OneOperand 180 181def NS_DOp : NS_Op<"op_with_two_operands", []> { 182 let arguments = (ins I32:$input1, I32:$input2); 183} 184 185// CHECK-LABEL: NS::DOp declarations 186// CHECK: OpTrait::NOperands<2>::Impl 187 188def NS_EOp : NS_Op<"op_with_optionals", []> { 189 let arguments = (ins Optional<I32>:$a); 190 let results = (outs Optional<F32>:$b); 191} 192 193// CHECK-LABEL: NS::EOp declarations 194// CHECK: ::mlir::TypedValue<::mlir::IntegerType> getA() { 195// CHECK: ::mlir::MutableOperandRange getAMutable(); 196// CHECK: ::mlir::TypedValue<::mlir::FloatType> getB() { 197// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Type b, /*optional*/::mlir::Value a) 198 199// Check that all types match constraint results in generating builder. 200// --- 201 202def NS_FOp : NS_Op<"op_with_all_types_constraint", 203 [AllTypesMatch<["a", "b"]>]> { 204 let arguments = (ins AnyType:$a); 205 let results = (outs Res<AnyType, "output b", []>:$b); 206} 207 208// CHECK-LABEL: class FOp : 209// CHECK: static ::llvm::LogicalResult inferReturnTypes 210 211// DEFS: void FOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a) { 212// DEFS: if (::mlir::succeeded(FOp::inferReturnTypes(odsBuilder.getContext(), 213// DEFS: else 214// DEFS: ::mlir::detail::reportFatalInferReturnTypesError(odsState); 215 216def NS_GOp : NS_Op<"op_with_fixed_return_type", []> { 217 let arguments = (ins AnyType:$a); 218 let results = (outs I32:$b); 219} 220 221// CHECK-LABEL: class GOp : 222// CHECK: static ::llvm::LogicalResult inferReturnTypes 223 224// Check default value for collective params builder. Check that other builders 225// are generated as well. 226def NS_HCollectiveParamsOp : NS_Op<"op_collective_params", []> { 227 let arguments = (ins AnyType:$a); 228 let results = (outs AnyType:$b); 229} 230 231// CHECK-LABEL: class HCollectiveParamsOp : 232// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type b, ::mlir::Value a); 233// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a); 234// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}) 235 236// Check suppression of "separate arg, separate result" build method for an op 237// with single variadic arg and single variadic result (since it will be 238// ambiguous with the collective params build method). 239def NS_HCollectiveParamsSuppress0Op : NS_Op<"op_collective_suppress0", []> { 240 let arguments = (ins Variadic<I32>:$a); 241 let results = (outs Variadic<I32>:$b); 242} 243 244// CHECK-LABEL: class HCollectiveParamsSuppress0Op : 245// CHECK-NOT: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange b, ::mlir::ValueRange a); 246// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 247 248// Check suppression of "separate arg, collective result" build method for an op 249// with single variadic arg and non variadic result (since it will be 250// ambiguous with the collective params build method). 251def NS_HCollectiveParamsSuppress1Op : NS_Op<"op_collective_suppress1", []> { 252 let arguments = (ins Variadic<I32>:$a); 253 let results = (outs I32:$b); 254} 255 256// CHECK-LABEL: class HCollectiveParamsSuppress1Op : 257// CHECK-NOT: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange b, ::mlir::ValueRange a); 258// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 259 260// Check suppression of "separate arg, collective result" build method for an op 261// with single variadic arg and > 1 variadic result (since it will be 262// ambiguous with the collective params build method). Note that "separate arg, 263// separate result" build method should be generated in this case as its not 264// ambiguous with the collective params build method. 265def NS_HCollectiveParamsSuppress2Op : NS_Op<"op_collective_suppress2", [SameVariadicResultSize]> { 266 let arguments = (ins Variadic<I32>:$a); 267 let results = (outs Variadic<I32>:$b, Variadic<F32>:$c); 268} 269// CHECK-LABEL: class HCollectiveParamsSuppress2Op : 270// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange b, ::mlir::TypeRange c, ::mlir::ValueRange a); 271// CHECK-NOT: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange b, ::mlir::ValueRange a); 272// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 273 274// Check default value of `attributes` for the `genUseOperandAsResultTypeCollectiveParamBuilder` builder 275def NS_IOp : NS_Op<"op_with_same_operands_and_result_types_trait", [SameOperandsAndResultType]> { 276 let arguments = (ins AnyType:$a, AnyType:$b); 277 let results = (outs AnyType:$r); 278} 279// CHECK-LABEL: class IOp : 280// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::Value a, ::mlir::Value b); 281// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); 282// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); 283// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 284// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 285 286// Check default value of `attributes` for the `genInferredTypeCollectiveParamBuilder` builder 287def NS_JOp : NS_Op<"op_with_InferTypeOpInterface_interface", [DeclareOpInterfaceMethods<InferTypeOpInterface>]> { 288 let arguments = (ins AnyType:$a, AnyType:$b); 289 let results = (outs AnyType:$r); 290} 291// CHECK-LABEL: class JOp : 292// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::Value a, ::mlir::Value b); 293// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); 294// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); 295// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 296// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 297 298// Test usage of TraitList getting flattened during emission. 299def NS_KOp : NS_Op<"k_op", [IsolatedFromAbove, 300 TraitList<[DeclareOpInterfaceMethods<InferTypeOpInterface>]>]> { 301 let arguments = (ins AnyType:$a, AnyType:$b); 302} 303 304// CHECK: class KOp : public ::mlir::Op<KOp, 305// CHECK-SAME: ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::InferTypeOpInterface::Trait 306 307// Check native OpTrait usage 308// --- 309 310def NS_TestTrait : NativeOpTrait<"TestTrait"> { 311 let cppNamespace = "SomeNamespace"; 312} 313 314def NS_KWithTraitOp : NS_Op<"KWithTrait", [NS_TestTrait]>; 315 316// CHECK-LABEL: NS::KWithTraitOp declarations 317// CHECK: class KWithTraitOp : public ::mlir::Op<KWithTraitOp 318// CHECK-SAME: SomeNamespace::TestTrait 319 320def NS_LOp : NS_Op<"op_with_same_operands_and_result_types_unwrapped_attr", [SameOperandsAndResultType]> { 321 let arguments = (ins AnyType:$a, AnyType:$b, I32Attr:$attr1); 322 let results = (outs AnyType:$r); 323} 324// CHECK-LABEL: class LOp : 325// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::Value a, ::mlir::Value b, ::mlir::IntegerAttr attr1); 326// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::IntegerAttr attr1); 327// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::IntegerAttr attr1); 328// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r, ::mlir::Value a, ::mlir::Value b, uint32_t attr1); 329// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, uint32_t attr1); 330// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, uint32_t attr1); 331// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 332// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); 333 334def NS_MOp : NS_Op<"op_with_single_result_and_fold_adaptor_fold", []> { 335 let results = (outs AnyType:$res); 336 337 let hasFolder = 1; 338} 339 340// CHECK-LABEL: class MOp : 341// CHECK: ::mlir::OpFoldResult fold(FoldAdaptor adaptor); 342 343def NS_NOp : NS_Op<"op_with_properties", []> { 344 let arguments = (ins Property<"unsigned">:$value); 345} 346 347// DEFS: NOpGenericAdaptorBase::NOpGenericAdaptorBase(NOp op) : 348// DEFS-SAME: odsAttrs(op->getRawDictionaryAttrs()) 349// DEFS-SAME: odsOpName(op->getName()) 350// DEFS-SAME: properties(op.getProperties()) 351// DEFS-SAME: odsRegions(op->getRegions()) 352 353// Test that type defs have the proper namespaces when used as a constraint. 354// --- 355 356def Test_Dialect2 : Dialect { 357 let name = "test"; 358 let cppNamespace = "::mlir::dialect2"; 359} 360def TestDialect2Type : TypeDef<Test_Dialect2, "Dialect2Type"> { 361 let typeName = "test.type"; 362} 363 364def NS_ResultWithDialectTypeOp : NS_Op<"op_with_dialect_type", []> { 365 let results = (outs TestDialect2Type); 366} 367 368// CHECK-LABEL: NS::ResultWithDialectTypeOp declarations 369// CHECK: class ResultWithDialectTypeOp : 370// CHECK-SAME: ::mlir::OpTrait::OneTypedResult<::mlir::dialect2::Dialect2TypeType> 371 372// Check that default builders can be suppressed. 373// --- 374 375def NS_SkipDefaultBuildersOp : NS_Op<"skip_default_builders", []> { 376 let skipDefaultBuilders = 1; 377 let builders = [OpBuilder<(ins "Value":$val)>]; 378} 379 380// CHECK-LABEL: NS::SkipDefaultBuildersOp declarations 381// CHECK: class SkipDefaultBuildersOp 382// CHECK-NOT: static void build(::mlir::Builder 383// CHECK: static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value 384 385// Check leading underscore in op name 386// --- 387 388def NS_VarOfVarOperandOp : NS_Op<"var_of_var_operand", []> { 389 let arguments = (ins 390 VariadicOfVariadic<F32, "var_size">:$var_of_var_attr, 391 DenseI32ArrayAttr:$var_size 392 ); 393} 394 395// CHECK-LABEL: class VarOfVarOperandOpGenericAdaptor 396// CHECK: public: 397// CHECK: ::llvm::SmallVector<RangeT> getVarOfVarAttr() { 398 399 400def NS__AOp : NS_Op<"_op_with_leading_underscore", []>; 401 402// CHECK-LABEL: NS::_AOp declarations 403// CHECK: class _AOp : public ::mlir::Op<_AOp 404 405def _BOp : NS_Op<"_op_with_leading_underscore_and_no_namespace", []>; 406 407// CHECK-LABEL: _BOp declarations 408// CHECK: class _BOp : public ::mlir::Op<_BOp 409 410// REDUCE_INC-LABEL: NS::AOp declarations 411// REDUCE_INC-NOT: NS::BOp declarations 412 413// REDUCE_EXC-NOT: NS::AOp declarations 414// REDUCE_EXC-LABEL: NS::BOp declarations 415