Skip to content

Commit b7bc94c

Browse files
authored
[CIR] Recreate isScalarType as CIR_AnyScalarType constraint (#1625)
1 parent 8b050d4 commit b7bc94c

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class CIR_TypeSummaries<list<Type> types> {
4343
string value = !if(!eq(!size(types), 1), joined, "any of " # joined);
4444
}
4545

46+
//===----------------------------------------------------------------------===//
47+
// Bool Type predicates
48+
//===----------------------------------------------------------------------===//
49+
50+
def CIR_AnyBoolType : CIR_TypeBase<"::cir::BoolType", "boolean type">;
51+
4652
//===----------------------------------------------------------------------===//
4753
// IntType predicates
4854
//===----------------------------------------------------------------------===//
@@ -250,4 +256,23 @@ def CIR_PtrToExceptionInfoType
250256
BuildableType<"$_builder.getType<" # cppType # ">("
251257
"cir::ExceptionInfoType::get($_builder.getContext())))">;
252258

259+
//===----------------------------------------------------------------------===//
260+
// Data member type predicates
261+
//===----------------------------------------------------------------------===//
262+
263+
def CIR_AnyDataMemberType : CIR_TypeBase<"::cir::DataMemberType",
264+
"data member type">;
265+
266+
//===----------------------------------------------------------------------===//
267+
// Scalar Type predicates
268+
//===----------------------------------------------------------------------===//
269+
270+
defvar CIR_ScalarTypes = [
271+
CIR_AnyBoolType, CIR_AnyIntType, CIR_AnyFloatType, CIR_AnyPtrType,
272+
CIR_AnyDataMemberType
273+
];
274+
275+
def CIR_AnyScalarType : AnyTypeOf<CIR_ScalarTypes, "cir scalar type"> {
276+
let cppFunctionName = "isScalarType";
277+
}
253278
#endif // CLANG_CIR_DIALECT_IR_CIRTYPECONSTRAINTS_TD

clang/include/clang/CIR/Dialect/IR/CIRTypes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ struct RecordTypeStorage;
2626
} // namespace detail
2727

2828
bool isValidFundamentalIntWidth(unsigned width);
29-
30-
bool isScalarType(mlir::Type t);
3129
bool isFPOrFPVectorTy(mlir::Type);
3230
bool isIntOrIntVectorTy(mlir::Type);
3331
} // namespace cir

clang/lib/CIR/Dialect/IR/CIRTypes.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -758,16 +758,6 @@ LongDoubleType::getABIAlignment(const mlir::DataLayout &dataLayout,
758758
.getABIAlignment(dataLayout, params);
759759
}
760760

761-
//===----------------------------------------------------------------------===//
762-
// Floating-point type helpers
763-
//===----------------------------------------------------------------------===//
764-
765-
bool cir::isScalarType(mlir::Type ty) {
766-
return isa<cir::IntType, cir::BoolType, cir::SingleType, cir::DoubleType,
767-
cir::LongDoubleType, cir::FP16Type, cir::FP128Type, cir::FP80Type,
768-
cir::DataMemberType, cir::PointerType>(ty);
769-
}
770-
771761
//===----------------------------------------------------------------------===//
772762
// Floating-point and Float-point Vector type helpers
773763
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)