[PATCH] D14737: Convert some ObjC msgSends to runtime calls

Pete Cooper via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 14 14:42:40 PDT 2016


pete updated this revision to Diff 50651.
pete added a comment.

Thanks for the example John.  I understand what you mean now.

I've added this piece to the test case which verifies that the following IR has the correct bit cast in it.  Similarly added cases for alloc and autorelease.

@class A;
@interface B

- (A*) retain;

@end

A* test_retain_class_ptr(B *b) {

  return [b retain];

}

define %1* @test_retain_class_ptr(%2* %b) #0 {
entry:

  %b.addr = alloca %2*, align 8
  store %2* %b, %2** %b.addr, align 8
  %0 = load %2*, %2** %b.addr, align 8
  %1 = bitcast %2* %0 to i8*
  %2 = call i8* @objc_retain(i8* %1) #2
  %3 = bitcast i8* %2 to %1*
  ret %1* %3

}


http://reviews.llvm.org/D14737

Files:
  include/clang/Basic/ObjCRuntime.h
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenObjC/convert-messages-to-runtime-calls.m
  test/Driver/objc-convert-messages-to-runtime-calls.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14737.50651.patch
Type: text/x-patch
Size: 22686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160314/a716aaf1/attachment-0001.bin>


More information about the cfe-commits mailing list