Skip to content

[CIR] Recreate isScalarType as CIR_AnyScalarType constraint #1625

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 20, 2025
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class CIR_TypeSummaries<list<Type> types> {
string value = !if(!eq(!size(types), 1), joined, "any of " # joined);
}

//===----------------------------------------------------------------------===//
// Bool Type predicates
//===----------------------------------------------------------------------===//

def CIR_AnyBoolType : CIR_TypeBase<"::cir::BoolType", "boolean type">;

//===----------------------------------------------------------------------===//
// IntType predicates
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -250,4 +256,23 @@ def CIR_PtrToExceptionInfoType
BuildableType<"$_builder.getType<" # cppType # ">("
"cir::ExceptionInfoType::get($_builder.getContext())))">;

//===----------------------------------------------------------------------===//
// Data member type predicates
//===----------------------------------------------------------------------===//

def CIR_AnyDataMemberType : CIR_TypeBase<"::cir::DataMemberType",
"data member type">;

//===----------------------------------------------------------------------===//
// Scalar Type predicates
//===----------------------------------------------------------------------===//

defvar CIR_ScalarTypes = [
CIR_AnyBoolType, CIR_AnyIntType, CIR_AnyFloatType, CIR_AnyPtrType,
CIR_AnyDataMemberType
];

def CIR_AnyScalarType : AnyTypeOf<CIR_ScalarTypes, "cir scalar type"> {
let cppFunctionName = "isScalarType";
}
#endif // CLANG_CIR_DIALECT_IR_CIRTYPECONSTRAINTS_TD
2 changes: 0 additions & 2 deletions clang/include/clang/CIR/Dialect/IR/CIRTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ struct RecordTypeStorage;
} // namespace detail

bool isValidFundamentalIntWidth(unsigned width);

bool isScalarType(mlir::Type t);
bool isFPOrFPVectorTy(mlir::Type);
bool isIntOrIntVectorTy(mlir::Type);
} // namespace cir
Expand Down
10 changes: 0 additions & 10 deletions clang/lib/CIR/Dialect/IR/CIRTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,16 +758,6 @@ LongDoubleType::getABIAlignment(const mlir::DataLayout &dataLayout,
.getABIAlignment(dataLayout, params);
}

//===----------------------------------------------------------------------===//
// Floating-point type helpers
//===----------------------------------------------------------------------===//

bool cir::isScalarType(mlir::Type ty) {
return isa<cir::IntType, cir::BoolType, cir::SingleType, cir::DoubleType,
cir::LongDoubleType, cir::FP16Type, cir::FP128Type, cir::FP80Type,
cir::DataMemberType, cir::PointerType>(ty);
}

//===----------------------------------------------------------------------===//
// Floating-point and Float-point Vector type helpers
//===----------------------------------------------------------------------===//
Expand Down
Loading