<< " case ISD::AssertZext:\n"
<< " return Select(N->getOperand(0));\n";
-
+ // Group the patterns by their top-level opcodes.
+ std::map<Record*, std::vector<PatternToMatch*> > PatternsByOpcode;
+ for (unsigned i = 0, e = PatternsToMatch.size(); i != e; ++i)
+ PatternsByOpcode[PatternsToMatch[i].first->getOperator()]
+ .push_back(&PatternsToMatch[i]);
+
+ for (std::map<Record*, std::vector<PatternToMatch*> >::iterator
+ PBOI = PatternsByOpcode.begin(), E = PatternsByOpcode.end(); PBOI != E;
+ ++PBOI) {
+ const SDNodeInfo &OpcodeInfo = getSDNodeInfo(PBOI->first);
+ std::vector<PatternToMatch*> &Patterns = PBOI->second;
+
+ OS << " case " << OpcodeInfo.getEnumName() << ":\n";
+
+ OS << " break;\n";
+ }
+
OS << " } // end of big switch.\n\n"
<< " std::cerr << \"Cannot yet select: \";\n"
<< " N->dump();\n"
/// PatternsToMatch - All of the things we are matching on the DAG. The first
/// value is the pattern to match, the second pattern is the result to
/// emit.
- std::vector<std::pair<TreePatternNode*, TreePatternNode*> > PatternsToMatch;
+ typedef std::pair<TreePatternNode*, TreePatternNode*> PatternToMatch;
+ std::vector<PatternToMatch> PatternsToMatch;
public:
DAGISelEmitter(RecordKeeper &R) : Records(R) {}