[llvm] [GlobalISel][RISCV] SelectionDAG like indirect parameter passing (PR #216724)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 07:28:35 PDT 2026
================
@@ -859,25 +846,44 @@ bool CallLowering::handleAssignments(ValueHandler &Handler,
// Now split the registers into the assigned types.
Args[i].OrigRegs.assign(Args[i].Regs.begin(), Args[i].Regs.end());
+ int IndirectFrameIdx = 0;
+ Register IndirectPointerToStackReg{};
+ TypeSize CurrentIndirectChunkSize = TypeSize::getZero();
+ for (unsigned Part = 0; Part < NumParts; Part++) {
+ if (ArgLocs[j + Part].getLocInfo() == CCValAssign::Indirect)
+ CurrentIndirectChunkSize += ArgLocs[j + Part].getValVT().getStoreSize();
+ else if (CurrentIndirectChunkSize != 0)
+ llvm_unreachable("Indirect parameter passing where the middle part of "
+ "a parameter is indirect isn't yet supported!");
+ }
+
if (NumParts != 1 || NewLLT != OrigTy) {
- // If we can't directly assign the register, we need one or more
- // intermediate values.
- Args[i].Regs.resize(NumParts);
-
- // When we have indirect parameter passing we are receiving a pointer,
- // that points to the actual value, so we need one "temporary" pointer.
- if (VA.getLocInfo() == CCValAssign::Indirect) {
- if (Handler.isIncomingArgumentHandler())
- Args[i].Regs[0] = MRI.createGenericVirtualRegister(PointerTy);
- } else {
- // For each split register, create and assign a vreg that will store
- // the incoming component of the larger value. These will later be
- // merged to form the final vreg.
- for (unsigned Part = 0; Part < NumParts; ++Part)
- Args[i].Regs[Part] = MRI.createGenericVirtualRegister(NewLLT);
+ Args[i].Regs.clear();
----------------
topperc wrote:
The loop here always pushs NumParts times. I was wondering if we could allocate NumParts entries after the clear. This way each push_back in th e loop doesn't need to check for if the vector needs to be resized.
https://github.com/llvm/llvm-project/pull/216724
More information about the llvm-commits
mailing list