mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02: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())
|
||||
return;
|
||||
|
||||
if ((argVal.mType->IsTypedPrimitive()) && (!methodInstance->AllowsThisSplatting()))
|
||||
if (!methodInstance->AllowsThisSplatting())
|
||||
{
|
||||
argVal = mModule->MakeAddressable(argVal);
|
||||
irArgs.push_back(argVal.mValue);
|
||||
|
@ -5010,7 +5010,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
|
|||
if (!mModule->mCompiler->mIsResolveOnly)
|
||||
sCallIdx++;
|
||||
int callIdx = sCallIdx;
|
||||
if (callIdx == 7462)
|
||||
if (callIdx == 44)
|
||||
{
|
||||
NOP;
|
||||
}
|
||||
|
|
|
@ -940,7 +940,33 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
|||
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();
|
||||
if (loweredTypeCode != BfTypeCode_None)
|
||||
|
@ -960,20 +986,10 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
|||
module->PopulateType(checkType, BfPopulateType_Data);
|
||||
if ((checkType->IsValuelessType()) && (!checkType->IsMethodRef()))
|
||||
continue;
|
||||
|
||||
bool doSplat = false;
|
||||
if (checkType->IsMethodRef())
|
||||
|
||||
if (doSplat)
|
||||
{
|
||||
doSplat = true;
|
||||
}
|
||||
else if (mMethodDef->mNoSplat)
|
||||
{
|
||||
doSplat = false;
|
||||
}
|
||||
else if ((paramIdx == -1) ? AllowsThisSplatting() : AllowsSplatting())
|
||||
{
|
||||
int splatCount = checkType->GetSplatCount();
|
||||
doSplat = ((checkType->IsSplattable()) && ((paramIdx != -1) || (!mMethodDef->mIsMutating)));
|
||||
int splatCount = checkType->GetSplatCount();
|
||||
if ((int)paramTypes.size() + splatCount > module->mCompiler->mOptions.mMaxSplatRegs)
|
||||
{
|
||||
auto checkTypeInst = checkType->ToTypeInstance();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue