diff options
author | Chris Lattner <sabre@nondot.org> | 2005-09-23 19:36:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-09-23 19:36:15 +0000 |
commit | 813033248c0128ac6d378eb8131885b7a651930e (patch) | |
tree | 6325a9a683272aaf268afe46f25e4546edc5f537 /utils | |
parent | b60e0815dfe7169255a92957ca8fc96ed866b85e (diff) | |
download | external_llvm-813033248c0128ac6d378eb8131885b7a651930e.zip external_llvm-813033248c0128ac6d378eb8131885b7a651930e.tar.gz external_llvm-813033248c0128ac6d378eb8131885b7a651930e.tar.bz2 |
start filling in the switch stmt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 18 | ||||
-rw-r--r-- | utils/TableGen/DAGISelEmitter.h | 3 |
2 files changed, 19 insertions, 2 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index d0aac0b..a5ec845 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -1001,8 +1001,24 @@ void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { << " 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" diff --git a/utils/TableGen/DAGISelEmitter.h b/utils/TableGen/DAGISelEmitter.h index de223b1..b2f5db1 100644 --- a/utils/TableGen/DAGISelEmitter.h +++ b/utils/TableGen/DAGISelEmitter.h @@ -325,7 +325,8 @@ class DAGISelEmitter : public TableGenBackend { /// 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) {} |