Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Add a uniform representation for parameter ABI information #100138

Merged
merged 9 commits into from
Mar 25, 2024
Prev Previous commit
Next Next commit
Handle retbuf on stack for x86
  • Loading branch information
jakobbotsch committed Mar 23, 2024
commit 8adac9ef01e5cc614ef11f00f0ed8c4d94b49987
21 changes: 18 additions & 3 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,19 @@ void Compiler::lvaInitRetBuffArg(InitVarDscInfo* varDscInfo, bool useFixedRetBuf
unsigned retBuffArgNum = varDscInfo->allocRegArg(TYP_INT);
varDsc->SetArgReg(genMapIntRegArgNumToRegNum(retBuffArgNum));
}
else
{
varDscInfo->stackArgSize = roundUp(varDscInfo->stackArgSize, TARGET_POINTER_SIZE);
varDsc->SetStackOffset(varDscInfo->stackArgSize);
varDscInfo->stackArgSize += TARGET_POINTER_SIZE;
}

#if FEATURE_MULTIREG_ARGS
varDsc->SetOtherArgReg(REG_NA);
#endif
varDsc->lvOnFrame = true; // The final home for this incoming register might be our local stack frame

assert(varDsc->lvIsRegArg && isValidIntArgReg(varDsc->GetArgReg()));
assert(!varDsc->lvIsRegArg || isValidIntArgReg(varDsc->GetArgReg()));

#ifdef DEBUG
if (varDsc->lvIsRegArg && verbose)
Expand All @@ -554,8 +560,17 @@ void Compiler::lvaInitRetBuffArg(InitVarDscInfo* varDscInfo, bool useFixedRetBuf

ABIPassingInformation* abiInfo = varDscInfo->abiInfo;
abiInfo->NumSegments = 1;
abiInfo->Segments = new (this, CMK_LvaTable)
ABIPassingSegment(ABIPassingSegment::InRegister(varDsc->GetArgReg(), 0, TARGET_POINTER_SIZE));
abiInfo->Segments = new (this, CMK_LvaTable) ABIPassingSegment[1];

if (varDsc->lvIsRegArg)
{
abiInfo->Segments[0] = ABIPassingSegment::InRegister(varDsc->GetArgReg(), 0, TARGET_POINTER_SIZE);
}
else
{
abiInfo->Segments[0] = ABIPassingSegment::OnStack(varDsc->GetStackOffset(), 0, TARGET_POINTER_SIZE);
}

compArgSize += TARGET_POINTER_SIZE;

varDscInfo->nextParam();
Expand Down