Skip to content

Commit

Permalink
Improve impPopCallArgs (#68736)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbotsch authored May 6, 2022
1 parent dd74d3e commit 067e694
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 118 deletions.
9 changes: 5 additions & 4 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3550,8 +3550,9 @@ class Compiler
void impResolveToken(const BYTE* addr, CORINFO_RESOLVED_TOKEN* pResolvedToken, CorInfoTokenKind kind);

void impPushOnStack(GenTree* tree, typeInfo ti);
void impPushNullObjRefOnStack();
StackEntry impPopStack();
void impPushNullObjRefOnStack();
StackEntry impPopStack();
void impPopStack(unsigned n);
StackEntry& impStackTop(unsigned n = 0);
unsigned impStackHeight();

Expand Down Expand Up @@ -3908,11 +3909,11 @@ class Compiler
((opcode >= CEE_STLOC_0) && (opcode <= CEE_STLOC_3)));
}

void impPopCallArgs(unsigned count, CORINFO_SIG_INFO* sig, GenTreeCall* call);
void impPopCallArgs(CORINFO_SIG_INFO* sig, GenTreeCall* call);

bool impCheckImplicitArgumentCoercion(var_types sigType, var_types nodeType) const;

void impPopReverseCallArgs(unsigned count, CORINFO_SIG_INFO* sig, GenTreeCall* call, unsigned skipReverseCount = 0);
void impPopReverseCallArgs(CORINFO_SIG_INFO* sig, GenTreeCall* call, unsigned skipReverseCount);

//---------------- Spilling the importer stack ----------------------------

Expand Down
17 changes: 17 additions & 0 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,23 @@ CallArg* CallArgs::InsertAfter(Compiler* comp, CallArg* after, GenTree* node, We
assert(found && "Could not find arg to insert after in argument list");
#endif

return InsertAfterUnchecked(comp, after, node, wellKnownArg);
}

//---------------------------------------------------------------
// InsertAfterUnchecked: Create a new argument after another argument, without debug checks.
//
// Parameters:
// comp - The compiler.
// after - The existing argument to insert the new argument after.
// node - The IR node for the argument.
// wellKnownArg - The kind of argument, if special.
//
// Returns:
// The created representative for the argument.
//
CallArg* CallArgs::InsertAfterUnchecked(Compiler* comp, CallArg* after, GenTree* node, WellKnownArg wellKnownArg)
{
CallArg* newArg = new (comp, CMK_CallArgs) CallArg(wellKnownArg);
newArg->SetEarlyNode(node);
newArg->SetNext(after->GetNext());
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/jit/gentree.h
Original file line number Diff line number Diff line change
Expand Up @@ -4339,6 +4339,10 @@ class CallArgs
CallArg* PushFront(Compiler* comp, GenTree* node, WellKnownArg wellKnownArg = WellKnownArg::None);
CallArg* PushBack(Compiler* comp, GenTree* node, WellKnownArg wellKnownArg = WellKnownArg::None);
CallArg* InsertAfter(Compiler* comp, CallArg* after, GenTree* node, WellKnownArg wellKnownArg = WellKnownArg::None);
CallArg* InsertAfterUnchecked(Compiler* comp,
CallArg* after,
GenTree* node,
WellKnownArg wellKnownArg = WellKnownArg::None);
CallArg* InsertInstParam(Compiler* comp, GenTree* node);
CallArg* InsertAfterThisOrFirst(Compiler* comp, GenTree* node, WellKnownArg wellKnownArg = WellKnownArg::None);
void PushLateBack(CallArg* arg);
Expand Down
Loading

0 comments on commit 067e694

Please sign in to comment.