add infrastructure to support forming selectnodeto. Not used yet
[oota-llvm.git] / utils / TableGen / DAGISelMatcherEmitter.cpp
index d2eab2741cbc31f78bb90d2473abb4b3306469a1..84e33f39235e68783cb6dcf85344bc9641454eba 100644 (file)
@@ -204,6 +204,12 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
       assert(ChildSize != 0 && "Should not have a zero-sized child!");
     
       CurrentIdx += EmitVBRValue(ChildSize, OS);
+      OS << "/*->" << CurrentIdx+ChildSize << "*/";
+      
+      if (i == 0)
+        OS.PadToColumn(CommentIndent) << "// " << SM->getNumChildren()
+          << " children in Scope";
+      
       OS << '\n' << TmpBuf.str();
       CurrentIdx += ChildSize;
     }
@@ -263,16 +269,16 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
 
   case Matcher::CheckOpcode:
     OS << "OPC_CheckOpcode, "
-       << cast<CheckOpcodeMatcher>(N)->getOpcodeName() << ",\n";
+       << cast<CheckOpcodeMatcher>(N)->getOpcode().getEnumName() << ",\n";
     return 2;
       
   case Matcher::CheckMultiOpcode: {
     const CheckMultiOpcodeMatcher *CMO = cast<CheckMultiOpcodeMatcher>(N);
-    OS << "OPC_CheckMultiOpcode, " << CMO->getNumOpcodeNames() << ", ";
-    for (unsigned i = 0, e = CMO->getNumOpcodeNames(); i != e; ++i)
-      OS << CMO->getOpcodeName(i) << ", ";
+    OS << "OPC_CheckMultiOpcode, " << CMO->getNumOpcodes() << ", ";
+    for (unsigned i = 0, e = CMO->getNumOpcodes(); i != e; ++i)
+      OS << CMO->getOpcode(i).getEnumName() << ", ";
     OS << '\n';
-    return 2 + CMO->getNumOpcodeNames();
+    return 2 + CMO->getNumOpcodes();
   }
       
   case Matcher::CheckType:
@@ -383,9 +389,11 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
     return 3;
   }
       
-  case Matcher::EmitNode: {
-    const EmitNodeMatcher *EN = cast<EmitNodeMatcher>(N);
-    OS << "OPC_EmitNode, TARGET_OPCODE(" << EN->getOpcodeName() << "), 0";
+  case Matcher::EmitNode:
+  case Matcher::SelectNodeTo: {
+    const EmitNodeMatcherCommon *EN = cast<EmitNodeMatcherCommon>(N);
+    OS << (EN->isSelectNodeTo() ? "OPC_EmitNode" : "OPC_SelectNodeTo");
+    OS << ", TARGET_OPCODE(" << EN->getOpcodeName() << "), 0";
     
     if (EN->hasChain())   OS << "|OPFL_Chain";
     if (EN->hasFlag())    OS << "|OPFL_Flag";
@@ -558,6 +566,7 @@ void MatcherTableEmitter::EmitHistogram(formatted_raw_ostream &OS) {
     case Matcher::EmitMergeInputChains: OS << "OPC_EmitMergeInputChains"; break;
     case Matcher::EmitCopyToReg: OS << "OPC_EmitCopyToReg"; break;
     case Matcher::EmitNode: OS << "OPC_EmitNode"; break;
+    case Matcher::SelectNodeTo: OS << "OPC_SelectNodeTo"; break;
     case Matcher::EmitNodeXForm: OS << "OPC_EmitNodeXForm"; break;
     case Matcher::MarkFlagResults: OS << "OPC_MarkFlagResults"; break;
     case Matcher::CompleteMatch: OS << "OPC_CompleteMatch"; break;