[llvm] Recommit [RISCV] RISCV vector calling convention (2/2) (#79096) (PR #87736)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 13:01:52 PDT 2024
================
@@ -21102,6 +21091,206 @@ unsigned RISCVTargetLowering::getMinimumJumpTableEntries() const {
return Subtarget.getMinimumJumpTableEntries();
}
+// Handle single arg such as return value.
+template <typename Arg>
+void RVVArgDispatcher::constructArgInfos(ArrayRef<Arg> ArgList) {
+ // This lambda determines whether an array of types are constructed by
+ // homogeneous vector types.
+ auto isHomogeneousScalableVectorType = [](ArrayRef<Arg> ArgList) {
+ // First, extract the first element in the argument type.
+ MVT FirstArgRegType;
+ unsigned FirstArgElements = 0;
+ auto It = ArgList.begin();
+ bool IsPart = false;
+
+ if (It == ArgList.end())
+ return false;
+
+ for (; It != ArgList.end(); ++It) {
+ FirstArgRegType = It->VT;
+ ++FirstArgElements;
+ if ((!It->Flags.isSplit() && !IsPart) || It->Flags.isSplitEnd())
+ break;
+
+ IsPart = true;
+ }
+
+ assert(It != ArgList.end() && "It shouldn't reach the end of ArgList.");
+ ++It;
+
+ // Return if this argument type contains only 1 element, or it's not a
+ // vector type.
+ if (It == ArgList.end() || !FirstArgRegType.isScalableVector())
+ return false;
+
+ // Second, check if the following elements in this argument type are all the
+ // same.
+ MVT ArgRegType;
+ unsigned ArgElements = 0;
+ IsPart = false;
+ for (; It != ArgList.end(); ++It) {
+ ArgRegType = It->VT;
+ ++ArgElements;
+ if ((!It->Flags.isSplit() && !IsPart) || It->Flags.isSplitEnd()) {
----------------
topperc wrote:
Do we have tests for the split case? That should only happen for types larger than LMUL=8 I think? Do we even want to consider those as tuple types?
https://github.com/llvm/llvm-project/pull/87736
More information about the llvm-commits
mailing list