Skip to content

Commit 4bda84b

Browse files
committed
[CIR] Refactor pointers to ArrayType constraints
1 parent 74e4b40 commit 4bda84b

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5312,8 +5312,10 @@ def ClearCacheOp : CIR_Op<"clear_cache", [AllTypesMatch<["begin", "end"]>]> {
53125312
//===----------------------------------------------------------------------===//
53135313

53145314
class CIR_ArrayInitDestroy<string mnemonic> : CIR_Op<mnemonic, []> {
5315-
let arguments = (ins Arg<ArrayPtr, "array address",
5316-
[MemWrite, MemRead]>:$addr);
5315+
let arguments = (ins
5316+
Arg<CIR_PtrToArray, "array address", [MemWrite, MemRead]>:$addr
5317+
);
5318+
53175319
let regions = (region SizedRegion<1>:$body);
53185320
let assemblyFormat = [{
53195321
`(` $addr `:` qualified(type($addr)) `)` $body attr-dict

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ def CIR_AnyRecordType : CIR_TypeBase<"::cir::RecordType", "record type">;
175175

176176
def CIR_AnyFuncType : CIR_TypeBase<"::cir::FuncType", "function type">;
177177

178+
//===----------------------------------------------------------------------===//
179+
// Array Type predicates
180+
//===----------------------------------------------------------------------===//
181+
182+
def CIR_AnyArrayType : CIR_TypeBase<"::cir::ArrayType", "array type">;
183+
178184
//===----------------------------------------------------------------------===//
179185
// Pointer Type predicates
180186
//===----------------------------------------------------------------------===//
@@ -230,4 +236,6 @@ def CIR_PtrToRecordType : CIR_PtrToType<CIR_AnyRecordType>;
230236

231237
def CIR_PtrToFunc : CIR_PtrToType<CIR_AnyFuncType>;
232238

239+
def CIR_PtrToArray : CIR_PtrToType<CIR_AnyArrayType>;
240+
233241
#endif // CLANG_CIR_DIALECT_IR_CIRTYPECONSTRAINTS_TD

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,6 @@ def CIR_AnySignedIntOrVecOfSignedInt: AnyTypeOf<[
559559

560560
def CIR_AnyFloatOrVecOfFloat: AnyTypeOf<[CIR_AnyFloatType, FPVector]>;
561561

562-
// Pointer to Arrays
563-
def ArrayPtr : Type<
564-
And<[
565-
CPred<"::mlir::isa<::cir::PointerType>($_self)">,
566-
CPred<"::mlir::isa<::cir::ArrayType>("
567-
"::mlir::cast<::cir::PointerType>($_self).getPointee())">,
568-
]>, "!cir.ptr<!cir.array>"> {
569-
}
570-
571562
//===----------------------------------------------------------------------===//
572563
// RecordType
573564
//

0 commit comments

Comments
 (0)