[clang] 586e1df - [CIR] Implement `AnyScalarType` constraint (#141033)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 09:48:17 PDT 2025


Author: Henrich Lauko
Date: 2025-05-22T18:48:14+02:00
New Revision: 586e1dffd8d2fab0b4f386c51eff23f3640f45d9

URL: https://github.com/llvm/llvm-project/commit/586e1dffd8d2fab0b4f386c51eff23f3640f45d9
DIFF: https://github.com/llvm/llvm-project/commit/586e1dffd8d2fab0b4f386c51eff23f3640f45d9.diff

LOG: [CIR] Implement `AnyScalarType` constraint (#141033)

This mirrors incubator changes from https://github.com/llvm/clangir/pull/1625

Added: 
    

Modified: 
    clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td

Removed: 
    


################################################################################
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