@@ -159,6 +159,12 @@ def CIR_AnyIntOrFloatType : AnyTypeOf<[CIR_AnyFloatType, CIR_AnyIntType],
159159 let cppFunctionName = "isAnyIntegerOrFloatingPointType";
160160}
161161
162+ //===----------------------------------------------------------------------===//
163+ // Complex Type predicates
164+ //===----------------------------------------------------------------------===//
165+
166+ def CIR_AnyComplexType : CIR_TypeBase<"::cir::ComplexType", "complex type">;
167+
162168//===----------------------------------------------------------------------===//
163169// Pointer Type predicates
164170//===----------------------------------------------------------------------===//
@@ -180,6 +186,17 @@ class CIR_PtrToPtrTo<code type, string summary>
180186 : CIR_ConfinedType<CIR_AnyPtrType, [CIR_IsPtrToPtrToPred<type>],
181187 "pointer to pointer to " # summary>;
182188
189+ // Pointee type constraint bases
190+ class CIR_PointeePred<Pred pred> : SubstLeaves<"$_self",
191+ "::mlir::cast<::cir::PointerType>($_self).getPointee()", pred>;
192+
193+ class CIR_PtrToAnyOf<list<Type> types, string summary = "">
194+ : CIR_ConfinedType<CIR_AnyPtrType,
195+ [Or<!foreach(type, types, CIR_PointeePred<type.predicate>)>],
196+ !if(!empty(summary),
197+ "pointer to " # CIR_TypeSummaries<types>.value,
198+ summary)>;
199+
183200// Void pointer type constraints
184201def CIR_VoidPtrType
185202 : CIR_PtrTo<"::cir::VoidType", "void type">,
@@ -192,6 +209,13 @@ def CIR_PtrToVoidPtrType
192209 "$_builder.getType<" # cppType # ">("
193210 "cir::VoidType::get($_builder.getContext())))">;
194211
212+ class CIR_PtrToType<Type type> : CIR_PtrToAnyOf<[type]>;
213+
214+ // Pointer to type constraints
215+ def CIR_PtrToIntOrFloatType : CIR_PtrToType<CIR_AnyIntOrFloatType>;
216+
217+ def CIR_PtrToComplexType : CIR_PtrToType<CIR_AnyComplexType>;
218+
195219//===----------------------------------------------------------------------===//
196220// Vector Type predicates
197221//===----------------------------------------------------------------------===//
0 commit comments