本文整理汇总了C++中IteratorRef::end方法的典型用法代码示例。如果您正苦于以下问题:C++ IteratorRef::end方法的具体用法?C++ IteratorRef::end怎么用?C++ IteratorRef::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IteratorRef
的用法示例。
在下文中一共展示了IteratorRef::end方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
Pass::doRun(Function *func, bool ordered, bool skipPhi)
{
IteratorRef bbIter;
BasicBlock *bb;
Instruction *insn, *next;
this->func = func;
if (!visit(func))
return false;
bbIter = ordered ? func->cfg.iteratorCFG() : func->cfg.iteratorDFS();
for (; !bbIter->end(); bbIter->next()) {
bb = BasicBlock::get(reinterpret_cast<Graph::Node *>(bbIter->get()));
if (!visit(bb))
break;
for (insn = skipPhi ? bb->getEntry() : bb->getFirst(); insn != NULL;
insn = next) {
next = insn->next;
if (!visit(insn))
break;
}
}
return !err;
}
示例2: findDominanceFrontiers
void DominatorTree::findDominanceFrontiers()
{
BasicBlock *bb;
for (IteratorRef dtIt = iteratorDFS(false); !dtIt->end(); dtIt->next()) {
EdgeIterator succIt, chldIt;
bb = BasicBlock::get(reinterpret_cast<Node *>(dtIt->get()));
bb->getDF().clear();
for (succIt = bb->cfg.outgoing(); !succIt.end(); succIt.next()) {
BasicBlock *dfLocal = BasicBlock::get(succIt.getNode());
if (dfLocal->idom() != bb)
bb->getDF().insert(dfLocal);
}
for (chldIt = bb->dom.outgoing(); !chldIt.end(); chldIt.next()) {
BasicBlock *cb = BasicBlock::get(chldIt.getNode());
DLList::Iterator dfIt = cb->getDF().iterator();
for (; !dfIt.end(); dfIt.next()) {
BasicBlock *dfUp = BasicBlock::get(dfIt);
if (dfUp->idom() != bb)
bb->getDF().insert(dfUp);
}
}
}
}
示例3: prepareEmission
void
CodeEmitter::prepareEmission(Function *func)
{
func->bbCount = 0;
func->bbArray = new BasicBlock * [func->cfg.getSize()];
BasicBlock::get(func->cfg.getRoot())->binPos = func->binPos;
for (IteratorRef it = func->cfg.iteratorCFG(); !it->end(); it->next())
prepareEmission(BasicBlock::get(*it));
}
示例4: classifyEdges
void Graph::classifyEdges()
{
int seq;
for (IteratorRef it = iteratorDFS(true); !it->end(); it->next()) {
Node *node = reinterpret_cast<Node *>(it->get());
node->visit(0);
node->tag = 0;
}
classifyDFS(root, (seq = 0));
sequence = seq;
}
示例5: CFGIterator
CFGIterator(Graph *graph)
{
nodes = new Graph::Node * [graph->getSize() + 1];
count = 0;
pos = 0;
nodes[graph->getSize()] = 0;
// TODO: argh, use graph->sequence instead of tag and just raise it by > 1
for (IteratorRef it = graph->iteratorDFS(); !it->end(); it->next())
reinterpret_cast<Graph::Node *>(it->get())->tag = 0;
if (graph->getRoot())
search(graph->getRoot(), graph->nextSequence());
}
示例6: fopen
void
Function::printCFGraph(const char *filePath)
{
FILE *out = fopen(filePath, "a");
if (!out) {
ERROR("failed to open file: %s\n", filePath);
return;
}
INFO("printing control flow graph to: %s\n", filePath);
fprintf(out, "digraph G {\n");
for (IteratorRef it = cfg.iteratorDFS(); !it->end(); it->next()) {
BasicBlock *bb = BasicBlock::get(
reinterpret_cast<Graph::Node *>(it->get()));
int idA = bb->getId();
for (Graph::EdgeIterator ei = bb->cfg.outgoing(); !ei.end(); ei.next()) {
int idB = BasicBlock::get(ei.getNode())->getId();
switch (ei.getType()) {
case Graph::Edge::TREE:
fprintf(out, "\t%i -> %i;\n", idA, idB);
break;
case Graph::Edge::FORWARD:
fprintf(out, "\t%i -> %i [color=green];\n", idA, idB);
break;
case Graph::Edge::CROSS:
fprintf(out, "\t%i -> %i [color=red];\n", idA, idB);
break;
case Graph::Edge::BACK:
fprintf(out, "\t%i -> %i;\n", idA, idB);
break;
case Graph::Edge::DUMMY:
fprintf(out, "\t%i -> %i [style=dotted];\n", idA, idB);
break;
default:
assert(0);
break;
}
}
}
fprintf(out, "}\n");
fclose(out);
}
示例7: cfg
DominatorTree::DominatorTree(Graph *cfgraph) : cfg(cfgraph),
count(cfg->getSize())
{
int i = 0;
vert = new Node * [count];
data = new int[5 * count];
for (IteratorRef it = cfg->iteratorDFS(true); !it->end(); it->next(), ++i) {
vert[i] = reinterpret_cast<Node *>(it->get());
vert[i]->tag = i;
LABEL(i) = i;
SEMI(i) = ANCESTOR(i) = -1;
}
assert(i == count);
build();
delete[] vert;
delete[] data;
}
示例8:
Graph::~Graph()
{
for (IteratorRef it = safeIteratorDFS(); !it->end(); it->next())
reinterpret_cast<Node *>(it->get())->cut();
}