[PATCH] D146942: PowerPC ABI incompatibility with GNU on complex arguments

Umesh Kalappa via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 03:32:29 PDT 2023


umesh.kalappa0 created this revision.
umesh.kalappa0 added a reviewer: nikic.
umesh.kalappa0 added projects: LLVM, clang.
Herald added subscribers: StephenFan, shchenz, nemanjai.
Herald added a project: All.
umesh.kalappa0 requested review of this revision.
Herald added a subscriber: cfe-commits.

Changes : Like GNU GCC passes and returns float/double/long double  complex in FPRs .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146942

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -4720,6 +4720,7 @@
         IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
 
   ABIArgInfo classifyReturnType(QualType RetTy) const;
+  ABIArgInfo classifyArgumentType(QualType Ty) const;
 
   void computeInfo(CGFunctionInfo &FI) const override {
     if (!getCXXABI().classifyReturnType(FI))
@@ -4776,6 +4777,15 @@
   return CharUnits::fromQuantity(4);
 }
 
+ABIArgInfo PPC32_SVR4_ABIInfo::classifyArgumentType(QualType Ty) const {
+  Ty = useFirstFieldIfTransparentUnion(Ty);
+
+  if (Ty->isAnyComplexType())
+    return ABIArgInfo::getDirect();
+
+  return DefaultABIInfo::classifyArgumentType(Ty);
+}
+
 ABIArgInfo PPC32_SVR4_ABIInfo::classifyReturnType(QualType RetTy) const {
   uint64_t Size;
 
@@ -4801,6 +4811,9 @@
     }
   }
 
+  if (RetTy->isAnyComplexType())
+    return ABIArgInfo::getDirect();
+
   return DefaultABIInfo::classifyReturnType(RetTy);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146942.508554.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230327/6537a65d/attachment-0001.bin>


More information about the cfe-commits mailing list