[PATCH] D79841: [MLIR] refactor cmake specification of tablegen'd interfaces.
Stephen Neuendorffer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 13 00:30:15 PDT 2020
stephenneuendorffer created this revision.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added a project: LLVM.
Introduce add_mlir_interface to avoid lots of boilerplate
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79841
Files:
mlir/cmake/modules/AddMLIR.cmake
mlir/include/mlir/Interfaces/CMakeLists.txt
mlir/lib/Interfaces/CMakeLists.txt
Index: mlir/lib/Interfaces/CMakeLists.txt
===================================================================
--- mlir/lib/Interfaces/CMakeLists.txt
+++ mlir/lib/Interfaces/CMakeLists.txt
@@ -80,7 +80,7 @@
${MLIR_MAIN_INCLUDE_DIR}/mlir/Interfaces
DEPENDS
- MLIRSideEffectOpInterfacesIncGen
+ MLIRSideEffectInterfacesIncGen
LINK_LIBS PUBLIC
MLIRIR
Index: mlir/include/mlir/Interfaces/CMakeLists.txt
===================================================================
--- mlir/include/mlir/Interfaces/CMakeLists.txt
+++ 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)
Index: mlir/cmake/modules/AddMLIR.cmake
===================================================================
--- mlir/cmake/modules/AddMLIR.cmake
+++ mlir/cmake/modules/AddMLIR.cmake
@@ -14,6 +14,16 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79841.263633.patch
Type: text/x-patch
Size: 3942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200513/4f5bb466/attachment-0001.bin>
More information about the llvm-commits
mailing list