brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · b0438c2 Raw
48 lines · plain
1// RUN: mlir-tblgen -gen-op-defs -I %S/../../include %s | FileCheck %s2 3include "mlir/IR/OpBase.td"4 5def Test_Dialect : Dialect {6  let name = "test";7}8 9def TopLevelTypeInterface : TypeInterface<"TopLevelTypeInterface">;10 11def TypeInterfaceInNamespace : TypeInterface<"TypeInterfaceInNamespace"> {12	let cppNamespace = "test";13}14 15def TopLevelAttrInterface : AttrInterface<"TopLevelAttrInterface">;16 17def AttrInterfaceInNamespace : AttrInterface<"AttrInterfaceInNamespace"> {18	let cppNamespace = "test";19}20 21def OpUsingAllOfThose : Op<Test_Dialect, "OpUsingAllOfThose"> {22	let arguments = (ins TopLevelAttrInterface:$attr1, AttrInterfaceInNamespace:$attr2);23	let results = (outs TopLevelTypeInterface:$res1, TypeInterfaceInNamespace:$res2);24}25 26// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_type_constraint.*}}(27// CHECK:   if (!((::llvm::isa<TopLevelTypeInterface>(type)))) {28// CHECK-NEXT:    return op->emitOpError(valueKind) << " #" << valueIndex29// CHECK-NEXT:        << " must be TopLevelTypeInterface instance, but got " << type;30 31// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_type_constraint.*}}(32// CHECK:   if (!((::llvm::isa<test::TypeInterfaceInNamespace>(type)))) {33// CHECK-NEXT:    return op->emitOpError(valueKind) << " #" << valueIndex34// CHECK-NEXT:        << " must be TypeInterfaceInNamespace instance, but got " << type;35 36// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(37// CHECK:   if (attr && !((::llvm::isa<TopLevelAttrInterface>(attr))))38// CHECK-NEXT:     return emitError() << "attribute '" << attrName39// CHECK-NEXT:        << "' failed to satisfy constraint: TopLevelAttrInterface instance";40 41// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(42// CHECK:   if (attr && !((::llvm::isa<test::AttrInterfaceInNamespace>(attr))))43// CHECK-NEXT:    return emitError() << "attribute '" << attrName44// CHECK-NEXT:        << "' failed to satisfy constraint: AttrInterfaceInNamespace instance";45 46// CHECK: TopLevelAttrInterface OpUsingAllOfThose::getAttr1()47// CHECK: test::AttrInterfaceInNamespace OpUsingAllOfThose::getAttr2()48