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

Bruno Cardoso Lopes via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 21 19:20:51 PDT 2024


================
@@ -0,0 +1,46 @@
+//===- CIRTypes.td - CIR dialect types ---------------------*- tablegen -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the CIR dialect.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_CIR_DIALECT_CIR
+#define MLIR_CIR_DIALECT_CIR
+
+include "mlir/IR/OpBase.td"
+
+def CIR_Dialect : Dialect {
+  let name = "cir";
+
+  // A short one-line summary of our dialect.
+  let summary = "A high-level dialect for analyzing and optimizing Clang "
+                "supported languages";
+
+  let cppNamespace = "::mlir::cir";
+
+  let useDefaultAttributePrinterParser = 0;
+  let useDefaultTypePrinterParser = 0;
----------------
bcardosolopes wrote:

We are following MLIR style guide here and these tablegen ones need to be like this in order for certain c++ code to be generated.

This comment reminds me of something we need to discuss for the rest of CIR: MLIR and clang differs on the coding style, which means that CIRGen code has variables starting with capital letter calling into code using lowecase. So far we've been using a mix: in the dialect source we keep MLIR style, and in CIRGen we keep the clang style. 

We don't have a strong opinion here, we rather apply whatever the community/maintainers care and move on with upstreaming. Thoughts? (cc: @joker-eph)

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


More information about the llvm-branch-commits mailing list