[PATCH] D84041: [AArch64][SVE] Fix PCS for functions taking/returning scalable types.

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 10:13:09 PDT 2020


paulwalker-arm added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp:51-56
+  if (any_of(F.args(), [](const Argument &Arg) {
+        return isa<ScalableVectorType>(Arg.getType());
+      }))
+    return true;
+
+  return false;
----------------
Could just do `return any_of(...`


================
Comment at: llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp:81
     return CSR_AArch64_AAVPCS_SaveList;
-  if (MF->getFunction().getCallingConv() == CallingConv::AArch64_SVE_VectorCall)
+  if (needsSVECallingConvention(MF))
     return CSR_AArch64_SVE_AAPCS_SaveList;
----------------
Since the SVE calling convention is really an extension of the "normal" calling convention I think it makes sense for this logic to be at the bottom just before the return. So the flow is:

```
if (function_specifies_calling_convention_x)
  return calling_convention_x_save_list
if (function_specifies_calling_convention_y)
  return calling_convention_y_save_list
....
if (function_has_sve_args_or_return)
 return sve_save_list

return default_save_list
```

I guess you could leave the CallingConv::AArch64_SVE_VectorCall code as is given it fits this mould, but since this isn't supposed to be a user visible attribute I wonder if we can remove it at a later date?



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84041/new/

https://reviews.llvm.org/D84041





More information about the llvm-commits mailing list