本文整理汇总了C++中DagInit::getNodeType方法的典型用法代码示例。如果您正苦于以下问题:C++ DagInit::getNodeType方法的具体用法?C++ DagInit::getNodeType怎么用?C++ DagInit::getNodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DagInit
的用法示例。
在下文中一共展示了DagInit::getNodeType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
//.........这里部分代码省略.........
OS << "void " << Target.getName () << "ISel::generateCode() {\n"
<< " SelectionDAGNode *Root = DAG.getRoot();\n"
<< " assert(Root->getValueType() == MVT::isVoid && "
"\"Root of DAG produces value??\");\n\n"
<< " std::cerr << \"\\n\";\n"
<< " unsigned Cost = Match_Void_void(Root);\n"
<< " if (Cost >= ~0U >> 1) {\n"
<< " std::cerr << \"Match failed!\\n\";\n"
<< " Root->dump();\n"
<< " abort();\n"
<< " }\n\n"
<< " std::cerr << \"Total DAG Cost: \" << Cost << \"\\n\\n\";\n\n"
<< " Reduce_Void_void(Root, 0);\n"
<< "}\n\n"
<< "//===" << std::string(70, '-') << "===//\n"
<< "// Matching methods...\n"
<< "//\n\n";
//===--------------------------------------------------------------------===//
// Emit all of the matcher methods...
//
for (PatternOrganizer::iterator I = ComputableValues.begin(),
E = ComputableValues.end(); I != E; ++I) {
const std::string &SlotName = I->first;
OS << "unsigned " << Target.getName() << "ISel::Match_" << SlotName
<< "(SelectionDAGNode *N) {\n"
<< " assert(N->getValueType() == MVT::"
<< getEnumName((*I->second.begin()).second[0]->getTree()->getType())
<< ");\n" << " // If we already have a cost available for " << SlotName
<< " use it!\n"
<< " if (N->getPatternFor(" << SlotName << "_Slot))\n"
<< " return N->getCostFor(" << SlotName << "_Slot);\n\n"
<< " unsigned Cost;\n"
<< " switch (N->getNodeType()) {\n"
<< " default: Cost = ~0U >> 1; // Match failed\n"
<< " N->setPatternCostFor(" << SlotName << "_Slot, NoMatchPattern, Cost, NumSlots);\n"
<< " break;\n";
for (PatternOrganizer::NodesForSlot::iterator J = I->second.begin(),
E = I->second.end(); J != E; ++J)
if (!J->first->isSubClassOf("Nonterminal"))
OS << " case ISD::" << getNodeName(J->first) << ":\tCost = Match_"
<< SlotName << "_" << getNodeName(J->first) << "(N); break;\n";
OS << " }\n"; // End of the switch statement
// Emit any patterns which have a nonterminal leaf as the RHS. These may
// match multiple root nodes, so they cannot be handled with the switch...
for (PatternOrganizer::NodesForSlot::iterator J = I->second.begin(),
E = I->second.end(); J != E; ++J)
if (J->first->isSubClassOf("Nonterminal")) {
OS << " unsigned " << J->first->getName() << "_Cost = Match_"
<< getNodeName(J->first) << "(N);\n"
<< " if (" << getNodeName(J->first) << "_Cost < Cost) Cost = "
<< getNodeName(J->first) << "_Cost;\n";
}
OS << " return Cost;\n}\n\n";
for (PatternOrganizer::NodesForSlot::iterator J = I->second.begin(),
E = I->second.end(); J != E; ++J) {
Record *Operator = J->first;
bool isNonterm = Operator->isSubClassOf("Nonterminal");
if (!isNonterm) {
OS << "unsigned " << Target.getName() << "ISel::Match_";
if (!isNonterm) OS << SlotName << "_";
OS << getNodeName(Operator) << "(SelectionDAGNode *N) {\n"