mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed splat MakeCallableTarget
This commit is contained in:
parent
1be4c24e45
commit
378d514d0a
1 changed files with 13 additions and 12 deletions
|
@ -13043,27 +13043,28 @@ BfTypedValue BfExprEvaluator::MakeCallableTarget(BfAstNode* targetSrc, BfTypedVa
|
|||
if (primStructType != NULL)
|
||||
{
|
||||
mModule->PopulateType(primStructType);
|
||||
target.mType = primStructType;
|
||||
|
||||
if (primStructType->IsTypedPrimitive())
|
||||
{
|
||||
// Type is already the same
|
||||
target.mType = primStructType;
|
||||
}
|
||||
else if (target.IsAddr())
|
||||
{
|
||||
auto ptrType = mModule->CreatePointerType(primStructType);
|
||||
target = BfTypedValue(mModule->mBfIRBuilder->CreateBitCast(target.mValue, mModule->mBfIRBuilder->MapType(ptrType)), primStructType, true);
|
||||
}
|
||||
else if (primStructType->IsSplattable())
|
||||
else if ((primStructType->IsSplattable()) && (target.IsSplat()))
|
||||
{
|
||||
BF_ASSERT(target.IsSplat() || target.mValue.IsFake());
|
||||
if (target.IsSplat())
|
||||
target.mKind = BfTypedValueKind_SplatHead;
|
||||
else
|
||||
{
|
||||
if (!target.mValue.IsFake())
|
||||
mModule->FailInternal("MakeCallableTarget splat fail", targetSrc);
|
||||
}
|
||||
target.mType = primStructType;
|
||||
target.mKind = BfTypedValueKind_SplatHead;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto allocPtr = mModule->CreateAlloca(primStructType);
|
||||
auto srcPtrType = mModule->mBfIRBuilder->CreateBitCast(allocPtr, mModule->mBfIRBuilder->GetPointerTo(mModule->mBfIRBuilder->MapType(target.mType)));
|
||||
mModule->mBfIRBuilder->CreateStore(target.mValue, srcPtrType);
|
||||
target = BfTypedValue(allocPtr, primStructType, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue