[clang] Fix Objective-C++ Sret of non-trivial data types on Windows ARM64 (PR #88671)

David Chisnall via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 17 01:19:10 PDT 2024


================
@@ -2911,12 +2911,25 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
                                       "objc_msgSend_fpret")
                 .getCallee();
       } else if (CGM.ReturnTypeUsesSRet(MSI.CallInfo)) {
+        StringRef name = "objc_msgSend_stret";
+
+        // The address of the memory block is be passed in x8 for POD type,
+        // or in x0 for non-POD type (marked as inreg).
+        bool shouldCheckForInReg =
+            CGM.getContext()
+                .getTargetInfo()
+                .getTriple()
+                .isWindowsMSVCEnvironment() &&
+            CGM.getContext().getTargetInfo().getTriple().isAArch64();
+        if (shouldCheckForInReg && CGM.ReturnTypeHasInReg(MSI.CallInfo)) {
+          name = "objc_msgSend_stret2_np";
----------------
davidchisnall wrote:

I don't really like the `_np` suffix on this.  We use that only for things that are intended to be called by users and need to signpost that they aren't portable to Apple platforms.

https://github.com/llvm/llvm-project/pull/88671


More information about the cfe-commits mailing list