diff options
author | Craig Topper <craig.topper@sifive.com> | 2024-09-13 07:23:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-13 07:23:44 -0700 |
commit | ee4582f9c8c395b1a9d901b522510af622206049 (patch) | |
tree | a636e20bd43e3bc679d2da9e7e2748d37f73b028 /llvm/lib/Target/RISCV/RISCVCallingConv.cpp | |
parent | a3ea018d4900691e10ff6fd059cf07f33e949819 (diff) | |
download | llvm-ee4582f9c8c395b1a9d901b522510af622206049.zip llvm-ee4582f9c8c395b1a9d901b522510af622206049.tar.gz llvm-ee4582f9c8c395b1a9d901b522510af622206049.tar.bz2 |
[RISCV] Use CCValAssign::getCustomReg for fixed vector arguments/returns with RVV. (#108470)
We need to insert a insert_subvector or extract_subvector which feels
pretty custom.
This should make it easier to support fixed vector arguments for GISel.
Diffstat (limited to 'llvm/lib/Target/RISCV/RISCVCallingConv.cpp')
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVCallingConv.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVCallingConv.cpp b/llvm/lib/Target/RISCV/RISCVCallingConv.cpp index fc276d1..b7ed9de 100644 --- a/llvm/lib/Target/RISCV/RISCVCallingConv.cpp +++ b/llvm/lib/Target/RISCV/RISCVCallingConv.cpp @@ -448,8 +448,12 @@ bool llvm::CC_RISCV(unsigned ValNo, MVT ValVT, MVT LocVT, if (Reg) { // Fixed-length vectors are located in the corresponding scalable-vector // container types. - if (ValVT.isFixedLengthVector()) + if (ValVT.isFixedLengthVector()) { LocVT = TLI.getContainerForFixedLengthVector(LocVT); + State.addLoc( + CCValAssign::getCustomReg(ValNo, ValVT, Reg, LocVT, LocInfo)); + return false; + } } else { // For return values, the vector must be passed fully via registers or // via the stack. @@ -583,8 +587,12 @@ bool llvm::CC_RISCV_FastCC(unsigned ValNo, MVT ValVT, MVT LocVT, if (MCRegister Reg = allocateRVVReg(ValVT, ValNo, State, TLI)) { // Fixed-length vectors are located in the corresponding scalable-vector // container types. - if (LocVT.isFixedLengthVector()) + if (LocVT.isFixedLengthVector()) { LocVT = TLI.getContainerForFixedLengthVector(LocVT); + State.addLoc( + CCValAssign::getCustomReg(ValNo, ValVT, Reg, LocVT, LocInfo)); + return false; + } State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo)); return false; } |