Skip to content

[CIR] Refactor pointers to ArrayType constraints #1608

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 13, 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
6 changes: 4 additions & 2 deletions clang/include/clang/CIR/Dialect/IR/CIROps.td
Original file line number Diff line number Diff line change
Expand Up @@ -5312,8 +5312,10 @@ def ClearCacheOp : CIR_Op<"clear_cache", [AllTypesMatch<["begin", "end"]>]> {
//===----------------------------------------------------------------------===//

class CIR_ArrayInitDestroy<string mnemonic> : CIR_Op<mnemonic, []> {
let arguments = (ins Arg<ArrayPtr, "array address",
[MemWrite, MemRead]>:$addr);
let arguments = (ins
Arg<CIR_PtrToArray, "array address", [MemWrite, MemRead]>:$addr
);

let regions = (region SizedRegion<1>:$body);
let assemblyFormat = [{
`(` $addr `:` qualified(type($addr)) `)` $body attr-dict
Expand Down
8 changes: 8 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRTypeConstraints.td
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def CIR_AnyRecordType : CIR_TypeBase<"::cir::RecordType", "record type">;

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

//===----------------------------------------------------------------------===//
// Array Type predicates
//===----------------------------------------------------------------------===//

def CIR_AnyArrayType : CIR_TypeBase<"::cir::ArrayType", "array type">;

//===----------------------------------------------------------------------===//
// Pointer Type predicates
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -230,4 +236,6 @@ def CIR_PtrToRecordType : CIR_PtrToType<CIR_AnyRecordType>;

def CIR_PtrToFunc : CIR_PtrToType<CIR_AnyFuncType>;

def CIR_PtrToArray : CIR_PtrToType<CIR_AnyArrayType>;

#endif // CLANG_CIR_DIALECT_IR_CIRTYPECONSTRAINTS_TD
9 changes: 0 additions & 9 deletions clang/include/clang/CIR/Dialect/IR/CIRTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -559,15 +559,6 @@ def CIR_AnySignedIntOrVecOfSignedInt: AnyTypeOf<[

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

// Pointer to Arrays
def ArrayPtr : Type<
And<[
CPred<"::mlir::isa<::cir::PointerType>($_self)">,
CPred<"::mlir::isa<::cir::ArrayType>("
"::mlir::cast<::cir::PointerType>($_self).getPointee())">,
]>, "!cir.ptr<!cir.array>"> {
}

//===----------------------------------------------------------------------===//
// RecordType
//
Expand Down
Loading