本文整理汇总了C++中IteratorRef类的典型用法代码示例。如果您正苦于以下问题:C++ IteratorRef类的具体用法?C++ IteratorRef怎么用?C++ IteratorRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IteratorRef类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
}
示例2:
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;
}
示例3: domains
void WebServiceContainer::removeService(
const char* path,
WebService::SecurityType st,
bool cleanup,
const char* domain)
{
// build list of domains to remove service from
DynamicObject domains(NULL);
if(domain != NULL)
{
domains = DynamicObject();
domains->append(domain);
}
else
{
domains = mDefaultDomains;
}
// build a unique list of services to cleanup
UniqueList<WebServiceRef> cleanupList;
// prevent other container access
mContainerLock.lockExclusive();
DynamicObjectIterator di = domains.getIterator();
while(di->hasNext())
{
const char* dom = di->next()->getString();
if(st == WebService::Both || st == WebService::Secure)
{
mHttpConnectionServicer.removeRequestServicer(path, true, dom);
MO_CAT_DEBUG(MO_WS_CAT,
"Removed secure web service: %s%s", dom, path);
}
if(st != WebService::Secure)
{
mHttpConnectionServicer.removeRequestServicer(path, false, dom);
MO_CAT_DEBUG(MO_WS_CAT,
"Removed non-secure web service: %s%s", dom, path);
}
internalRemoveService(path, st, dom, &cleanupList);
}
// permit access again
mContainerLock.unlockExclusive();
// clean up services
if(cleanup)
{
IteratorRef<WebServiceRef> i = cleanupList.getIterator();
while(i->hasNext())
{
WebServiceRef& ws = i->next();
ws->cleanup();
}
}
}
示例4: 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));
}
示例5: 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;
}
示例6: 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());
}
示例7: 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);
}
示例8: 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;
}
示例9:
Graph::~Graph()
{
for (IteratorRef it = safeIteratorDFS(); !it->end(); it->next())
reinterpret_cast<Node *>(it->get())->cut();
}