1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed some lowering of Win32 structs by value

This commit is contained in:
Brian Fiete 2020-03-09 11:46:40 -07:00
parent 611ab328d2
commit 686050a68b
4 changed files with 81 additions and 10 deletions

View file

@ -5495,7 +5495,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
BfIRType fieldDataPtrType = mBfIRBuilder->GetPointerTo(reflectFieldDataIRType);
if (fieldTypes.size() == 0)
{
if ((type->IsSplattable()) && (type->IsStruct()) && (!type->IsValuelessType()))
if ((type->IsSplattable()) && (type->IsStruct()) && (!type->IsValuelessType()) && (!typeInstance->mIsCRepr))
{
BfTypeInstance* reflectFieldSplatDataType = ResolveTypeDef(mCompiler->mReflectFieldSplatDataDef)->ToTypeInstance();
@ -14067,7 +14067,13 @@ void BfModule::SetupIRMethod(BfMethodInstance* methodInstance, BfIRFunction func
isSplattable = true;
else if (resolvedTypeRef->IsSplattable())
{
if (resolvedTypeRef->GetSplatCount() + argIdx <= mCompiler->mOptions.mMaxSplatRegs)
auto resolvedTypeInst = resolvedTypeRef->ToTypeInstance();
if ((resolvedTypeInst != NULL) && (resolvedTypeInst->mIsCRepr))
{
// crepr splat is always splattable
isSplattable = true;
}
else if (resolvedTypeRef->GetSplatCount() + argIdx <= mCompiler->mOptions.mMaxSplatRegs)
isSplattable = true;
}
}
@ -15148,9 +15154,18 @@ void BfModule::ProcessMethod_SetupParams(BfMethodInstance* methodInstance, BfTyp
}
else if (resolvedType->IsComposite() && resolvedType->IsSplattable())
{
int splatCount = resolvedType->GetSplatCount();
if (argIdx + splatCount <= mCompiler->mOptions.mMaxSplatRegs)
auto resolvedTypeInst = resolvedType->ToTypeInstance();
if ((resolvedTypeInst != NULL) && (resolvedTypeInst->mIsCRepr))
{
// crepr splat is always splat
paramVar->mIsSplat = true;
}
else
{
int splatCount = resolvedType->GetSplatCount();
if (argIdx + splatCount <= mCompiler->mOptions.mMaxSplatRegs)
paramVar->mIsSplat = true;
}
}
}
else