Skip to content

Commit f04be09

Browse files
committed
Add tests
1 parent 2f027e4 commit f04be09

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

mlir/test/mlir-tblgen/gen-dialect-doc.td

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ def ACOp : Op<Test_Dialect, "c", [NoMemoryEffect, SingleBlockImplicitTerminator<
3636
def ABOp : Op<Test_Dialect, "b", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
3737
}
3838

39-
def AEOp : Op<Test_Dialect, "e", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
39+
def AEOp : Op<Test_Dialect, "e", [NoMemoryEffect]> {
40+
let summary = "Op with a summary";
41+
let description = "Op with a description";
42+
let arguments = (ins ConfinedType<AnyType, [CPred<"::llvm::isa<::mlir::TensorType>($_self)">]>:$tensor,
43+
I16Attr:$int_attr);
44+
let results = (outs
45+
ConfinedType<AnyType, [CPred<"::llvm::isa<::mlir::TensorType>($_self)">]>:$output
46+
);
47+
}
4048

4149
def TestAttr : DialectAttr<Test_Dialect, CPred<"true">> {
4250
let summary = "attribute summary";
@@ -85,7 +93,19 @@ def TestEnum :
8593
// CHECK: [TOC]
8694

8795
// CHECK-NOT: [TOC]
96+
8897
// CHECK: test.e
98+
// CHECK: _Op with a summary_
99+
// CHECK: Op with a description
100+
// CHECK: Operands:
101+
// CHECK: | Operand | Description |
102+
// CHECK: | :-----: | ----------- |
103+
// CHECK: | `tensor` | |
104+
// CHECK: Results:
105+
// CHECK: | Result | Description |
106+
// CHECK: | :----: | ----------- |
107+
// CHECK: | `output` | |
108+
89109
// CHECK: Group of ops
90110
// CHECK: test.a
91111
// CHECK: test.d
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: mlir-tblgen -gen-pass-doc -I %S/../../include -dialect=test %s | FileCheck %s
2+
3+
include "mlir/Pass/PassBase.td"
4+
5+
def TestPassDoc : Pass<"test-pass-doc"> {
6+
let summary = "pass summary";
7+
let description = [{
8+
Pass description
9+
}];
10+
11+
let options = [
12+
ListOption<"option", "option", "std::string", "pass option">
13+
];
14+
}
15+
16+
// CHECK: `-test-pass-doc`
17+
// CHECK: _Pass summary_
18+
// CHECK: Pass description
19+
// CHECK: Options
20+
// CHECK: -option : pass option

0 commit comments

Comments
 (0)