本文整理汇总了C++中PBB::getLowAddr方法的典型用法代码示例。如果您正苦于以下问题:C++ PBB::getLowAddr方法的具体用法?C++ PBB::getLowAddr怎么用?C++ PBB::getLowAddr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBB
的用法示例。
在下文中一共展示了PBB::getLowAddr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSemiDominators
void CfgTest::testSemiDominators ()
{
BinaryFileFactory bff;
BinaryFile* pBF = bff.Load(SEMI_PENTIUM);
CPPUNIT_ASSERT(pBF != 0);
Prog* prog = new Prog;
FrontEnd* pFE = new PentiumFrontEnd(pBF, prog, &bff);
Type::clearNamedTypes();
prog->setFrontEnd(pFE);
pFE->decode(prog);
bool gotMain;
ADDRESS addr = pFE->getMainEntryPoint(gotMain);
CPPUNIT_ASSERT (addr != NO_ADDRESS);
UserProc* pProc = (UserProc*) prog->getProc(0);
Cfg* cfg = pProc->getCFG();
DataFlow* df = pProc->getDataFlow();
df->dominators(cfg);
// Find BB "L (6)" (as per Appel, Figure 19.8).
BB_IT it;
PBB bb = cfg->getFirstBB(it);
while (bb && bb->getLowAddr() != SEMI_L)
{
bb = cfg->getNextBB(it);
}
CPPUNIT_ASSERT(bb);
int nL = df->pbbToNode(bb);
// The dominator for L should be B, where the semi dominator is D
// (book says F)
unsigned actual_dom = (unsigned)df->nodeToBB(df->getIdom(nL))->getLowAddr();
unsigned actual_semi = (unsigned)df->nodeToBB(df->getSemi(nL))->getLowAddr();
CPPUNIT_ASSERT_EQUAL((unsigned)SEMI_B, actual_dom);
CPPUNIT_ASSERT_EQUAL((unsigned)SEMI_D, actual_semi);
// Check the final dominator frontier as well; should be M and B
std::ostringstream expected, actual;
//expected << std::hex << SEMI_M << " " << SEMI_B << " ";
expected << std::hex << SEMI_B << " " << SEMI_M << " ";
std::set<int>::iterator ii;
std::set<int>& DFset = df->getDF(nL);
for (ii=DFset.begin(); ii != DFset.end(); ii++)
actual << std::hex << (unsigned)df->nodeToBB(*ii)->getLowAddr() << " ";
CPPUNIT_ASSERT_EQUAL(expected.str(), actual.str());
delete pFE;
}
示例2: testDominators
void CfgTest::testDominators ()
{
BinaryFileFactory bff;
BinaryFile *pBF = bff.Load(FRONTIER_PENTIUM);
CPPUNIT_ASSERT(pBF != 0);
Prog* prog = new Prog;
FrontEnd *pFE = new PentiumFrontEnd(pBF, prog, &bff);
Type::clearNamedTypes();
prog->setFrontEnd(pFE);
pFE->decode(prog);
bool gotMain;
ADDRESS addr = pFE->getMainEntryPoint(gotMain);
CPPUNIT_ASSERT (addr != NO_ADDRESS);
UserProc* pProc = (UserProc*) prog->getProc(0);
Cfg* cfg = pProc->getCFG();
DataFlow* df = pProc->getDataFlow();
df->dominators(cfg);
// Find BB "5" (as per Appel, Figure 19.5).
BB_IT it;
PBB bb = cfg->getFirstBB(it);
while (bb && bb->getLowAddr() != FRONTIER_FIVE)
{
bb = cfg->getNextBB(it);
}
CPPUNIT_ASSERT(bb);
std::ostringstream expected, actual;
//expected << std::hex << FRONTIER_FIVE << " " << FRONTIER_THIRTEEN << " " << FRONTIER_TWELVE << " " <<
// FRONTIER_FOUR << " ";
expected << std::hex << FRONTIER_THIRTEEN << " " << FRONTIER_FOUR << " " << FRONTIER_TWELVE << " " <<
FRONTIER_FIVE << " ";
int n5 = df->pbbToNode(bb);
std::set<int>::iterator ii;
std::set<int>& DFset = df->getDF(n5);
for (ii=DFset.begin(); ii != DFset.end(); ii++)
actual << std::hex << (unsigned)df->nodeToBB(*ii)->getLowAddr() << " ";
CPPUNIT_ASSERT_EQUAL(expected.str(), actual.str());
pBF->UnLoad();
delete pFE;
}