@@ -26,7 +26,7 @@ typically described in TableGen file using the [DDR
2626format] ( DeclarativeRewrites.md ) .
2727
2828Note that dialect names should not generally be suffixed with “Ops”,
29- although some files pertaining to the operations of a dialect (e.g.
29+ although some files pertaining only to the operations of a dialect (e.g.
3030FooOps.cpp) might be.
3131
3232## CMake best practices
@@ -38,17 +38,16 @@ tablegen in a file FooOps.td. This file forms the core of a dialect and
3838is declared using add_mlir_dialect().
3939
4040``` cmake
41-
4241add_mlir_dialect(FooOps foo)
4342add_mlir_doc(FooOps -gen-dialect-doc FooDialect Dialects/)
44-
4543```
4644
4745This generates the correct rules to run mlir-tblgen, along with a
4846'MLIRFooOpsIncGen' target which can be used to declare dependencies.
4947
5048Dialect transformations are typically declared in a file FooTransforms.td.
5149Targets for TableGen are described in typical llvm fashion.
50+
5251``` cmake
5352set(LLVM_TARGET_DEFINITIONS FooTransforms.td)
5453mlir_tablegen(FooTransforms.h.inc -gen-rewriters)
@@ -67,20 +66,18 @@ other dialect libraries. Typically this dependence is declared using
6766target_link_libraries() and the PUBLIC keyword. For instance:
6867
6968``` cmake
70-
71- add_mlir_dialect_library(FooOps
72- DEPENDS
73- MLIRFooOpsIncGen
74- MLIRFooTransformsIncGen
75-
76- LINK_COMPONENTS
77- Core
78-
79- LINK_LIBS PUBLIC
80- BarOps
81- <some-other-library>
82- )
83-
69+ add_mlir_dialect_library(MLIRFoo
70+ DEPENDS
71+ MLIRFooOpsIncGen
72+ MLIRFooTransformsIncGen
73+
74+ LINK_COMPONENTS
75+ Core
76+
77+ LINK_LIBS PUBLIC
78+ MLIRBar
79+ <some-other-library>
80+ )
8481```
8582
8683add_mlir_dialect_library() is a thin wrapper around add_llvm_library()
@@ -90,9 +87,7 @@ access to all dialects. This list is also linked into libMLIR.so.
9087The list can be retrieved from the MLIR_DIALECT_LIBS global property:
9188
9289``` cmake
93-
9490get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
95-
9691```
9792
9893Note that although the Bar dialect also uses TableGen to declare its
@@ -139,18 +134,16 @@ dialects (e.g. MLIRStandard). Typically this dependence is specified
139134using target_link_libraries() and the PUBLIC keyword. For instance:
140135
141136``` cmake
142-
143137add_mlir_conversion_library(MLIRBarToFoo
144- BarToFoo.cpp
138+ BarToFoo.cpp
145139
146- ADDITIONAL_HEADER_DIRS
147- ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/BarToFoo
148-
149- LINK_LIBS PUBLIC
150- BarOps
151- FooOps
152- )
140+ ADDITIONAL_HEADER_DIRS
141+ ${MLIR_MAIN_INCLUDE_DIR}/mlir/Conversion/BarToFoo
153142
143+ LINK_LIBS PUBLIC
144+ MLIRBar
145+ MLIRFoo
146+ )
154147```
155148
156149add_mlir_conversion_library() is a thin wrapper around
@@ -161,9 +154,7 @@ is also linked in libMLIR.so. The list can be retrieved from the
161154MLIR_CONVERSION_LIBS global property:
162155
163156``` cmake
164-
165157get_property(dialect_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
166-
167158```
168159
169160Note that it is only necessary to specify a PUBLIC dependence against
0 commit comments