[llvm-branch-commits] [llvm-branch] r99733 - in /llvm/branches/Apple/Morbo: ./ utils/TableGen/DAGISelMatcherEmitter.cpp

Bill Wendling isanbard at gmail.com
Sat Mar 27 18:38:39 PDT 2010


Author: void
Date: Sat Mar 27 20:38:39 2010
New Revision: 99733

URL: http://llvm.org/viewvc/llvm-project?rev=99733&view=rev
Log:
$ svn merge -c 99722 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r99722 into '.':
U    utils/TableGen/DAGISelMatcherEmitter.cpp


Modified:
    llvm/branches/Apple/Morbo/   (props changed)
    llvm/branches/Apple/Morbo/utils/TableGen/DAGISelMatcherEmitter.cpp

Propchange: llvm/branches/Apple/Morbo/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar 27 20:38:39 2010
@@ -1,2 +1,2 @@
 /llvm/branches/Apple/Hermes:96832,96835,96858,96870,96876,96879
-/llvm/trunk:98602,98604,98612,98615-98616,98675,98686,98743-98744,98773,98778,98780,98810,98835,98839,98845,98855,98862,98881,98920,98977,99032-99033,99043,99223,99263,99282-99284,99306,99319-99321,99324,99336,99378,99418,99423,99429,99455,99463,99465,99469,99484,99490,99493-99494,99537,99544,99570,99575,99629-99630,99671,99692,99695,99697
+/llvm/trunk:98602,98604,98612,98615-98616,98675,98686,98743-98744,98773,98778,98780,98810,98835,98839,98845,98855,98862,98881,98920,98977,99032-99033,99043,99223,99263,99282-99284,99306,99319-99321,99324,99336,99378,99418,99423,99429,99455,99463,99465,99469,99484,99490,99493-99494,99537,99544,99570,99575,99629-99630,99671,99692,99695,99697,99722

Modified: llvm/branches/Apple/Morbo/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=99733&r1=99732&r2=99733&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/branches/Apple/Morbo/utils/TableGen/DAGISelMatcherEmitter.cpp Sat Mar 27 20:38:39 2010
@@ -280,10 +280,14 @@
     // For each case we emit the size, then the opcode, then the matcher.
     for (unsigned i = 0, e = NumCases; i != e; ++i) {
       const Matcher *Child;
-      if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N))
+      unsigned IdxSize;
+      if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N)) {
         Child = SOM->getCaseMatcher(i);
-      else
+        IdxSize = 2;  // size of opcode in table is 2 bytes.
+      } else {
         Child = cast<SwitchTypeMatcher>(N)->getCaseMatcher(i);
+        IdxSize = 1;  // size of type in table is 1 byte.
+      }
       
       // We need to encode the opcode and the offset of the case code before
       // emitting the case code.  Handle this by buffering the output into a
@@ -299,7 +303,8 @@
         TmpBuf.clear();
         raw_svector_ostream OS(TmpBuf);
         formatted_raw_ostream FOS(OS);
-        ChildSize = EmitMatcherList(Child, Indent+1, CurrentIdx+VBRSize+1, FOS);
+        ChildSize = EmitMatcherList(Child, Indent+1, CurrentIdx+VBRSize+IdxSize,
+                                    FOS);
       } while (GetVBRSize(ChildSize) != VBRSize);
       
       assert(ChildSize != 0 && "Should not have a zero-sized child!");
@@ -315,14 +320,13 @@
       CurrentIdx += EmitVBRValue(ChildSize, OS);
       
       OS << ' ';
-      if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N)) {
+      if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N))
         OS << "TARGET_OPCODE(" << SOM->getCaseOpcode(i).getEnumName() << "),";
-        CurrentIdx += 2;
-      } else {
+      else
         OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i)) << ',';
-        ++CurrentIdx;
-      }
-      
+
+      CurrentIdx += IdxSize;
+
       if (!OmitComments)
         OS << "// ->" << CurrentIdx+ChildSize;
       OS << '\n';





More information about the llvm-branch-commits mailing list