[clang] [CIR] Implement `AnyScalarType` constraint (PR #141033)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 22 03:27:41 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Henrich Lauko (xlauko)
<details>
<summary>Changes</summary>
This mirrors incubator changes from https://github.com/llvm/clangir/pull/1625
---
Full diff: https://github.com/llvm/llvm-project/pull/141033.diff
1 Files Affected:
- (modified) clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td (+18)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/141033
More information about the cfe-commits
mailing list