Skip to content

[CIR] Implement AnyScalarType constraint #141033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td
Original file line number Diff line number Diff line change
Expand Up @@ -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
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -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