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

Disable block merge with 'fake br'

This commit is contained in:
Brian Fiete 2022-06-27 15:56:15 -07:00
parent 84bc0ad1de
commit 720a3ad14f
2 changed files with 7 additions and 1 deletions

View file

@ -7224,6 +7224,9 @@ void BeMCContext::DoChainedBlockMerge()
for (int blockIdx = 0; blockIdx < mBlocks.size() - 1; blockIdx++) for (int blockIdx = 0; blockIdx < mBlocks.size() - 1; blockIdx++)
{ {
auto mcBlock = mBlocks[blockIdx]; auto mcBlock = mBlocks[blockIdx];
if (mcBlock->mHasFakeBr)
continue;
auto nextMcBlock = mBlocks[blockIdx + 1]; auto nextMcBlock = mBlocks[blockIdx + 1];
// We only branch into one block, and the the next block only has current block as a predecessor? // We only branch into one block, and the the next block only has current block as a predecessor?
@ -16141,7 +16144,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 == "?NumberToString@NumberFormatter@System@bf@@SAXUStringView@23@HPEAVIFormatProvider@23@PEAVString@23@@Z"); mDebugging = (function->mName == "?CheckMatch@?$StringSplitEnumeratorBase@D@System@bf@@IEAA_NXZ");
// || (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")
// ; // ;
@ -17247,6 +17250,7 @@ void BeMCContext::Generate(BeFunction* function)
{ {
mcInst->mArg1.mKind = BeMCOperandKind_Immediate_i8; mcInst->mArg1.mKind = BeMCOperandKind_Immediate_i8;
mcInst->mArg1.mImmediate = 2; mcInst->mArg1.mImmediate = 2;
mcBlock->mHasFakeBr = true;
} }
} }
break; break;

View file

@ -660,6 +660,7 @@ public:
int mBlockIdx; int mBlockIdx;
int mMaxDeclBlockId; // If blocks merge, this is the highest index int mMaxDeclBlockId; // If blocks merge, this is the highest index
bool mIsLooped; bool mIsLooped;
bool mHasFakeBr;
BeVTrackingList* mSuccLiveness; BeVTrackingList* mSuccLiveness;
BeVTrackingList* mSuccVRegsInitialized; BeVTrackingList* mSuccVRegsInitialized;
BeVTrackingList* mPredVRegsInitialized; BeVTrackingList* mPredVRegsInitialized;
@ -672,6 +673,7 @@ public:
{ {
mLabelIdx = -1; mLabelIdx = -1;
mIsLooped = false; mIsLooped = false;
mHasFakeBr = false;
mBlockIdx = -1; mBlockIdx = -1;
mMaxDeclBlockId = -1; mMaxDeclBlockId = -1;
mSuccLiveness = NULL; mSuccLiveness = NULL;