[clang] [CIR] Implement `AnyScalarType` constraint (PR #141033)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Thu May 22 03:26:12 PDT 2025
https://github.com/xlauko created https://github.com/llvm/llvm-project/pull/141033
This mirrors changes from https://github.com/llvm/clangir/pull/1625
>From 5331a40eaa4083d698074d9b5c11d22f9bcf3a59 Mon Sep 17 00:00:00 2001
From: xlauko <xlauko at mail.muni.cz>
Date: Thu, 22 May 2025 10:39:55 +0200
Subject: [PATCH] [CIR] Implement `AnyScalarType` constraint
This mirrors changes from https://github.com/llvm/clangir/pull/1625
---
.../clang/CIR/Dialect/IR/CIRTypeConstraints.td | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td b/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td
index 902d6535ff717..ec461cab961c7 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td
@@ -31,6 +31,12 @@ class CIR_ConfinedType<Type type, list<Pred> preds, string summary = "">
: Type<And<[type.predicate, CIR_CastedSelfsToType<type.cppType, preds>]>,
summary, type.cppType>;
+//===----------------------------------------------------------------------===//
+// Bool Type predicates
+//===----------------------------------------------------------------------===//
+
+def CIR_AnyBoolType : CIR_TypeBase<"::cir::BoolType", "boolean type">;
+
//===----------------------------------------------------------------------===//
// IntType predicates
//===----------------------------------------------------------------------===//
@@ -193,4 +199,16 @@ def IntegerVector : Type<
// Any Integer or Vector of Integer Constraints
def CIR_AnyIntOrVecOfInt: AnyTypeOf<[CIR_AnyIntType, IntegerVector]>;
+//===----------------------------------------------------------------------===//
+// Scalar Type predicates
+//===----------------------------------------------------------------------===//
+
+defvar CIR_ScalarTypes = [
+ CIR_AnyBoolType, CIR_AnyIntType, CIR_AnyFloatType, CIR_AnyPtrType
+];
+
+def CIR_AnyScalarType : AnyTypeOf<CIR_ScalarTypes, "cir scalar type"> {
+ let cppFunctionName = "isScalarType";
+}
+
#endif // CLANG_CIR_DIALECT_IR_CIRTYPECONSTRAINTS_TD
More information about the cfe-commits
mailing list