Follow-up from r348441 to add the rest of the objc ARC intrinsics.

This adds the other intrinsics used by ARC and codegen's them to their respective runtime methods.

llvm-svn: 348646
This commit is contained in:
Pete Cooper 2018-12-07 21:28:47 +00:00
parent 94b8e2ea4e
commit 782a490dfb
3 changed files with 105 additions and 0 deletions

View File

@ -361,6 +361,34 @@ def int_objc_storeStrong : Intrinsic<[],
def int_objc_storeWeak : Intrinsic<[llvm_ptr_ty],
[llvm_ptrptr_ty,
llvm_ptr_ty]>;
def int_objc_clang_arc_use : Intrinsic<[],
[llvm_vararg_ty]>;
def int_objc_unsafeClaimAutoreleasedReturnValue : Intrinsic<[llvm_ptr_ty],
[llvm_ptr_ty]>;
def int_objc_retainedObject : Intrinsic<[llvm_ptr_ty],
[llvm_ptr_ty]>;
def int_objc_unretainedObject : Intrinsic<[llvm_ptr_ty],
[llvm_ptr_ty]>;
def int_objc_unretainedPointer : Intrinsic<[llvm_ptr_ty],
[llvm_ptr_ty]>;
def int_objc_retain_autorelease : Intrinsic<[llvm_ptr_ty],
[llvm_ptr_ty]>;
def int_objc_sync_enter : Intrinsic<[llvm_i32_ty],
[llvm_ptr_ty]>;
def int_objc_sync_exit : Intrinsic<[llvm_i32_ty],
[llvm_ptr_ty]>;
def int_objc_arc_annotation_topdown_bbstart : Intrinsic<[],
[llvm_ptrptr_ty,
llvm_ptrptr_ty]>;
def int_objc_arc_annotation_topdown_bbend : Intrinsic<[],
[llvm_ptrptr_ty,
llvm_ptrptr_ty]>;
def int_objc_arc_annotation_bottomup_bbstart : Intrinsic<[],
[llvm_ptrptr_ty,
llvm_ptrptr_ty]>;
def int_objc_arc_annotation_bottomup_bbend : Intrinsic<[],
[llvm_ptrptr_ty,
llvm_ptrptr_ty]>;
//===--------------------- Code Generator Intrinsics ----------------------===//

View File

@ -6390,6 +6390,20 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
return "objc_storeStrong";
case Intrinsic::objc_storeWeak:
return "objc_storeWeak";
case Intrinsic::objc_unsafeClaimAutoreleasedReturnValue:
return "objc_unsafeClaimAutoreleasedReturnValue";
case Intrinsic::objc_retainedObject:
return "objc_retainedObject";
case Intrinsic::objc_unretainedObject:
return "objc_unretainedObject";
case Intrinsic::objc_unretainedPointer:
return "objc_unretainedPointer";
case Intrinsic::objc_retain_autorelease:
return "objc_retain_autorelease";
case Intrinsic::objc_sync_enter:
return "objc_sync_enter";
case Intrinsic::objc_sync_exit:
return "objc_sync_exit";
}
}

View File

@ -147,6 +147,62 @@ entry:
ret i8* %0
}
define i8* @test_objc_objc_unsafeClaimAutoreleasedReturnValue(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_unsafeClaimAutoreleasedReturnValue
; CHECK: callq _objc_unsafeClaimAutoreleasedReturnValue
entry:
%0 = call i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8* %arg0)
ret i8* %0
}
define i8* @test_objc_objc_retainedObject(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_retainedObject
; CHECK: callq _objc_retainedObject
entry:
%0 = call i8* @llvm.objc.retainedObject(i8* %arg0)
ret i8* %0
}
define i8* @test_objc_objc_unretainedObject(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_unretainedObject
; CHECK: callq _objc_unretainedObject
entry:
%0 = call i8* @llvm.objc.unretainedObject(i8* %arg0)
ret i8* %0
}
define i8* @test_objc_objc_unretainedPointer(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_unretainedPointer
; CHECK: callq _objc_unretainedPointer
entry:
%0 = call i8* @llvm.objc.unretainedPointer(i8* %arg0)
ret i8* %0
}
define i8* @test_objc_objc_retain_autorelease(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_retain_autorelease
; CHECK: callq _objc_retain_autorelease
entry:
%0 = call i8* @llvm.objc.retain.autorelease(i8* %arg0)
ret i8* %0
}
define i32 @test_objc_objc_sync_enter(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_sync_enter
; CHECK: callq _objc_sync_enter
entry:
%0 = call i32 @llvm.objc.sync.enter(i8* %arg0)
ret i32 %0
}
define i32 @test_objc_objc_sync_exit(i8* %arg0) {
; CHECK-LABEL: test_objc_objc_sync_exit
; CHECK: callq _objc_sync_exit
entry:
%0 = call i32 @llvm.objc.sync.exit(i8* %arg0)
ret i32 %0
}
declare i8* @llvm.objc.autorelease(i8*)
declare void @llvm.objc.autoreleasePoolPop(i8*)
declare i8* @llvm.objc.autoreleasePoolPush()
@ -165,3 +221,10 @@ declare i8* @llvm.objc.retainAutoreleasedReturnValue(i8*)
declare i8* @llvm.objc.retainBlock(i8*)
declare void @llvm.objc.storeStrong(i8**, i8*)
declare i8* @llvm.objc.storeWeak(i8**, i8*)
declare i8* @llvm.objc.unsafeClaimAutoreleasedReturnValue(i8*)
declare i8* @llvm.objc.retainedObject(i8*)
declare i8* @llvm.objc.unretainedObject(i8*)
declare i8* @llvm.objc.unretainedPointer(i8*)
declare i8* @llvm.objc.retain.autorelease(i8*)
declare i32 @llvm.objc.sync.enter(i8*)
declare i32 @llvm.objc.sync.exit(i8*)