MCPcopy Create free account
hub / github.com/beefytech/Beef / VRegSetInitialized

Method VRegSetInitialized

IDEHelper/Backend/BeMCContext.cpp:6582–6633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6580}
6581
6582void BeMCContext::VRegSetInitialized(BeMCBlock* mcBlock, BeMCInst* inst, const BeMCOperand& operand, SizedArrayImpl<int>& addVec, SizedArrayImpl<int>& removeVec, bool deepSet, bool doSet)
6583{
6584 if (operand.IsSymbol())
6585 {
6586 auto sym = mCOFFObject->mSymbols[operand.mSymbolIdx];
6587 if (sym->mIsTLS)
6588 {
6589 VRegSetInitialized(mcBlock, inst, BeMCOperand::FromVReg(mTLSVRegIdx), addVec, removeVec, deepSet, doSet);
6590 return;
6591 }
6592 }
6593
6594 if (operand.mKind == BeMCOperandKind_CmpResult)
6595 {
6596 auto& cmpResult = mCmpResults[operand.mCmpResultIdx];
6597 if (cmpResult.mResultVRegIdx != -1)
6598 VRegSetInitialized(mcBlock, inst, BeMCOperand::FromVReg(cmpResult.mResultVRegIdx), addVec, removeVec, deepSet, doSet);
6599 return;
6600 }
6601
6602 if (operand.mKind == BeMCOperandKind_VRegPair)
6603 {
6604 VRegSetInitialized(mcBlock, inst, BeMCOperand::FromVReg(operand.mVRegPair.mVRegIdx0), addVec, removeVec, deepSet, doSet);
6605 VRegSetInitialized(mcBlock, inst, BeMCOperand::FromVReg(operand.mVRegPair.mVRegIdx1), addVec, removeVec, deepSet, doSet);
6606 }
6607
6608 if (!operand.IsVRegAny())
6609 return;
6610
6611 auto vregInfo = mVRegInfo[operand.mVRegIdx];
6612
6613 if (vregInfo->mDefOnFirstUse)
6614 {
6615 int insertIdx = FindSafeInstInsertPos(*mInsertInstIdxRef);
6616 AllocInst(BeMCInstKind_Def, operand, insertIdx);
6617 vregInfo->mDefOnFirstUse = false;
6618 if (insertIdx <= *mInsertInstIdxRef)
6619 (*mInsertInstIdxRef)++;
6620 }
6621
6622 if (vregInfo->mRelTo)
6623 VRegSetInitialized(mcBlock, inst, vregInfo->mRelTo, addVec, removeVec, deepSet, doSet && deepSet);
6624 if (vregInfo->mRelOffset)
6625 VRegSetInitialized(mcBlock, inst, vregInfo->mRelOffset, addVec, removeVec, deepSet, doSet && deepSet);
6626
6627 if (doSet)
6628 {
6629 if (!removeVec.Contains(operand.mVRegIdx))
6630 addVec.push_back(operand.mVRegIdx);
6631 removeVec.push_back(mVRegInitializedContext.GetIdx(operand.mVRegIdx, BeTrackKind_Uninitialized));
6632 }
6633}
6634
6635BeMCInst* BeMCContext::FindSafePreBranchInst(BeMCBlock* mcBlock)
6636{

Callers

nothing calls this directly

Calls 5

IsSymbolMethod · 0.80
IsVRegAnyMethod · 0.80
GetIdxMethod · 0.80
ContainsMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected