[clang] [CIR] Integral types; simple global variables (PR #118743)
David Olsen via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 13:43:58 PST 2024
================
@@ -0,0 +1,130 @@
+//===- 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 types.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_CIR_DIALECT_CIR_TYPES
+#define MLIR_CIR_DIALECT_CIR_TYPES
+
+include "clang/CIR/Dialect/IR/CIRDialect.td"
+include "mlir/Interfaces/DataLayoutInterfaces.td"
+include "mlir/IR/AttrTypeBase.td"
+
+//===----------------------------------------------------------------------===//
+// CIR Types
+//===----------------------------------------------------------------------===//
+
+class CIR_Type<string name, string typeMnemonic, list<Trait> traits = [],
+ string baseCppClass = "::mlir::Type">
+ : TypeDef<CIR_Dialect, name, traits, baseCppClass> {
+ let mnemonic = typeMnemonic;
+}
+
+//===----------------------------------------------------------------------===//
+// IntType
+//===----------------------------------------------------------------------===//
+
+def CIR_IntType : CIR_Type<"Int", "int",
+ [DeclareTypeInterfaceMethods<DataLayoutTypeInterface>]> {
+ let summary = "Integer type with arbitrary precision up to a fixed limit";
+ let description = [{
+ CIR type that represents integer types with arbitrary precision.
+
+ Those integer types that are directly available in C/C++ standard are called
+ primitive integer types. Said types are: `signed char`, `short`, `int`,
+ `long`, `long long`, and their unsigned variations.
----------------
dkolsen-pgi wrote:
`_BitInt` types that aren't too large are represented as `cir.int`. I have updated the documentation here and added `_BitInt` support to `CIRGenTypes::convertType`. Supporting larger `_BitInt` types is covered by issue https://github.com/llvm/clangir/issues/1212
https://github.com/llvm/llvm-project/pull/118743
More information about the cfe-commits
mailing list