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

Method DetectLoops

IDEHelper/Backend/BeMCContext.cpp:1803–1828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1801}
1802
1803void BeMCLoopDetector::DetectLoops(BeMCBlock* mcBlock, BeVTrackingList* predBlocksSeen)
1804{
1805 mMCContext->mDetectLoopIdx++;
1806
1807 auto node = &mNodes[mcBlock->mBlockIdx];
1808 auto blocksSeen = mTrackingContext.Merge(node->mPredBlocksSeen, predBlocksSeen);
1809 if (blocksSeen == node->mPredBlocksSeen)
1810 return;
1811 node->mPredBlocksSeen = blocksSeen;
1812
1813 //SizedArray<int, 2> addVec = { mcBlock->mBlockIdx };
1814 //auto newBlocksSeen = mTrackingContext.Add(blocksSeen, addVec, false);
1815
1816 auto newBlocksSeen = mTrackingContext.Add(blocksSeen, mcBlock->mBlockIdx, false);
1817 if (newBlocksSeen == blocksSeen)
1818 {
1819 // Our ID was already set, so this is a re-entry and thus we are looped
1820 mcBlock->mIsLooped = true;
1821 }
1822 blocksSeen = newBlocksSeen;
1823
1824 for (auto succ : mcBlock->mSuccs)
1825 {
1826 DetectLoops(succ, blocksSeen);
1827 }
1828}
1829
1830void BeMCLoopDetector::DetectLoops()
1831{

Callers

nothing calls this directly

Calls 2

MergeMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected