mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed an errorVReg relto issue
This commit is contained in:
parent
9ac84e12e9
commit
1e3d0308bf
1 changed files with 32 additions and 4 deletions
|
@ -9626,13 +9626,15 @@ bool BeMCContext::DoLegalization()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This may be a local variable that failed to be assigned to a reg, create a scratch local with a forced reg
|
// This may be a local variable that failed to be assigned to a reg, create a scratch local with a forced reg
|
||||||
auto scratchReg = AllocVirtualReg(errorVRegInfo->mType, 2, false);
|
|
||||||
auto scratchVRegInfo = mVRegInfo[scratchReg.mVRegIdx];
|
|
||||||
auto errorVReg = BeMCOperand::FromVReg(rmInfo.mErrorVReg);
|
auto errorVReg = BeMCOperand::FromVReg(rmInfo.mErrorVReg);
|
||||||
|
auto errorVRegLoad = BeMCOperand::ToLoad(errorVReg);
|
||||||
|
|
||||||
if ((vregInfo->mRelTo == errorVReg) || (vregInfo->mRelOffset == errorVReg))
|
if ((vregInfo->mRelTo == errorVReg) || (vregInfo->mRelOffset == errorVReg))
|
||||||
{
|
{
|
||||||
|
auto scratchReg = AllocVirtualReg(errorVRegInfo->mType, 2, false);
|
||||||
|
auto scratchVRegInfo = mVRegInfo[scratchReg.mVRegIdx];
|
||||||
|
|
||||||
CreateDefineVReg(scratchReg, instIdx++);
|
CreateDefineVReg(scratchReg, instIdx++);
|
||||||
AllocInst(BeMCInstKind_Mov, scratchReg, errorVReg, instIdx++);
|
AllocInst(BeMCInstKind_Mov, scratchReg, errorVReg, instIdx++);
|
||||||
isFinalRun = false;
|
isFinalRun = false;
|
||||||
|
@ -9653,6 +9655,32 @@ bool BeMCContext::DoLegalization()
|
||||||
vregInfo->mRelOffset.mVRegIdx = scratchReg.mVRegIdx;
|
vregInfo->mRelOffset.mVRegIdx = scratchReg.mVRegIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((vregInfo->mRelTo == errorVRegLoad) || (vregInfo->mRelOffset == errorVRegLoad))
|
||||||
|
{
|
||||||
|
auto scratchType = GetType(errorVRegLoad);
|
||||||
|
auto scratchReg = AllocVirtualReg(scratchType, 2, false);
|
||||||
|
auto scratchVRegInfo = mVRegInfo[scratchReg.mVRegIdx];
|
||||||
|
|
||||||
|
CreateDefineVReg(scratchReg, instIdx++);
|
||||||
|
AllocInst(BeMCInstKind_Mov, scratchReg, errorVRegLoad, instIdx++);
|
||||||
|
isFinalRun = false;
|
||||||
|
if (debugging)
|
||||||
|
OutputDebugStrF(" RM failed, scratch vreg\n");
|
||||||
|
vregExprChangeSet.Add(scratchReg.mVRegIdx);
|
||||||
|
|
||||||
|
if (vregInfo->mRelTo == errorVRegLoad)
|
||||||
|
{
|
||||||
|
scratchVRegInfo->mForceReg = true;
|
||||||
|
CheckForce(scratchVRegInfo);
|
||||||
|
vregInfo->mRelTo = scratchReg;
|
||||||
|
}
|
||||||
|
else if (vregInfo->mRelOffset == errorVRegLoad)
|
||||||
|
{
|
||||||
|
scratchVRegInfo->mForceReg = true;
|
||||||
|
CheckForce(scratchVRegInfo);
|
||||||
|
vregInfo->mRelOffset = scratchReg;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This should be impossible - a previous def for an inner expr should have caught this case
|
// This should be impossible - a previous def for an inner expr should have caught this case
|
||||||
|
@ -15906,7 +15934,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 == "?DrawCard@Stats@NecroCard@bf@@QEAAX_N@Z");
|
mDebugging = (function->mName == "?PopulateComboBox$ny@PropertyPanel@Editor@Cobalt@bf@@QEAAXPEAVMenu@widgets@Beefy@4@@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