[Mlir-commits] [mlir] ce3bbeb - [MLIR] refactor cmake specification of tablegen'd interfaces.
Stephen Neuendorffer
llvmlistbot at llvm.org
Wed May 13 10:40:18 PDT 2020
Author: Stephen Neuendorffer
Date: 2020-05-13T10:37:06-07:00
New Revision: ce3bbeb9159b30d6880fa5f71c0910007d0a6792
URL: https://github.com/llvm/llvm-project/commit/ce3bbeb9159b30d6880fa5f71c0910007d0a6792
DIFF: https://github.com/llvm/llvm-project/commit/ce3bbeb9159b30d6880fa5f71c0910007d0a6792.diff
LOG: [MLIR] refactor cmake specification of tablegen'd interfaces.
Introduce add_mlir_interface to avoid lots of boilerplate
Differential Revision: https://reviews.llvm.org/D79841
Added:
Modified:
mlir/cmake/modules/AddMLIR.cmake
mlir/include/mlir/Interfaces/CMakeLists.txt
mlir/lib/Interfaces/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 6c1ec381a675..b07158ba4d6a 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -14,6 +14,16 @@ function(add_mlir_dialect dialect dialect_namespace)
add_dependencies(mlir-headers MLIR${dialect}IncGen)
endfunction()
+# Declare a dialect in the include directory
+function(add_mlir_interface interface)
+ set(LLVM_TARGET_DEFINITIONS ${interface}.td)
+ mlir_tablegen(${interface}.h.inc -gen-op-interface-decls)
+ mlir_tablegen(${interface}.cpp.inc -gen-op-interface-defs)
+ add_public_tablegen_target(MLIR${interface}IncGen)
+ add_dependencies(mlir-generic-headers MLIR${interface}IncGen)
+endfunction()
+
+
# Generate Documentation
function(add_mlir_doc doc_filename command output_file output_directory)
set(LLVM_TARGET_DEFINITIONS ${doc_filename}.td)
diff --git a/mlir/include/mlir/Interfaces/CMakeLists.txt b/mlir/include/mlir/Interfaces/CMakeLists.txt
index 0b0a6c9a7408..ff3577d50851 100644
--- a/mlir/include/mlir/Interfaces/CMakeLists.txt
+++ b/mlir/include/mlir/Interfaces/CMakeLists.txt
@@ -1,41 +1,8 @@
-set(LLVM_TARGET_DEFINITIONS CallInterfaces.td)
-mlir_tablegen(CallInterfaces.h.inc -gen-op-interface-decls)
-mlir_tablegen(CallInterfaces.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRCallInterfacesIncGen)
-add_dependencies(mlir-generic-headers MLIRCallInterfacesIncGen)
+add_mlir_interface(CallInterfaces)
+add_mlir_interface(ControlFlowInterfaces)
+add_mlir_interface(DerivedAttributeOpInterface)
+add_mlir_interface(InferTypeOpInterface)
+add_mlir_interface(LoopLikeInterface)
+add_mlir_interface(SideEffectInterfaces)
+add_mlir_interface(ViewLikeInterface)
-set(LLVM_TARGET_DEFINITIONS ControlFlowInterfaces.td)
-mlir_tablegen(ControlFlowInterfaces.h.inc -gen-op-interface-decls)
-mlir_tablegen(ControlFlowInterfaces.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRControlFlowInterfacesIncGen)
-add_dependencies(mlir-generic-headers MLIRControlFlowInterfacesIncGen)
-
-set(LLVM_TARGET_DEFINITIONS DerivedAttributeOpInterface.td)
-mlir_tablegen(DerivedAttributeOpInterface.h.inc -gen-op-interface-decls)
-mlir_tablegen(DerivedAttributeOpInterface.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRDerivedAttributeOpInterfaceIncGen)
-add_dependencies(mlir-generic-headers MLIRDerivedAttributeOpInterfaceIncGen)
-
-set(LLVM_TARGET_DEFINITIONS InferTypeOpInterface.td)
-mlir_tablegen(InferTypeOpInterface.h.inc -gen-op-interface-decls)
-mlir_tablegen(InferTypeOpInterface.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRInferTypeOpInterfaceIncGen)
-add_dependencies(mlir-generic-headers MLIRInferTypeOpInterfaceIncGen)
-
-set(LLVM_TARGET_DEFINITIONS LoopLikeInterface.td)
-mlir_tablegen(LoopLikeInterface.h.inc -gen-op-interface-decls)
-mlir_tablegen(LoopLikeInterface.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRLoopLikeInterfaceIncGen)
-add_dependencies(mlir-generic-headers MLIRLoopLikeInterfaceIncGen)
-
-set(LLVM_TARGET_DEFINITIONS SideEffectInterfaces.td)
-mlir_tablegen(SideEffectInterfaces.h.inc -gen-op-interface-decls)
-mlir_tablegen(SideEffectInterfaces.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRSideEffectOpInterfacesIncGen)
-add_dependencies(mlir-generic-headers MLIRSideEffectOpInterfacesIncGen)
-
-set(LLVM_TARGET_DEFINITIONS ViewLikeInterface.td)
-mlir_tablegen(ViewLikeInterface.h.inc -gen-op-interface-decls)
-mlir_tablegen(ViewLikeInterface.cpp.inc -gen-op-interface-defs)
-add_public_tablegen_target(MLIRViewLikeInterfaceIncGen)
-add_dependencies(mlir-generic-headers MLIRViewLikeInterfaceIncGen)
diff --git a/mlir/lib/Interfaces/CMakeLists.txt b/mlir/lib/Interfaces/CMakeLists.txt
index 61b64148db41..239c6b53178c 100644
--- a/mlir/lib/Interfaces/CMakeLists.txt
+++ b/mlir/lib/Interfaces/CMakeLists.txt
@@ -80,7 +80,7 @@ add_mlir_library(MLIRSideEffects
${MLIR_MAIN_INCLUDE_DIR}/mlir/Interfaces
DEPENDS
- MLIRSideEffectOpInterfacesIncGen
+ MLIRSideEffectInterfacesIncGen
LINK_LIBS PUBLIC
MLIRIR
More information about the Mlir-commits
mailing list