[llvm] [GISel][RISCV]Implement indirect parameter passing (PR #95429)
Gábor Spaits via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 07:07:16 PDT 2024
================
@@ -845,32 +908,49 @@ bool CallLowering::handleAssignments(ValueHandler &Handler,
DstMPO, DstAlign, SrcMPO, SrcAlign,
MemSize, VA);
}
- continue;
- }
-
- assert(!VA.needsCustom() && "custom loc should have been handled already");
-
- if (i == 0 && !ThisReturnRegs.empty() &&
- Handler.isIncomingArgumentHandler() &&
- isTypeIsValidForThisReturn(ValVT)) {
+ // QUESTION: How to keep this assert with the new if then else
+ // structured code?
+ // assert(!VA.needsCustom() && "custom loc should have been handled
+ // already");
+
+ } else if (i == 0 && !ThisReturnRegs.empty() &&
+ Handler.isIncomingArgumentHandler() &&
+ isTypeIsValidForThisReturn(ValVT) && VA.isRegLoc()) {
Handler.assignValueToReg(ArgReg, ThisReturnRegs[Part], VA);
- continue;
- }
-
- if (Handler.isIncomingArgumentHandler())
+ } else if (Handler.isIncomingArgumentHandler() && VA.isRegLoc()) {
Handler.assignValueToReg(ArgReg, VA.getLocReg(), VA);
- else {
+ } else if (VA.isRegLoc()) {
----------------
spaits wrote:
I have restructured the code, to use `else if`s instead of `if ... continue`. The reason for this is that, when indirect parameter passing happens and we have an outgoing handler, then we dispatch some work to the already existing parts of the code. These already existing branches `continue` the loop execution after they are finished.
In case of indirect parameter passing we would need `break` instead of `continue`. So now we use `else if`s instead of `if continue` so after all branches, there will be common code, that will check if indirect parameter passing has happened, and if it did it can break out of the loop.
https://github.com/llvm/llvm-project/pull/95429
More information about the llvm-commits
mailing list