[llvm] [GISel][RISCV]Implement indirect parameter passing (PR #95429)

Gábor Spaits via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 14:00:08 PDT 2024


================
@@ -765,23 +772,32 @@ bool CallLowering::handleAssignments(ValueHandler &Handler,
       // intermediate values.
       Args[i].Regs.resize(NumParts);
 
-      // 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);
+      // 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);
----------------
spaits wrote:

It is a good idea to add an assertion like this.

We can not assert that for `i`. This index is for the arguments, not the part of the arguments. The correct place for this assertion is in the inner loop and the variable to use is `Part`. I am adding that assertion.

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


More information about the llvm-commits mailing list