start filling in the switch stmt

llvm-svn: 23412
This commit is contained in:
Chris Lattner 2005-09-23 19:36:15 +00:00
parent 499e33646e
commit abb430bad2
2 changed files with 19 additions and 2 deletions

View File

@ -1001,8 +1001,24 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) {
<< " case ISD::AssertZext:\n" << " case ISD::AssertZext:\n"
<< " return Select(N->getOperand(0));\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" OS << " } // end of big switch.\n\n"
<< " std::cerr << \"Cannot yet select: \";\n" << " std::cerr << \"Cannot yet select: \";\n"
<< " N->dump();\n" << " N->dump();\n"

View File

@ -325,7 +325,8 @@ class DAGISelEmitter : public TableGenBackend {
/// PatternsToMatch - All of the things we are matching on the DAG. The first /// 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 /// value is the pattern to match, the second pattern is the result to
/// emit. /// emit.
std::vector<std::pair<TreePatternNode*, TreePatternNode*> > PatternsToMatch; typedef std::pair<TreePatternNode*, TreePatternNode*> PatternToMatch;
std::vector<PatternToMatch> PatternsToMatch;
public: public:
DAGISelEmitter(RecordKeeper &R) : Records(R) {} DAGISelEmitter(RecordKeeper &R) : Records(R) {}