[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp DAGISelEmitter.h
Chris Lattner
lattner at cs.uiuc.edu
Fri Sep 23 12:36:27 PDT 2005
Changes in directory llvm/utils/TableGen:
DAGISelEmitter.cpp updated: 1.33 -> 1.34
DAGISelEmitter.h updated: 1.20 -> 1.21
---
Log message:
start filling in the switch stmt
---
Diffs of the changes: (+19 -2)
DAGISelEmitter.cpp | 18 +++++++++++++++++-
DAGISelEmitter.h | 3 ++-
2 files changed, 19 insertions(+), 2 deletions(-)
Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.33 llvm/utils/TableGen/DAGISelEmitter.cpp:1.34
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.33 Thu Sep 15 19:29:46 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Sep 23 14:36:15 2005
@@ -1001,8 +1001,24 @@
<< " 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"
Index: llvm/utils/TableGen/DAGISelEmitter.h
diff -u llvm/utils/TableGen/DAGISelEmitter.h:1.20 llvm/utils/TableGen/DAGISelEmitter.h:1.21
--- llvm/utils/TableGen/DAGISelEmitter.h:1.20 Thu Sep 15 17:23:50 2005
+++ llvm/utils/TableGen/DAGISelEmitter.h Fri Sep 23 14:36:15 2005
@@ -325,7 +325,8 @@
/// 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) {}
More information about the llvm-commits
mailing list