[clang] [libc] [llvm] [NVPTX] Implement variadic functions using IR lowering (PR #96015)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 20:22:37 PDT 2024


================
@@ -203,8 +203,15 @@ ABIArgInfo NVPTXABIInfo::classifyArgumentType(QualType Ty) const {
 void NVPTXABIInfo::computeInfo(CGFunctionInfo &FI) const {
   if (!getCXXABI().classifyReturnType(FI))
     FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
-  for (auto &I : FI.arguments())
-    I.info = classifyArgumentType(I.type);
+
+  unsigned ArgumentsCount = 0;
+  for (auto &I : FI.arguments()) {
+    if (FI.isVariadic() && ArgumentsCount > 0)
----------------
jhuber6 wrote:

You're right, this needs to account for all fixed arguments, not just the first (guaranteed) one. NVIDIA seems to handle it where the fixed arguments are passed using the regular ABI (can be indirect or direct) while the variadic arguments are always direct. Is there an easy way to check if an argument is part of the variadic set? Maybe if the argument number > number of arguments?

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


More information about the llvm-commits mailing list