MCPcopy Create free account
hub / github.com/KasperskyLab/hrtng / GetDominatedClusterHead

Function GetDominatedClusterHead

src/unflat.cpp:1302–1322  ·  view source on GitHub ↗

Find the block that dominates iDispPred, and which is one of the targets of the control flow flattening switch.

Source from the content-addressed store, hash-verified

1300
1301 // Find the block that dominates iDispPred, and which is one of the targets of the control flow flattening switch.
1302 mblock_t *GetDominatedClusterHead(mbl_array_t *mba, int iDispPred, int &iClusterHead)
1303 {
1304 mblock_t *mbClusterHead = NULL;
1305 // Find the block that is targeted by the dispatcher, and that dominates the block we're currently looking at.
1306 // This logic won't work for the first block (since it wasn't targeted by the control
1307 // flow dispatch switch, so it doesn't have an entry in the dominated cluster information), so we special-case it.
1308 if (iDispPred == cfi.iFirst) {
1309 //iClusterHead = cfi.iFirst;
1310 iClusterHead = 1; // to trace back until the start
1311 mbClusterHead = mba->get_mblock(iClusterHead);
1312
1313 } else {
1314 // If it wasn't the first block, look up its cluster head block
1315 iClusterHead = cfi.m_DominatedClusters[iDispPred];
1316 if (iClusterHead < 0) {
1317 return NULL;
1318 }
1319 mbClusterHead = mba->get_mblock(iClusterHead);
1320 }
1321 return mbClusterHead;
1322 }
1323
1324 minsn_t* my_find_def_backwards_hacked(mblock_t* mb, mlist_t& ml, minsn_t* start)
1325 {

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected