[PATCH] D134717: [Clang][AArch64] Fix va_arg with -mgeneral-regs-only

Amanieu d'Antras via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 01:27:40 PDT 2022


Amanieu created this revision.
Amanieu added a reviewer: MaskRay.
Herald added subscribers: StephenFan, kristof.beyls.
Herald added a project: All.
Amanieu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

With -mgeneral-regs-only, all arguments are passed in GPRs, so we should use __gr_top/__gr_offs in va_list even for floating-point types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134717

Files:
  clang/lib/CodeGen/TargetInfo.cpp


Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -5988,7 +5988,8 @@
     BaseTy = ArrTy->getElementType();
     NumRegs = ArrTy->getNumElements();
   }
-  bool IsFPR = BaseTy->isFloatingPointTy() || BaseTy->isVectorTy();
+  bool IsFPR = CGF.getTarget().hasFeature("fp-armv8") &&
+      (BaseTy->isFloatingPointTy() || BaseTy->isVectorTy());
 
   // The AArch64 va_list type and handling is specified in the Procedure Call
   // Standard, section B.4:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134717.463138.patch
Type: text/x-patch
Size: 587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220927/0cd74024/attachment.bin>


More information about the cfe-commits mailing list