1// RUN: mlir-tblgen -gen-op-decls -I %S/../../include %s | FileCheck %s --check-prefix=DECL 2// RUN: mlir-tblgen -gen-op-defs -I %S/../../include %s | FileCheck %s --check-prefix=DEF 3 4include "mlir/IR/OpBase.td" 5 6// Check using the dialect name as the namespace 7def A_Dialect : Dialect { 8 let name = "a"; 9} 10 11def A_SomeOp : Op<A_Dialect, "some_op", []>; 12 13// Check a single namespace 14def B_Dialect : Dialect { 15 let name = "b"; 16 let cppNamespace = "BNS"; 17} 18 19// Check nested namespaces 20def B_SomeOp : Op<B_Dialect, "some_op", []>; 21 22def C_Dialect : Dialect { 23 let name = "c"; 24 let cppNamespace = "::C::CC"; 25} 26 27def C_SomeOp : Op<C_Dialect, "some_op", []>; 28 29// Check no namespaces 30def D_Dialect : Dialect { 31 let name = "d"; 32 let cppNamespace = ""; 33} 34 35def D_DSomeOp : Op<D_Dialect, "some_op", []>; 36 37// Check op with namespace override. 38def E_Dialect : Dialect { 39 let name = "e"; 40 let cppNamespace = "ENS"; 41} 42 43def E_SomeOp : Op<E_Dialect, "some_op", []>; 44def E_SpecialNSOp : Op<E_Dialect, "special_ns_op", []> { 45 let cppNamespace = "::E::SPECIAL_NS"; 46} 47 48// DEF-LABEL: GET_OP_LIST 49// DEF: a::SomeOp 50// DEF-NEXT: BNS::SomeOp 51// DEF-NEXT: ::C::CC::SomeOp 52// DEF-NEXT: DSomeOp 53// DEF-NEXT: ENS::SomeOp 54// DEF-NEXT: ::E::SPECIAL_NS::SpecialNSOp 55 56// DEF-LABEL: GET_OP_CLASSES 57// DEF: a::SomeOp definitions 58// DEF: BNS::SomeOp definitions 59// DEF: ::C::CC::SomeOp definitions 60// DEF: DSomeOp definitions 61// DEF: ENS::SomeOp definitions 62// DEF: ::E::SPECIAL_NS::SpecialNSOp definitions 63 64// DECL-LABEL: GET_OP_CLASSES 65// DECL: a::SomeOp declarations 66// DECL: BNS::SomeOp declarations 67// DECL: ::C::CC::SomeOp declarations 68// DECL: DSomeOp declarations 69// DECL: ENS::SomeOp declarations 70// DECL: ::E::SPECIAL_NS::SpecialNSOp declarations 71