| 11080 | } |
| 11081 | |
| 11082 | void BeMCContext::DoBlockCombine() |
| 11083 | { |
| 11084 | auto masterBlock = mMCBlockAlloc.Alloc(); |
| 11085 | mActiveBlock = masterBlock; |
| 11086 | |
| 11087 | for (auto mcBlock : mBlocks) |
| 11088 | { |
| 11089 | mcBlock->mLabelIdx = mCurLabelIdx++; |
| 11090 | } |
| 11091 | |
| 11092 | for (auto mcBlock : mBlocks) |
| 11093 | { |
| 11094 | auto inst = AllocInst(); |
| 11095 | inst->mKind = BeMCInstKind_Label; |
| 11096 | inst->mArg0.mKind = BeMCOperandKind_Label; |
| 11097 | inst->mArg0.mLabelIdx = mcBlock->mLabelIdx; |
| 11098 | |
| 11099 | for (auto blockInst : mcBlock->mInstructions) |
| 11100 | { |
| 11101 | if (inst->mDbgLoc == NULL) |
| 11102 | inst->mDbgLoc = blockInst->mDbgLoc; |
| 11103 | |
| 11104 | auto operands = { &blockInst->mArg0, &blockInst->mArg1 }; |
| 11105 | for (auto op : operands) |
| 11106 | { |
| 11107 | if (op->mKind == BeMCOperandKind_Block) |
| 11108 | { |
| 11109 | op->mKind = BeMCOperandKind_Label; |
| 11110 | op->mLabelIdx = op->mBlock->mLabelIdx; |
| 11111 | } |
| 11112 | } |
| 11113 | masterBlock->mInstructions.push_back(blockInst); |
| 11114 | } |
| 11115 | } |
| 11116 | |
| 11117 | mBlocks.Clear(); |
| 11118 | mBlocks.push_back(masterBlock); |
| 11119 | } |
| 11120 | |
| 11121 | bool BeMCContext::DoJumpRemovePass() |
| 11122 | { |