[llvm-branch-commits] [clang] [CIR][NFC] Add scaffolding for the CIR dialect and CIROps.td (PR #86080)

Nathan Lanza via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 11 14:58:32 PDT 2024


================
@@ -0,0 +1,16 @@
+# This replicates part of the add_mlir_dialect cmake function from MLIR that
+# cannot be used here. This happens because it expects to be run inside MLIR
+# directory which is not the case for CIR (and also FIR, both have similar
+# workarounds).
+
+# Equivalent to add_mlir_dialect(CIROps cir)
+set(LLVM_TARGET_DEFINITIONS CIROps.td)
+mlir_tablegen(CIROps.h.inc -gen-op-decls)
+mlir_tablegen(CIROps.cpp.inc -gen-op-defs)
+mlir_tablegen(CIROpsTypes.h.inc -gen-typedef-decls)
+mlir_tablegen(CIROpsTypes.cpp.inc -gen-typedef-defs)
+mlir_tablegen(CIROpsDialect.h.inc -gen-dialect-decls)
+mlir_tablegen(CIROpsDialect.cpp.inc -gen-dialect-defs)
+add_public_tablegen_target(MLIRCIROpsIncGen)
+add_dependencies(mlir-headers MLIRCIROpsIncGen)
----------------
lanza wrote:

> You're not generating the dialect doc?

These series of diffs are made by taking the tip of clangir and removing what we don't need to get a reviewable chunk of code up for a single diff. I guess while chunking this I just excluded it. It's in upstream clangir. (See https://github.com/llvm/clangir/blob/main/clang/include/clang/CIR/Dialect/IR/CMakeLists.txt#L17). 

> Also: can these lines be abstracted by just calling the add_mlir_dialect macro?

For reasons described at the top of the file that did not work. Perhaps that suggests a refactor of `add_mlir_dialect`, but don't intend to address that here. 

https://github.com/llvm/llvm-project/pull/86080


More information about the llvm-branch-commits mailing list