本文整理汇总了C++中PBB::getOutEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ PBB::getOutEdges方法的具体用法?C++ PBB::getOutEdges怎么用?C++ PBB::getOutEdges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PBB
的用法示例。
在下文中一共展示了PBB::getOutEdges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeDF
void DataFlow::computeDF(int n) {
std::set<int> S;
/* THis loop computes DF_local[n] */
// for each node y in succ(n)
PBB bb = BBs[n];
std::vector<PBB>& outEdges = bb->getOutEdges();
std::vector<PBB>::iterator it;
for (it = outEdges.begin(); it != outEdges.end(); it++) {
int y = indices[*it];
if (idom[y] != n)
S.insert(y);
}
// for each child c of n in the dominator tree
// Note: this is a linear search!
int sz = idom.size(); // ? Was ancestor.size()
for (int c = 0; c < sz; ++c) {
if (idom[c] != n) continue;
computeDF(c);
/* This loop computes DF_up[c] */
// for each element w of DF[c]
std::set<int>& s = DF[c];
std::set<int>::iterator ww;
for (ww = s.begin(); ww != s.end(); ww++) {
int w = *ww;
// if n does not dominate w, or if n = w
if (n == w || !doesDominate(n, w)) {
S.insert(w);
}
}
}
DF[n] = S;
} // end computeDF
示例2: DFS
void DataFlow::DFS(int p, int n) {
if (dfnum[n] == 0) {
dfnum[n] = N; vertex[N] = n; parent[n] = p;
N++;
// For each successor w of n
PBB bb = BBs[n];
std::vector<PBB>& outEdges = bb->getOutEdges();
std::vector<PBB>::iterator oo;
for (oo = outEdges.begin(); oo != outEdges.end(); oo++) {
DFS(n, indices[*oo]);
}
}
}
示例3: renameBlockVars
//.........这里部分代码省略.........
if (suitable) {
// Push i onto Stacks[a]
// Note: we clone a because otherwise it could be an expression that gets deleted through various
// modifications. This is necessary because we do several passes of this algorithm to sort out the
// memory expressions
Stacks[a->clone()].push(S);
// Replace definition of a with definition of a_i in S (we don't do this)
}
// FIXME: MVE: do we need this awful hack?
if (a->getOper() == opLocal) {
Exp *a1 = S->getProc()->expFromSymbol(((Const*)a->getSubExp1())->getStr());
assert(a1);
a = a1;
// Stacks already has a definition for a (as just the bare local)
if (suitable) {
Stacks[a->clone()].push(S);
}
}
}
// Special processing for define-alls (presently, only childless calls).
// But note that only everythings at the current memory level are defined!
if (S->isCall() && ((CallStatement*)S)->isChildless() && !Boomerang::get()->assumeABI) {
// S is a childless call (and we're not assuming ABI compliance)
Stacks[defineAll]; // Ensure that there is an entry for defineAll
std::map<Exp*, std::stack<Statement*>, lessExpStar>::iterator dd;
for (dd = Stacks.begin(); dd != Stacks.end(); ++dd) {
// if (dd->first->isMemDepth(memDepth))
dd->second.push(S); // Add a definition for all vars
}
}
}
// For each successor Y of block n
std::vector<PBB>& outEdges = bb->getOutEdges();
unsigned numSucc = outEdges.size();
for (unsigned succ = 0; succ < numSucc; succ++) {
PBB Ybb = outEdges[succ];
// Suppose n is the jth predecessor of Y
int j = Ybb->whichPred(bb);
// For each phi-function in Y
Statement* S;
for (S = Ybb->getFirstStmt(rit, sit); S; S = Ybb->getNextStmt(rit, sit)) {
PhiAssign* pa = dynamic_cast<PhiAssign*>(S);
// if S is not a phi function, then quit the loop (no more phi's)
// Wrong: do not quit the loop: there's an optimisation that turns a PhiAssign into an ordinary Assign.
// So continue, not break.
if (!pa) continue;
// Suppose the jth operand of the phi is a
// For now, just get the LHS
Exp* a = pa->getLeft();
// Only consider variables that can be renamed
if (!canRename(a, proc)) continue;
Statement* def;
if (STACKS_EMPTY(a))
def = NULL; // No reaching definition
else
def = Stacks[a].top();
// "Replace jth operand with a_i"
pa->putAt(j, def, a);
}
}
// For each child X of n
// Note: linear search!
unsigned numBB = proc->getCFG()->getNumBBs();
for (unsigned X=0; X < numBB; X++) {