[llvm] r348646 - Follow-up from r348441 to add the rest of the objc ARC intrinsics.
Pete Cooper via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 7 13:28:48 PST 2018
Author: pete
Date: Fri Dec 7 13:28:47 2018
New Revision: 348646
URL: http://llvm.org/viewvc/llvm-project?rev=348646&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/IR/Intrinsics.td
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/trunk/test/CodeGen/X86/objc-arc.ll
Modified: llvm/trunk/include/llvm/IR/Intrinsics.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Intrinsics.td?rev=348646&r1=348645&r2=348646&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/IR/Intrinsics.td Fri Dec 7 13:28:47 2018
@@ -361,6 +361,34 @@ def int_objc_storeStrong
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 ----------------------===//
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=348646&r1=348645&r2=348646&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Dec 7 13:28:47 2018
@@ -6390,6 +6390,20 @@ SelectionDAGBuilder::visitIntrinsicCall(
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";
}
}
Modified: llvm/trunk/test/CodeGen/X86/objc-arc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/objc-arc.ll?rev=348646&r1=348645&r2=348646&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/objc-arc.ll (original)
+++ llvm/trunk/test/CodeGen/X86/objc-arc.ll Fri Dec 7 13:28:47 2018
@@ -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.retainAutorelease
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*)
More information about the llvm-commits
mailing list