@@ -174,8 +174,7 @@ function(add_mlir_dialect dialect dialect_namespace)
174174 mlir_tablegen(${dialect} Types.cpp.inc -gen-typedef-defs -typedefs-dialect=${dialect_namespace} )
175175 mlir_tablegen(${dialect} Dialect.h.inc -gen-dialect-decls -dialect=${dialect_namespace} )
176176 mlir_tablegen(${dialect} Dialect.cpp.inc -gen-dialect-defs -dialect=${dialect_namespace} )
177- add_public_tablegen_target(MLIR${dialect} IncGen)
178- add_dependencies (mlir-headers MLIR${dialect} IncGen)
177+ add_mlir_dialect_tablegen_target(MLIR${dialect} IncGen)
179178endfunction ()
180179
181180# Declare sharded dialect operation declarations and definitions
@@ -190,7 +189,7 @@ function(add_sharded_ops ops_target shard_count)
190189 tablegen(MLIR_SRC_SHARDER ${SHARDED_SRC} -op-shard-index=${index} )
191190 set (TABLEGEN_OUTPUT ${TABLEGEN_OUTPUT} ${CMAKE_CURRENT_BINARY_DIR} /${SHARDED_SRC} )
192191 endforeach ()
193- add_public_tablegen_target (MLIR${ops_target} ShardGen)
192+ add_mlir_dialect_tablegen_target (MLIR${ops_target} ShardGen)
194193 set (SHARDED_SRCS ${SHARDED_SRCS} PARENT_SCOPE)
195194endfunction ()
196195
@@ -199,16 +198,23 @@ function(add_mlir_interface interface)
199198 set (LLVM_TARGET_DEFINITIONS ${interface} .td)
200199 mlir_tablegen(${interface} .h.inc -gen-op-interface -decls)
201200 mlir_tablegen(${interface} .cpp.inc -gen-op-interface -defs)
202- add_public_tablegen_target(MLIR${interface} IncGen)
203- add_dependencies (mlir-generic-headers MLIR${interface} IncGen)
201+ add_mlir_generic_tablegen_target(MLIR${interface} IncGen)
204202endfunction ()
205203
206- # Add a tablegen target that generates headers in the include directory
207- macro (add_mlir_tablegen_target target )
204+ # Add a dialect-specific tablegen target that generates headers in the include directory
205+ macro (add_mlir_dialect_tablegen_target target )
208206 add_public_tablegen_target(${target} )
209207 add_dependencies (mlir-headers ${target} )
210208endmacro ()
211209
210+ # Add a dialect-independent tablegen target that generates headers in the include directory
211+ # Generally this is used for files outside of the Dialects/ folder, and also for interfaces
212+ # that are meant to be implemented by other/multiple dialects.
213+ macro (add_mlir_generic_tablegen_target target )
214+ add_public_tablegen_target(${target} )
215+ add_dependencies (mlir-generic-headers ${target} )
216+ endmacro ()
217+
212218# Generate Documentation
213219function (add_mlir_doc doc_filename output_file output_directory command )
214220 set (LLVM_TARGET_DEFINITIONS ${doc_filename} .td)
0 commit comments