1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

undef detection

This commit is contained in:
Brian Fiete 2021-01-22 16:46:52 -08:00
parent 41f95003fe
commit 621fe99882

View file

@ -3698,12 +3698,23 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
if (mCeMachine->mAppendAllocInfo != NULL)
{
if ((mCeMachine->mAppendAllocInfo->mAppendSizeValue) && (!mCeMachine->mAppendAllocInfo->mAppendSizeValue.IsConst()))
if (mCeMachine->mAppendAllocInfo->mAppendSizeValue)
{
bool isConst = mCeMachine->mAppendAllocInfo->mAppendSizeValue.IsConst();
if (isConst)
{
auto constant = module->mBfIRBuilder->GetConstant(mCeMachine->mAppendAllocInfo->mAppendSizeValue);
if (constant->mConstType == BfConstType_Undef)
isConst = false;
}
if (!isConst)
{
Fail("Non-constant append alloc");
return BfTypedValue();
}
}
}
int thisArgIdx = -1;
int appendAllocIdx = -1;
@ -3738,12 +3749,19 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
}
if (paramType->IsComposite())
{
auto paramTypeInst = paramType->ToTypeInstance();
paramCompositeSize += paramTypeInst->mInstSize;
paramCompositeSize += paramType->mSize;
}
auto arg = args[argIdx];
if (!arg.IsConst())
bool isConst = arg.IsConst();
if (isConst)
{
auto constant = module->mBfIRBuilder->GetConstant(arg);
if (constant->mConstType == BfConstType_Undef)
isConst = false;
}
if (!isConst)
{
if ((argIdx != thisArgIdx) && (argIdx != appendAllocIdx))
{