mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed phi with StringView
This commit is contained in:
parent
706fe9e04b
commit
65c0f10cba
1 changed files with 14 additions and 10 deletions
|
@ -2898,10 +2898,10 @@ static bool NeedsDecompose(BeConstant* constant)
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeMCContext::CreateStore(BeMCInstKind instKind, const BeMCOperand& val, const BeMCOperand& ptr)
|
void BeMCContext::CreateStore(BeMCInstKind instKind, const BeMCOperand& val, const BeMCOperand& ptr)
|
||||||
{
|
{
|
||||||
BeMCOperand mcVal = val;
|
BeMCOperand mcVal = val;
|
||||||
BeMCOperand mcPtr = ptr;
|
BeMCOperand mcPtr = ptr;
|
||||||
|
|
||||||
if (mcVal.mKind == BeMCOperandKind_ConstAgg)
|
if (mcVal.mKind == BeMCOperandKind_ConstAgg)
|
||||||
{
|
{
|
||||||
if (auto aggConst = BeValueDynCast<BeStructConstant>(mcVal.mConstant))
|
if (auto aggConst = BeValueDynCast<BeStructConstant>(mcVal.mConstant))
|
||||||
|
@ -3670,7 +3670,7 @@ void BeMCContext::CreatePhiAssign(BeMCBlock* mcBlock, const BeMCOperand& testVal
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<BeMCBlock*> prevActiveBlock(mActiveBlock, block);
|
SetAndRestoreValue<BeMCBlock*> prevActiveBlock(mActiveBlock, block);
|
||||||
for (int checkIdx = (int)block->mInstructions.size() - 1; checkIdx >= 0; checkIdx--)
|
for (int checkIdx = (int)block->mInstructions.size() - 1; checkIdx >= 0; checkIdx--)
|
||||||
{
|
{
|
||||||
auto checkInst = block->mInstructions[checkIdx];
|
auto checkInst = block->mInstructions[checkIdx];
|
||||||
if ((checkInst->mArg0.mKind == BeMCOperandKind_Block) &&
|
if ((checkInst->mArg0.mKind == BeMCOperandKind_Block) &&
|
||||||
(checkInst->mArg0.mBlock == phi->mBlock))
|
(checkInst->mArg0.mBlock == phi->mBlock))
|
||||||
|
@ -3684,15 +3684,19 @@ void BeMCContext::CreatePhiAssign(BeMCBlock* mcBlock, const BeMCOperand& testVal
|
||||||
auto prevDest = checkInst->mArg0;
|
auto prevDest = checkInst->mArg0;
|
||||||
|
|
||||||
checkInst->mArg0 = falseLabel;
|
checkInst->mArg0 = falseLabel;
|
||||||
checkInst->mArg1.mCmpKind = BeModule::InvertCmp(checkInst->mArg1.mCmpKind);
|
checkInst->mArg1.mCmpKind = BeModule::InvertCmp(checkInst->mArg1.mCmpKind);
|
||||||
|
|
||||||
AllocInst(BeMCInstKind_Mov, result, phiVal.mValue, checkIdx + 1);
|
int insertIdx = checkIdx + 1;
|
||||||
AllocInst(BeMCInstKind_Br, prevDest, checkIdx + 2);
|
SetAndRestoreValue<int*> prevInsertIdxRef(mInsertInstIdxRef, &insertIdx);
|
||||||
AllocInst(BeMCInstKind_Label, falseLabel, checkIdx + 3);
|
CreateStore(BeMCInstKind_Mov, phiVal.mValue, OperandToAddr(result));
|
||||||
|
AllocInst(BeMCInstKind_Br, prevDest);
|
||||||
|
AllocInst(BeMCInstKind_Label, falseLabel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AllocInst(BeMCInstKind_Mov, result, phiVal.mValue, checkIdx);
|
int insertIdx = checkIdx;
|
||||||
|
SetAndRestoreValue<int*> prevInsertIdxRef(mInsertInstIdxRef, &insertIdx);
|
||||||
|
CreateStore(BeMCInstKind_Mov, phiVal.mValue, OperandToAddr(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -15790,7 +15794,7 @@ void BeMCContext::Generate(BeFunction* function)
|
||||||
mDbgPreferredRegs[32] = X64Reg_R8;*/
|
mDbgPreferredRegs[32] = X64Reg_R8;*/
|
||||||
|
|
||||||
//mDbgPreferredRegs[8] = X64Reg_RAX;
|
//mDbgPreferredRegs[8] = X64Reg_RAX;
|
||||||
//mDebugging = (function->mName == "??$EmitNow@UInitialize@CoreEvents@Atma@bf@@@Emitter@Atma@bf@@QEAAXUInitialize@CoreEvents@Atma@bf@@@Z");
|
//mDebugging = (function->mName == "?Main@TestProgram@BeefTest@bf@@SATint@@PEAV?$Array1@PEAVString@System@bf@@@System@3@@Z");
|
||||||
// || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ");
|
// || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ");
|
||||||
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
|
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
|
||||||
// ;
|
// ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue