1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 15:26:00 +02:00

Added support for "case when" (valueless) switch cases

This commit is contained in:
Brian Fiete 2020-02-23 06:14:14 -08:00
parent 3fd81fc966
commit 857c1c384a
5 changed files with 25 additions and 11 deletions

View file

@ -7576,16 +7576,14 @@ void BeMCContext::DoInstCombinePass()
continue;
auto vregInfoFrom = mVRegInfo[remapFrom];
auto vregInfoTo = mVRegInfo[remapTo];
int bestVRegIdx = (vregInfoFrom->mDefOrderIdx < vregInfoTo->mDefOrderIdx) ? remapFrom : remapTo;
int bestVRegIdx = remapTo;
//auto itr = defMap.find(remapTo);
//if (itr != defMap.end())
int* prevBestVRegIdxPtr = NULL;
if (defMap.TryGetValue(remapTo, &prevBestVRegIdxPtr))
{
auto prevBestVRegIdx = *prevBestVRegIdxPtr;
if (mVRegInfo[bestVRegIdx]->mDefOrderIdx < mVRegInfo[prevBestVRegIdx]->mDefOrderIdx)
defMap[remapTo] = bestVRegIdx;
}
else
defMap[remapTo] = bestVRegIdx;

View file

@ -748,8 +748,7 @@ public:
bool mMustExist; // Regs we must be able to debug
// Must be refreshed with RefreshRefCounts
int mRefCount;
int mAssignCount;
int mDefOrderIdx; // Indicates instruction # in def assignment
int mAssignCount;
BeMCBlock* mClosedBlock;
int mClosedInstIdx;
@ -789,8 +788,7 @@ public:
mAssignCount = -1;
mVolatileVRegSave = -1;
mMustExist = false;
mIsRetVal = false;
mDefOrderIdx = -1;
mIsRetVal = false;
mClosedBlock = NULL;
mClosedInstIdx = -1;