mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Reworking some lowering logic
This commit is contained in:
parent
ae3ea7f209
commit
63e51ec4d8
2 changed files with 32 additions and 16 deletions
|
@ -4955,7 +4955,7 @@ void BfExprEvaluator::PushThis(BfAstNode* targetSrc, BfTypedValue argVal, BfMeth
|
||||||
if (argVal.mType->IsValuelessType())
|
if (argVal.mType->IsValuelessType())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((argVal.mType->IsTypedPrimitive()) && (!methodInstance->AllowsThisSplatting()))
|
if (!methodInstance->AllowsThisSplatting())
|
||||||
{
|
{
|
||||||
argVal = mModule->MakeAddressable(argVal);
|
argVal = mModule->MakeAddressable(argVal);
|
||||||
irArgs.push_back(argVal.mValue);
|
irArgs.push_back(argVal.mValue);
|
||||||
|
@ -5010,7 +5010,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
|
||||||
if (!mModule->mCompiler->mIsResolveOnly)
|
if (!mModule->mCompiler->mIsResolveOnly)
|
||||||
sCallIdx++;
|
sCallIdx++;
|
||||||
int callIdx = sCallIdx;
|
int callIdx = sCallIdx;
|
||||||
if (callIdx == 7462)
|
if (callIdx == 44)
|
||||||
{
|
{
|
||||||
NOP;
|
NOP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -940,7 +940,33 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
||||||
checkType = GetParamType(paramIdx);
|
checkType = GetParamType(paramIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((paramIdx != -1) || (!mMethodDef->mNoSplat && !mMethodDef->mIsMutating))
|
|
||||||
|
bool checkLowered = false;
|
||||||
|
bool doSplat = false;
|
||||||
|
if (paramIdx == -1)
|
||||||
|
{
|
||||||
|
if ((checkType->IsSplattable()) && (AllowsThisSplatting()))
|
||||||
|
{
|
||||||
|
doSplat = true;
|
||||||
|
}
|
||||||
|
else if (!mMethodDef->mIsMutating)
|
||||||
|
checkLowered = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (checkType->IsMethodRef())
|
||||||
|
{
|
||||||
|
doSplat = true;
|
||||||
|
}
|
||||||
|
else if ((checkType->IsSplattable()) && (AllowsSplatting()))
|
||||||
|
{
|
||||||
|
doSplat = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
checkLowered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkLowered)
|
||||||
{
|
{
|
||||||
auto loweredTypeCode = checkType->GetLoweredType();
|
auto loweredTypeCode = checkType->GetLoweredType();
|
||||||
if (loweredTypeCode != BfTypeCode_None)
|
if (loweredTypeCode != BfTypeCode_None)
|
||||||
|
@ -961,19 +987,9 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
||||||
if ((checkType->IsValuelessType()) && (!checkType->IsMethodRef()))
|
if ((checkType->IsValuelessType()) && (!checkType->IsMethodRef()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool doSplat = false;
|
if (doSplat)
|
||||||
if (checkType->IsMethodRef())
|
|
||||||
{
|
|
||||||
doSplat = true;
|
|
||||||
}
|
|
||||||
else if (mMethodDef->mNoSplat)
|
|
||||||
{
|
|
||||||
doSplat = false;
|
|
||||||
}
|
|
||||||
else if ((paramIdx == -1) ? AllowsThisSplatting() : AllowsSplatting())
|
|
||||||
{
|
{
|
||||||
int splatCount = checkType->GetSplatCount();
|
int splatCount = checkType->GetSplatCount();
|
||||||
doSplat = ((checkType->IsSplattable()) && ((paramIdx != -1) || (!mMethodDef->mIsMutating)));
|
|
||||||
if ((int)paramTypes.size() + splatCount > module->mCompiler->mOptions.mMaxSplatRegs)
|
if ((int)paramTypes.size() + splatCount > module->mCompiler->mOptions.mMaxSplatRegs)
|
||||||
{
|
{
|
||||||
auto checkTypeInst = checkType->ToTypeInstance();
|
auto checkTypeInst = checkType->ToTypeInstance();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue