diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -1,4 +1,5 @@ -# LLVM_TARGET_DEFINITIONS must contain the name of the .td file to process. +# LLVM_TARGET_DEFINITIONS must contain the name of the .td file to process, +# while LLVM_TARGET_DEPENDS may contain additional file dependencies. # Extra parameters for `tblgen' may come after `ofn' parameter. # Adds the name of the generated file to TABLEGEN_OUTPUT. @@ -104,6 +105,7 @@ DEPENDS ${${project}_TABLEGEN_TARGET} ${${project}_TABLEGEN_EXE} ${local_tds} ${global_tds} ${LLVM_TARGET_DEFINITIONS_ABSOLUTE} + ${LLVM_TARGET_DEPENDS} COMMENT "Building ${ofn}..." ) diff --git a/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt b/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt --- a/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt +++ b/mlir/include/mlir/Dialect/Linalg/IR/CMakeLists.txt @@ -25,6 +25,10 @@ ${MLIR_LINALG_ODS_GEN_EXE} ${MLIR_LINALG_ODS_GEN_TARGET} ${GEN_ODS_FILE} ${GEN_CPP_FILE}) + # Setup the file dependencies needed for the subsequent tablegen step. + # TODO: Once there is only one way of generating named ops remove this parent + # scope manipulation and implement the tablegen generation in the same scope. + set(LLVM_TARGET_DEPENDS ${LLVM_TARGET_DEPENDS} ${GEN_ODS_FILE} PARENT_SCOPE) endfunction() # Declare a function to generate ODS with mlir-linalg-ods-yaml-gen @@ -52,10 +56,17 @@ ${MLIR_LINALG_ODS_YAML_GEN_EXE} ${MLIR_LINALG_ODS_YAML_GEN_TARGET} ${GEN_ODS_FILE} ${GEN_CPP_FILE}) + # Setup the file dependencies needed for the subsequent tablegen step. + # TODO: Once there is only one way of generating named ops remove this parent + # scope manipulation and implement the tablegen generation in the same scope. + set(LLVM_TARGET_DEPENDS ${LLVM_TARGET_DEPENDS} ${GEN_ODS_FILE} PARENT_SCOPE) endfunction() # TODO: Delete tc generation and replace with the YAML variant once all ops are -# ported. +# ported. At the same time, move the YAML and TableGen generation to the same +# scope to avoid the at a distance dependency manipulation via +# LLVM_TARGET_DEPENDS. +set(LLVM_TARGET_DEPENDS "") add_linalg_ods_tc_gen(LinalgNamedStructuredOpsSpec.tc LinalgNamedStructuredOps) add_linalg_ods_yaml_gen(LinalgNamedStructuredOps.yaml LinalgNamedStructuredOps)