llvm-project

Форк
0
/
gen-dialect-doc.td 
128 строк · 3.3 Кб
1
// RUN: mlir-tblgen -gen-dialect-doc -I %S/../../include -dialect=test %s | FileCheck %s
2
// RUN: mlir-tblgen -gen-dialect-doc -I %S/../../include -dialect=test_toc %s | FileCheck %s --check-prefix=CHECK_TOC
3

4
include "mlir/IR/OpBase.td"
5
include "mlir/IR/AttrTypeBase.td"
6
include "mlir/Interfaces/SideEffectInterfaces.td"
7

8
def Test_Dialect : Dialect {
9
  let name = "test";
10
  let summary = "Dialect of ops to test";
11
  let description = [{
12
    Dialect without a [TOC] here.
13
    TOC added by tool.
14
  }];
15
  let cppNamespace = "NS";
16
}
17

18
def OpGroupA : OpDocGroup {
19
  let summary = "Group of ops";
20
  let description = "Grouped for some reason.";
21
}
22

23
let opDocGroup = OpGroupA in {
24
def ADOp : Op<Test_Dialect, "d", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
25
def AAOp : Op<Test_Dialect, "a", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
26
}
27

28
def OpGroupB : OpDocGroup {
29
  let summary = "Other group of ops";
30
  let description = "Grouped for some other reason.";
31
}
32

33
let opDocGroup = OpGroupB in {
34
def ACOp : Op<Test_Dialect, "c", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
35
def ABOp : Op<Test_Dialect, "b", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
36
}
37

38
def AEOp : Op<Test_Dialect, "e", [NoMemoryEffect, SingleBlockImplicitTerminator<"YieldOp">]>;
39

40
def TestAttr : DialectAttr<Test_Dialect, CPred<"true">> {
41
  let summary = "attribute summary";
42
  let description = "attribute description";
43
}
44

45
def TestType : DialectType<Test_Dialect, CPred<"true">> {
46
  let summary = "type summary";
47
  let description = "type description";
48
}
49

50
def TestAttrDef : AttrDef<Test_Dialect, "TestAttrDef"> {
51
  let mnemonic = "test_attr_def";
52
}
53

54
def TestAttrDefParams : AttrDef<Test_Dialect, "TestAttrDefParams"> {
55
  let mnemonic = "test_attr_def_params";
56
  let parameters = (ins "int":$value);
57

58
  let assemblyFormat = "`<` $value `>`";
59
}
60

61
def TestTypeDef : TypeDef<Test_Dialect, "TestTypeDef"> {
62
  let mnemonic = "test_type_def";
63
}
64

65
def TestTypeDefParams : TypeDef<Test_Dialect, "TestTypeDefParams"> {
66
  let mnemonic = "test_type_def_params";
67
  let parameters = (ins "int":$value);
68

69
  let assemblyFormat = "`<` $value `>`";
70
}
71

72
// CHECK: Dialect without a [TOC] here.
73
// CHECK: TOC added by tool.
74
// CHECK: [TOC]
75

76
// CHECK-NOT: [TOC]
77
// CHECK: test.e
78
// CHECK: Group of ops
79
// CHECK: test.a
80
// CHECK: test.d
81
// CHECK: Other group
82
// CHECK: test.b
83
// CHECK: test.c
84
// CHECK: Traits: `SingleBlockImplicitTerminator<YieldOp>`, `SingleBlock`
85
// CHECK: Interfaces: `NoMemoryEffect (MemoryEffectOpInterface)`
86
// CHECK: Effects: `MemoryEffects::Effect{}`
87

88
// CHECK: ## Attribute constraints
89
// CHECK: ### attribute summary
90
// CHECK: attribute description
91

92
// CHECK: TestAttrDefAttr
93
// CHECK: Syntax:
94
// CHECK: #test.test_attr_def
95

96
// CHECK: TestAttrDefParamsAttr
97
// CHECK: Syntax:
98
// CHECK: #test.test_attr_def_params
99

100
// CHECK: ## Type constraints
101
// CHECK: ### type summary
102
// CHECK: type description
103

104
// CHECK: TestTypeDefType
105
// CHECK: Syntax:
106
// CHECK: !test.test_type_def
107

108
// CHECK: TestTypeDefParamsType
109
// CHECK: Syntax:
110
// CHECK: !test.test_type_def_params
111

112
def Toc_Dialect : Dialect {
113
  let name = "test_toc";
114
  let summary = "Dialect of ops to test";
115
  let description = [{
116
    Dialect with
117

118
    [TOC]
119

120
    here.
121
  }];
122
  let cppNamespace = "NS";
123
}
124
def BOp : Op<Toc_Dialect, "b", []>;
125

126
// CHECK_TOC: Dialect with
127
// CHECK_TOC: [TOC]
128
// CHECK_TOC: here.
129

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.