本文整理汇总了C++中DSNode::print方法的典型用法代码示例。如果您正苦于以下问题:C++ DSNode::print方法的具体用法?C++ DSNode::print怎么用?C++ DSNode::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DSNode
的用法示例。
在下文中一共展示了DSNode::print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: verify
/// verify - This is the function which checks to make sure that all of the
/// invariants established on the command line are true.
///
void DSGC::verify(const DSGraph* G) {
// Loop over all of the nodes, checking to see if any are collapsed...
if (AbortIfAnyCollapsed) {
for (DSGraph::node_const_iterator I = G->node_begin(), E = G->node_end();
I != E; ++I)
if (I->isNodeCompletelyFolded()) {
cerr << "Node is collapsed: ";
I->print(cerr, G);
abort();
}
}
if (!AbortIfCollapsed.empty() || !CheckFlags.empty() ||
!AbortIfMerged.empty()) {
// Convert from a list to a set, because we don't have cl::set's yet. FIXME
std::set<std::string> AbortIfCollapsedS(AbortIfCollapsed.begin(),
AbortIfCollapsed.end());
std::set<std::string> AbortIfMergedS(AbortIfMerged.begin(),
AbortIfMerged.end());
std::map<std::string, unsigned> CheckFlagsM;
for (cl::list<std::string>::iterator I = CheckFlags.begin(),
E = CheckFlags.end(); I != E; ++I) {
std::string::size_type ColonPos = I->rfind(':');
if (ColonPos == std::string::npos) {
cerr << "Error: '" << *I
<< "' is an invalid value for the --dsgc-check-flags option!\n";
abort();
}
unsigned Flags = 0;
for (unsigned C = ColonPos+1; C != I->size(); ++C)
switch ((*I)[C]) {
case 'S': Flags |= DSFlags::AllocaNode; break;
case 'H': Flags |= DSFlags::HeapNode; break;
case 'G': Flags |= DSFlags::GlobalNode; break;
case 'U': Flags |= DSFlags::UnknownNode; break;
case 'I': Flags |= DSFlags::IncompleteNode; break;
case 'M': Flags |= DSFlags::ModifiedNode; break;
case 'R': Flags |= DSFlags::ReadNode; break;
case 'A': Flags |= DSFlags::ArrayNode; break;
default: cerr << "Invalid DSNode flag!\n"; abort();
}
CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags;
}
// Now we loop over all of the scalars, checking to see if any are collapsed
// that are not supposed to be, or if any are merged together.
const DSGraph::ScalarMapTy &SM = G->getScalarMap();
std::map<DSNode*, std::string> AbortIfMergedNodes;
for (DSGraph::ScalarMapTy::const_iterator I = SM.begin(), E = SM.end();
I != E; ++I)
if (I->first->hasName() && I->second.getNode()) {
const std::string &Name = I->first->getName();
DSNode *N = I->second.getNode();
// Verify it is not collapsed if it is not supposed to be...
if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) {
cerr << "Node for value '%" << Name << "' is collapsed: ";
N->print(cerr, G);
abort();
}
if (CheckFlagsM.count(Name) && CheckFlagsM[Name] != N->getNodeFlags()) {
cerr << "Node flags are not as expected for node: " << Name
<< " (" << CheckFlagsM[Name] << ":" <<N->getNodeFlags()
<< ")\n";
N->print(cerr, G);
abort();
}
// Verify that it is not merged if it is not supposed to be...
if (AbortIfMergedS.count(Name)) {
if (AbortIfMergedNodes.count(N)) {
cerr << "Nodes for values '%" << Name << "' and '%"
<< AbortIfMergedNodes[N] << "' is merged: ";
N->print(cerr, G);
abort();
}
AbortIfMergedNodes[N] = Name;
}
}
}
}