[llvm-commits] [llvm] r96730 - /llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 20 23:16:42 PST 2010
Author: lattner
Date: Sun Feb 21 01:16:41 2010
New Revision: 96730
URL: http://llvm.org/viewvc/llvm-project?rev=96730&view=rev
Log:
emit table indexes before each row so that it is debuggable.
Modified:
llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=96730&r1=96729&r2=96730&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Sun Feb 21 01:16:41 2010
@@ -82,7 +82,7 @@
MatcherTableEmitter() {}
unsigned EmitMatcherList(const MatcherNode *N, unsigned Indent,
- formatted_raw_ostream &OS);
+ unsigned StartIdx, formatted_raw_ostream &OS);
void EmitPredicateFunctions(formatted_raw_ostream &OS);
private:
@@ -324,7 +324,7 @@
/// EmitMatcherList - Emit the bytes for the specified matcher subtree.
unsigned MatcherTableEmitter::
-EmitMatcherList(const MatcherNode *N, unsigned Indent,
+EmitMatcherList(const MatcherNode *N, unsigned Indent, unsigned CurrentIdx,
formatted_raw_ostream &OS) {
unsigned Size = 0;
while (N) {
@@ -339,7 +339,7 @@
raw_svector_ostream OS(TmpBuf);
formatted_raw_ostream FOS(OS);
NextSize = EmitMatcherList(cast<PushMatcherNode>(N)->getNext(),
- Indent+1, FOS);
+ Indent+1, CurrentIdx+2, FOS);
}
if (NextSize > 255) {
@@ -348,17 +348,21 @@
// FIXME: exit(1);
}
+ OS << "/*" << CurrentIdx << "*/";
OS.PadToColumn(Indent*2);
OS << "OPC_Push, " << NextSize << ",\n";
OS << TmpBuf.str();
- Size += 2 + NextSize;
-
+ Size += 2+NextSize;
+ CurrentIdx += 2+NextSize;
N = PMN->getFailure();
continue;
}
- Size += EmitMatcher(N, Indent, OS);
+ OS << "/*" << CurrentIdx << "*/";
+ unsigned MatcherSize = EmitMatcher(N, Indent, OS);
+ Size += MatcherSize;
+ CurrentIdx += MatcherSize;
// If there are other nodes in this list, iterate to them, otherwise we're
// done.
@@ -444,7 +448,7 @@
OS << " // Opcodes are emitted as 2 bytes, TARGET_OPCODE handles this.\n";
OS << " #define TARGET_OPCODE(X) X & 255, unsigned(X) >> 8\n";
OS << " static const unsigned char MatcherTable[] = {\n";
- unsigned TotalSize = MatcherEmitter.EmitMatcherList(Matcher, 2, OS);
+ unsigned TotalSize = MatcherEmitter.EmitMatcherList(Matcher, 5, 0, OS);
OS << " 0\n }; // Total Array size is " << (TotalSize+1) << " bytes\n\n";
OS << " #undef TARGET_OPCODE\n";
OS << " return SelectCodeCommon(N, MatcherTable,sizeof(MatcherTable));\n}\n";
More information about the llvm-commits
mailing list