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