[llvm-commits] [llvm] r96833 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h utils/TableGen/DAGISelMatcherEmitter.cpp

Chris Lattner sabre at nondot.org
Mon Feb 22 15:55:39 PST 2010


Author: lattner
Date: Mon Feb 22 17:55:39 2010
New Revision: 96833

URL: http://llvm.org/viewvc/llvm-project?rev=96833&view=rev
Log:
add a new Push2 opcode for targets (like cellspu) which have
ridiculously ginormous patterns and need more than one byte
of displacement for encodings.  This fixes CellSPU/fdiv.ll.
SPU is still doing something else ridiculous though.

Modified:
    llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
    llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=96833&r1=96832&r2=96833&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Mon Feb 22 17:55:39 2010
@@ -201,7 +201,7 @@
 }
 
 enum BuiltinOpcodes {
-  OPC_Push,
+  OPC_Push, OPC_Push2,
   OPC_RecordNode,
   OPC_RecordMemRef,
   OPC_CaptureFlagInput,
@@ -359,6 +359,19 @@
       MatchScopes.push_back(NewEntry);
       continue;
     }
+    case OPC_Push2: {
+      unsigned NumToSkip = GetInt2(MatcherTable, MatcherIndex);
+      MatchScope NewEntry;
+      NewEntry.FailIndex = MatcherIndex+NumToSkip;
+      NewEntry.NodeStackSize = NodeStack.size();
+      NewEntry.NumRecordedNodes = RecordedNodes.size();
+      NewEntry.NumMatchedMemRefs = MatchedMemRefs.size();
+      NewEntry.InputChain = InputChain;
+      NewEntry.InputFlag = InputFlag;
+      NewEntry.HasChainNodesMatched = !ChainNodesMatched.empty();
+      MatchScopes.push_back(NewEntry);
+      continue;
+    }
     case OPC_RecordNode:
       // Remember this node, it may end up being an operand in the pattern.
       RecordedNodes.push_back(N);

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=96833&r1=96832&r2=96833&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Mon Feb 22 17:55:39 2010
@@ -350,16 +350,29 @@
         NextSize = EmitMatcherList(cast<PushMatcherNode>(N)->getNext(),
                                    Indent+1, CurrentIdx+2, FOS);
       }
-      
+
+      // In the unlikely event that we have something too big to emit with a
+      // one byte offset, regenerate it with a two-byte one.
       if (NextSize > 255) {
-        errs() <<
-          "Tblgen internal error: can't handle predicate this complex yet\n";
-        // FIXME: exit(1);
+        TmpBuf.clear();
+        raw_svector_ostream OS(TmpBuf);
+        formatted_raw_ostream FOS(OS);
+        NextSize = EmitMatcherList(cast<PushMatcherNode>(N)->getNext(),
+                                   Indent+1, CurrentIdx+3, FOS);
+        if (NextSize > 65535) {
+          errs() <<
+            "Tblgen internal error: can't handle pattern this complex yet\n";
+          exit(1);
+        }
       }
       
       OS << "/*" << CurrentIdx << "*/";
       OS.PadToColumn(Indent*2);
-      OS << "OPC_Push, " << NextSize << ",\n";
+      
+      if (NextSize < 256)
+        OS << "OPC_Push, " << NextSize << ",\n";
+      else
+        OS << "OPC_Push2, " << (NextSize&255) << ", " << (NextSize>>8) << ",\n";
       OS << TmpBuf.str();
       
       Size += 2+NextSize;





More information about the llvm-commits mailing list