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

Pete Cooper via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 19 13:55:59 PST 2015


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

Updated with the following changes:

- Removed the -f-objc-X option and made the -fno-objc-X option be codegen only.
- Updated all the comments to be what John suggested.
- Added a method (shouldUseRuntimeFunctionsForAlloc) to single out the alloc case with its own checks.
- Added check and test case for IsSuper
- Added test for retain of self.
- The driver test now only checks for whether the flag is forwarded correctly as the target checks are done during codegen.
- The CodeGen test now includes all the variants for macos, fragile, iOS, tvos and watchOS.

Given we now have 2 runtime methods to check, I tried to reduce duplication by splitting alloc out of the switch.  The alternative is to check for shouldUseARCFunctionsForRetainRelease() in each of the retain/release/autorelease cases.  I'm fine with either solution.

I wasn't able to move the code to CGObjC.  Unfortunately there's no common EmitMessageSend method which is shared by CGObjCMac and CGObjCGNU.  I could move this to a helper in CGObjC and call the helper from CGObjCMac and CGObjCGNU if thats preferable.  Perhaps we should do that in a follow up only if the CGObjCGNU valid targets were ever true for the versions being checked in shouldUseARCFunctionsForRetainRelease.


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/CGObjCMac.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.40703.patch
Type: text/x-patch
Size: 12793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151119/3a7ab9d8/attachment-0001.bin>


More information about the cfe-commits mailing list