mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 14:54:09 +02:00
Fixed memcpy reg remap
This commit is contained in:
parent
55db457590
commit
4f7e114c9b
1 changed files with 25 additions and 25 deletions
|
@ -7867,6 +7867,21 @@ void BeMCContext::DoInstCombinePass()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto _RemapVReg = [&](int& vregIdx)
|
||||||
|
{
|
||||||
|
int* regIdxPtr = NULL;
|
||||||
|
if (regRemapMap.TryGetValue(vregIdx, ®IdxPtr))
|
||||||
|
{
|
||||||
|
int regIdx = *regIdxPtr;
|
||||||
|
if (regIdx < 0)
|
||||||
|
{
|
||||||
|
Fail("Invalid reg remap");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vregIdx = regIdx;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
auto _RemapOperand = [&](BeMCOperand* operand)
|
auto _RemapOperand = [&](BeMCOperand* operand)
|
||||||
{
|
{
|
||||||
if (operand->IsVRegAny())
|
if (operand->IsVRegAny())
|
||||||
|
@ -7890,6 +7905,12 @@ void BeMCContext::DoInstCombinePass()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (operand->mKind == BeMCOperandKind_VRegPair)
|
||||||
|
{
|
||||||
|
_RemapVReg(operand->mVRegPair.mVRegIdx0);
|
||||||
|
_RemapVReg(operand->mVRegPair.mVRegIdx1);
|
||||||
|
}
|
||||||
|
|
||||||
if (operand->IsVRegAny())
|
if (operand->IsVRegAny())
|
||||||
{
|
{
|
||||||
if (wantUnwrapVRegs.Contains(operand->mVRegIdx))
|
if (wantUnwrapVRegs.Contains(operand->mVRegIdx))
|
||||||
|
@ -7916,9 +7937,6 @@ void BeMCContext::DoInstCombinePass()
|
||||||
auto inst = mcBlock->mInstructions[instIdx];
|
auto inst = mcBlock->mInstructions[instIdx];
|
||||||
if (inst->IsDef())
|
if (inst->IsDef())
|
||||||
{
|
{
|
||||||
//auto itr = removeDefs.find(inst->mArg0.mVRegIdx);
|
|
||||||
//if (itr != removeDefs.end())
|
|
||||||
|
|
||||||
if ((removeDefs.Contains(inst->mArg0.mVRegIdx)) || (wantUnwrapVRegs.Contains(inst->mArg0.mVRegIdx)))
|
if ((removeDefs.Contains(inst->mArg0.mVRegIdx)) || (wantUnwrapVRegs.Contains(inst->mArg0.mVRegIdx)))
|
||||||
{
|
{
|
||||||
RemoveInst(mcBlock, instIdx);
|
RemoveInst(mcBlock, instIdx);
|
||||||
|
@ -7927,16 +7945,6 @@ void BeMCContext::DoInstCombinePass()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (inst->mKind == BeMCInstKind_LifetimeStart)
|
|
||||||
{
|
|
||||||
if (removeLifetimeStarts.find(inst->mArg0.mVRegIdx) != removeLifetimeStarts.end())
|
|
||||||
{
|
|
||||||
RemoveInst(mcBlock, instIdx);
|
|
||||||
instIdx--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
auto operands = { &inst->mResult, &inst->mArg0, &inst->mArg1 };
|
auto operands = { &inst->mResult, &inst->mArg0, &inst->mArg1 };
|
||||||
for (auto& operand : operands)
|
for (auto& operand : operands)
|
||||||
{
|
{
|
||||||
|
@ -8465,14 +8473,6 @@ bool BeMCContext::DoLegalization()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDebugging)
|
|
||||||
{
|
|
||||||
if (inst->mArg1.mVRegIdx == 61)
|
|
||||||
{
|
|
||||||
NOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check operands
|
// Check operands
|
||||||
if ((!inst->IsPsuedo()) && (arg0Type != NULL) && (!arg0Type->IsComposite()))
|
if ((!inst->IsPsuedo()) && (arg0Type != NULL) && (!arg0Type->IsComposite()))
|
||||||
{
|
{
|
||||||
|
@ -15533,7 +15533,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 == "?Hey@Blurg@bf@@SAXXZ");
|
mDebugging = (function->mName == "?Main@Program@Mintest2@bf@@SAXXZ");
|
||||||
// || (function->mName == "?__BfStaticCtor@roboto_font@Drawing@ClassicUO_assistant@bf@@SAXXZ")
|
// || (function->mName == "?__BfStaticCtor@roboto_font@Drawing@ClassicUO_assistant@bf@@SAXXZ")
|
||||||
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
|
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
|
||||||
// ;
|
// ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue