Skip to content

Commit 74e4b40

Browse files
authored
[CIR] Refactor pointers to FuncType constraints (#1607)
1 parent 7fa1da4 commit 74e4b40

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3095,7 +3095,7 @@ def GetMethodOp : CIR_Op<"get_method"> {
30953095
}];
30963096

30973097
let arguments = (ins CIR_MethodType:$method, CIR_PtrToRecordType:$object);
3098-
let results = (outs FuncPtr:$callee, CIR_VoidPtrType:$adjusted_this);
3098+
let results = (outs CIR_PtrToFunc:$callee, CIR_VoidPtrType:$adjusted_this);
30993099

31003100
let assemblyFormat = [{
31013101
$method `,` $object

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ def CIR_AnyComplexType : CIR_TypeBase<"::cir::ComplexType", "complex type">;
169169

170170
def CIR_AnyRecordType : CIR_TypeBase<"::cir::RecordType", "record type">;
171171

172+
//===----------------------------------------------------------------------===//
173+
// Function Type predicates
174+
//===----------------------------------------------------------------------===//
175+
176+
def CIR_AnyFuncType : CIR_TypeBase<"::cir::FuncType", "function type">;
177+
172178
//===----------------------------------------------------------------------===//
173179
// Pointer Type predicates
174180
//===----------------------------------------------------------------------===//
@@ -222,4 +228,6 @@ def CIR_PtrToComplexType : CIR_PtrToType<CIR_AnyComplexType>;
222228

223229
def CIR_PtrToRecordType : CIR_PtrToType<CIR_AnyRecordType>;
224230

231+
def CIR_PtrToFunc : CIR_PtrToType<CIR_AnyFuncType>;
232+
225233
#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
@@ -568,15 +568,6 @@ def ArrayPtr : Type<
568568
]>, "!cir.ptr<!cir.array>"> {
569569
}
570570

571-
// Pointer to functions
572-
def FuncPtr : Type<
573-
And<[
574-
CPred<"::mlir::isa<::cir::PointerType>($_self)">,
575-
CPred<"::mlir::isa<::cir::FuncType>("
576-
"::mlir::cast<::cir::PointerType>($_self).getPointee())">,
577-
]>, "!cir.ptr<!cir.func>"> {
578-
}
579-
580571
//===----------------------------------------------------------------------===//
581572
// RecordType
582573
//

0 commit comments

Comments
 (0)