Skip to content

Commit

Permalink
JIT: Delete old GenTreeCall ABI information (#112665)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbotsch authored Feb 20, 2025
1 parent 451a41d commit 482e5b1
Show file tree
Hide file tree
Showing 17 changed files with 212 additions and 658 deletions.
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 @@ -6046,7 +6046,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 @@ -7502,7 +7504,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 @@ -7594,7 +7596,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 @@ -5976,7 +5976,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 @@ -5990,7 +5990,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 @@ -8393,7 +8393,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

0 comments on commit 482e5b1

Please sign in to comment.