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

Enable TYP_STRUCT LCL_VAR/LCL_FLD call args on x86 #70779

Merged
merged 2 commits into from
Jun 22, 2022
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
6 changes: 3 additions & 3 deletions src/coreclr/jit/lclmorph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>
// | Partial | LCL_FLD | OBJ/LCL_FLD | LCL_FLD |
// |------------|---------|-------------|---------|
//
// * - On Windows x64 only.
// * - On x86/Windows x64 only.
//
// |------------|------|------|--------|----------|
// | SIMD | CALL | ASG | RETURN | HWI/SIMD |
Expand All @@ -1114,9 +1114,9 @@ class LocalAddressVisitor final : public GenTreeVisitor<LocalAddressVisitor>

if (user->IsCall())
{
#ifndef WINDOWS_AMD64_ABI
#if !defined(WINDOWS_AMD64_ABI) && !defined(TARGET_X86)
return IndirTransform::None;
#endif // !WINDOWS_AMD64_ABI
#endif // !defined(WINDOWS_AMD64_ABI) && !defined(TARGET_X86)
}

if (match == StructMatch::Compatible)
Expand Down
24 changes: 5 additions & 19 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,6 @@ GenTree* CallArgs::MakeTmpArgNode(Compiler* comp, CallArg* arg)

if (varTypeIsStruct(type))
{

#if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_ARM) || defined(TARGET_LOONGARCH64)

// Can this type be passed as a primitive type?
Expand Down Expand Up @@ -1491,21 +1490,8 @@ GenTree* CallArgs::MakeTmpArgNode(Compiler* comp, CallArg* arg)
#endif // !(TARGET_ARM64 || TARGET_LOONGARCH64)
#endif // FEATURE_MULTIREG_ARGS
}

#else // not (TARGET_AMD64 or TARGET_ARM64 or TARGET_ARM or TARGET_LOONGARCH64)

// other targets, we pass the struct by value
assert(varTypeIsStruct(type));

addrNode = comp->gtNewOperNode(GT_ADDR, TYP_BYREF, argNode);

// Get a new Obj node temp to use it as a call argument.
// gtNewObjNode will set the GTF_EXCEPT flag if this is not a local stack object.
argNode = comp->gtNewObjNode(comp->lvaGetStruct(tmpVarNum), addrNode);

#endif // not (TARGET_AMD64 or TARGET_ARM64 or TARGET_ARM or TARGET_LOONGARCH64)

} // (varTypeIsStruct(type))
#endif // (TARGET_AMD64 or TARGET_ARM64 or TARGET_ARM or TARGET_LOONGARCH64)
} // (varTypeIsStruct(type))

if (addrNode != nullptr)
{
Expand Down Expand Up @@ -4168,7 +4154,7 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call, CallArg* arg)
{
tmp = (unsigned)lclNum;
found = true;
JITDUMP("reusing outgoing struct arg");
JITDUMP("reusing outgoing struct arg\n");
break;
}
}
Expand Down Expand Up @@ -4215,7 +4201,7 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call, CallArg* arg)
// When on Unix create LCL_FLD for structs passed in more than one registers. See fgMakeTmpArgNode
GenTree* argNode = copyBlk;

#else // FEATURE_FIXED_OUT_ARGS
#else // !FEATURE_FIXED_OUT_ARGS

// Structs are always on the stack, and thus never need temps
// so we have to put the copy and temp all into one expression.
Expand All @@ -4224,7 +4210,7 @@ void Compiler::fgMakeOutgoingStructArgCopy(GenTreeCall* call, CallArg* arg)
// Change the expression to "(tmp=val),tmp"
argNode = gtNewOperNode(GT_COMMA, argNode->TypeGet(), copyBlk, argNode);

#endif // FEATURE_FIXED_OUT_ARGS
#endif // !FEATURE_FIXED_OUT_ARGS

arg->SetEarlyNode(argNode);
}
Expand Down