[llvm] [RISCV][GISel] Add FP calling convention support using FPR and GPR registers. (PR #69138)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 11:01:16 PDT 2023
================
@@ -164,44 +194,101 @@ struct RISCVIncomingValueHandler : public CallLowering::IncomingValueHandler {
void assignValueToReg(Register ValVReg, Register PhysReg,
CCValAssign VA) override {
- // Copy argument received in physical register to desired VReg.
- MIRBuilder.getMBB().addLiveIn(PhysReg);
- MIRBuilder.buildCopy(ValVReg, PhysReg);
+ markPhysRegUsed(PhysReg);
+ IncomingValueHandler::assignValueToReg(ValVReg, PhysReg, VA);
}
+ unsigned assignCustomValue(CallLowering::ArgInfo &Arg,
+ ArrayRef<CCValAssign> VAs,
+ std::function<void()> *Thunk = nullptr) override {
----------------
topperc wrote:
The interface here is weird. The thunk is used to delay outgoing register assignments. The caller always passes Thunk, but I don't think it really wants to use Thunk for incoming assignments.
In the non-custom code in the caller we have this
```
if (Handler.isIncomingArgumentHandler())
Handler.assignValueToReg(ArgReg, VA.getLocReg(), VA);
else {
DelayedOutgoingRegAssignments.emplace_back([=, &Handler]() {
Handler.assignValueToReg(ArgReg, VA.getLocReg(), VA);
});
```
This is the code where thunk is passed and used.
```
if (VA.needsCustom()) {
std::function<void()> Thunk;
unsigned NumArgRegs = Handler.assignCustomValue(
Args[i], ArrayRef(ArgLocs).slice(j), &Thunk);
if (Thunk)
DelayedOutgoingRegAssignments.emplace_back(Thunk);
if (!NumArgRegs)
return false;
j += NumArgRegs;
continue;
}
```
So it seems to me that we shouldn't be using Thunk for incoming to match how the non-custom code sets up `DelayedOutgoingRegAssignments`.
https://github.com/llvm/llvm-project/pull/69138
More information about the llvm-commits
mailing list