1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Improved setting mForceMem

This commit is contained in:
Brian Fiete 2022-05-13 14:07:40 -07:00
parent bf5d4fd340
commit 5bd8aac41b
2 changed files with 16 additions and 9 deletions

View file

@ -2155,7 +2155,7 @@ String BeMCContext::ToString(const BeMCOperand& operand)
return "???";
}
BeMCOperand BeMCContext::GetOperand(BeValue* value, bool allowMetaResult, bool allowFail)
BeMCOperand BeMCContext::GetOperand(BeValue* value, bool allowMetaResult, bool allowFail, bool skipForceVRegAddr)
{
if (value == NULL)
return BeMCOperand();
@ -2572,6 +2572,13 @@ BeMCOperand BeMCContext::GetOperand(BeValue* value, bool allowMetaResult, bool a
AllocInst(BeMCInstKind_Xor, operand, xorVal);
}
if ((operand.mKind == BeMCOperandKind_VRegAddr) && (!skipForceVRegAddr))
{
auto vregInfo = GetVRegInfo(operand);
if (!vregInfo->mForceMem)
vregInfo->mForceMem = true;
}
return operand;
}
@ -16959,7 +16966,7 @@ void BeMCContext::Generate(BeFunction* function)
case BeLifetimeStartInst::TypeId:
{
auto castedInst = (BeLifetimeEndInst*)inst;
auto mcPtr = GetOperand(castedInst->mPtr, false, true);
auto mcPtr = GetOperand(castedInst->mPtr, false, true, true);
if (mcPtr)
{
auto vregInfo = GetVRegInfo(mcPtr);
@ -16976,7 +16983,7 @@ void BeMCContext::Generate(BeFunction* function)
case BeLifetimeExtendInst::TypeId:
{
auto castedInst = (BeLifetimeEndInst*)inst;
auto mcPtr = GetOperand(castedInst->mPtr, false, true);
auto mcPtr = GetOperand(castedInst->mPtr, false, true, true);
if (mcPtr)
AllocInst(BeMCInstKind_LifetimeExtend, mcPtr);
}
@ -16984,7 +16991,7 @@ void BeMCContext::Generate(BeFunction* function)
case BeLifetimeEndInst::TypeId:
{
auto castedInst = (BeLifetimeEndInst*)inst;
auto mcPtr = GetOperand(castedInst->mPtr, false, true);
auto mcPtr = GetOperand(castedInst->mPtr, false, true, true);
if (mcPtr.IsVRegAny())
{
AllocInst(BeMCInstKind_LifetimeEnd, mcPtr);
@ -17031,7 +17038,7 @@ void BeMCContext::Generate(BeFunction* function)
case BeLoadInst::TypeId:
{
auto castedInst = (BeLoadInst*)inst;
auto mcTarget = GetOperand(castedInst->mTarget);
auto mcTarget = GetOperand(castedInst->mTarget, false, false, true);
result = CreateLoad(mcTarget);
}
break;
@ -17039,7 +17046,7 @@ void BeMCContext::Generate(BeFunction* function)
{
auto castedInst = (BeStoreInst*)inst;
auto mcVal = GetOperand(castedInst->mVal);
auto mcPtr = GetOperand(castedInst->mPtr);
auto mcPtr = GetOperand(castedInst->mPtr, false, false, true);
bool handled = false;
@ -17049,7 +17056,7 @@ void BeMCContext::Generate(BeFunction* function)
case BeSetCanMergeInst::TypeId:
{
auto castedInst = (BeSetCanMergeInst*)inst;
auto mcVal = GetOperand(castedInst->mVal);
auto mcVal = GetOperand(castedInst->mVal, false, false, true);
auto vregInfo = GetVRegInfo(mcVal);
vregInfo->mForceMerge = true;
}
@ -18002,7 +18009,7 @@ void BeMCContext::Generate(BeFunction* function)
{
auto castedInst = (BeDbgDeclareInst*)inst;
auto dbgVar = castedInst->mDbgVar;
auto mcValue = GetOperand(castedInst->mValue);
auto mcValue = GetOperand(castedInst->mValue, false, false, true);
auto mcVReg = mcValue;
auto vregInfo = GetVRegInfo(mcVReg);

View file

@ -1362,7 +1362,7 @@ public:
String ToString(bool showVRegFlags = true, bool showVRegDetails = false);
void Print(bool showVRegFlags, bool showVRegDetails);
void Print();
BeMCOperand GetOperand(BeValue* value, bool allowMetaResult = false, bool allowFail = false); // Meta results are PHIs or CmpResults
BeMCOperand GetOperand(BeValue* value, bool allowMetaResult = false, bool allowFail = false, bool skipForceVRegAddr = false); // Meta results are PHIs or CmpResults
BeMCOperand CreateNot(const BeMCOperand& operand);
BeMCOperand TryToVector(BeValue* value);
BeType* GetType(const BeMCOperand& operand);