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: Delete old GenTreeCall ABI information #112665

Merged
merged 3 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/coreclr/jit/abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,28 @@ unsigned ABIPassingInformation::CountRegsAndStackSlots() const
return numSlots;
}

//-----------------------------------------------------------------------------
// StackBytesConsumes:
// Count the amount of stack bytes consumed by this argument.
//
// Return Value:
// Bytes.
//
unsigned ABIPassingInformation::StackBytesConsumed() const
{
unsigned numBytes = 0;

for (const ABIPassingSegment& seg : Segments())
{
if (seg.IsPassedOnStack())
{
numBytes += seg.GetStackSize();
}
}

return numBytes;
}

//-----------------------------------------------------------------------------
// FromSegment:
// Create ABIPassingInformation from a single segment.
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ struct ABIPassingInformation
bool HasExactlyOneStackSegment() const;
bool IsSplitAcrossRegistersAndStack() const;
unsigned CountRegsAndStackSlots() const;
unsigned StackBytesConsumed() const;

static ABIPassingInformation FromSegment(Compiler* comp, bool passedByRef, const ABIPassingSegment& segment);
static ABIPassingInformation FromSegmentByValue(Compiler* comp, const ABIPassingSegment& segment);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3526,7 +3526,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)

for (CallArg& arg : call->gtArgs.Args())
{
for (const ABIPassingSegment& seg : arg.NewAbiInfo.Segments())
for (const ABIPassingSegment& seg : arg.AbiInfo.Segments())
{
if (seg.IsPassedInRegister() && ((trashedByEpilog & seg.GetRegisterMask()) != 0))
{
Expand Down
8 changes: 5 additions & 3 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6045,7 +6045,9 @@ regNumber CodeGen::getCallIndirectionCellReg(GenTreeCall* call)
if (call->GetIndirectionCellArgKind() != WellKnownArg::None)
{
CallArg* indirCellArg = call->gtArgs.FindWellKnownArg(call->GetIndirectionCellArgKind());
assert((indirCellArg != nullptr) && (indirCellArg->AbiInfo.GetRegNum() == result));
assert(indirCellArg != nullptr);
assert(indirCellArg->AbiInfo.HasExactlyOneRegisterSegment());
assert(indirCellArg->AbiInfo.Segment(0).GetRegister() == result);
}
#endif

Expand Down Expand Up @@ -7499,7 +7501,7 @@ void CodeGen::genCallPlaceRegArgs(GenTreeCall* call)
// Consume all the arg regs
for (CallArg& arg : call->gtArgs.LateArgs())
{
ABIPassingInformation& abiInfo = arg.NewAbiInfo;
ABIPassingInformation& abiInfo = arg.AbiInfo;
GenTree* argNode = arg.GetLateNode();

#if FEATURE_MULTIREG_ARGS
Expand Down Expand Up @@ -7591,7 +7593,7 @@ void CodeGen::genCallPlaceRegArgs(GenTreeCall* call)
{
for (CallArg& arg : call->gtArgs.Args())
{
for (const ABIPassingSegment& seg : arg.NewAbiInfo.Segments())
for (const ABIPassingSegment& seg : arg.AbiInfo.Segments())
{
if (seg.IsPassedInRegister() && genIsValidFloatReg(seg.GetRegister()))
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenloongarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6043,9 +6043,9 @@ void CodeGen::genCallInstruction(GenTreeCall* call)

for (CallArg& arg : call->gtArgs.Args())
{
for (unsigned i = 0; i < arg.NewAbiInfo.NumSegments; i++)
for (unsigned i = 0; i < arg.AbiInfo.NumSegments; i++)
{
const ABIPassingSegment& seg = arg.NewAbiInfo.Segment(i);
const ABIPassingSegment& seg = arg.AbiInfo.Segment(i);
if (seg.IsPassedInRegister() && ((trashedByEpilog & seg.GetRegisterMask()) != 0))
{
JITDUMP("Tail call node:\n");
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegenriscv64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6098,9 +6098,9 @@ void CodeGen::genCallInstruction(GenTreeCall* call)

for (CallArg& arg : call->gtArgs.Args())
{
for (unsigned i = 0; i < arg.NewAbiInfo.NumSegments; i++)
for (unsigned i = 0; i < arg.AbiInfo.NumSegments; i++)
{
const ABIPassingSegment& seg = arg.NewAbiInfo.Segment(i);
const ABIPassingSegment& seg = arg.AbiInfo.Segment(i);
if (seg.IsPassedInRegister() && ((trashedByEpilog & seg.GetRegisterMask()) != 0))
{
JITDUMP("Tail call node:\n");
Expand Down
7 changes: 4 additions & 3 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5974,7 +5974,7 @@ void CodeGen::genCall(GenTreeCall* call)

genCallPlaceRegArgs(call);

#if defined(TARGET_X86) || defined(UNIX_AMD64_ABI)
#if defined(TARGET_X86)
// The call will pop its arguments.
// for each putarg_stk:
target_ssize_t stackArgBytes = 0;
Expand All @@ -5988,7 +5988,7 @@ void CodeGen::genCall(GenTreeCall* call)
stackArgBytes += argSize;

#ifdef DEBUG
assert(argSize == arg.AbiInfo.ByteSize);
assert(argSize == arg.AbiInfo.StackBytesConsumed());
if (source->TypeIs(TYP_STRUCT) && !source->OperIs(GT_FIELD_LIST))
{
unsigned loadSize = source->GetLayout(compiler)->GetSize();
Expand Down Expand Up @@ -8410,7 +8410,8 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk)
#ifdef DEBUG
CallArg* callArg = putArgStk->gtCall->gtArgs.FindByNode(putArgStk);
assert(callArg != nullptr);
assert(argOffset == callArg->AbiInfo.ByteOffset);
assert(callArg->AbiInfo.HasExactlyOneStackSegment());
assert(argOffset == callArg->AbiInfo.Segment(0).GetStackOffset());
#endif

if (data->isContainedIntOrIImmed())
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3933,6 +3933,7 @@ class Compiler
const char* gtGetWellKnownArgNameForArgMsg(WellKnownArg arg);
void gtGetArgMsg(GenTreeCall* call, CallArg* arg, char* bufp, unsigned bufLength);
void gtGetLateArgMsg(GenTreeCall* call, CallArg* arg, char* bufp, unsigned bufLength);
void gtPrintABILocation(const ABIPassingInformation& abiInfo, char** bufp, unsigned* bufLength);
void gtDispArgList(GenTreeCall* call, GenTree* lastCallOperand, IndentStack* indentStack);
void gtDispFieldSeq(FieldSeq* fieldSeq, ssize_t offset);

Expand Down
Loading
Loading