Add missing newlines at EOF (for clang++).
[oota-llvm.git] / utils / TableGen / DAGISelEmitter.cpp
index dcf64e444c899e548b932292c7118088f02342aa..a901fd0f1285021c23da4ecb70614c6b64c6ccfa 100644 (file)
@@ -114,7 +114,7 @@ static unsigned getResultPatternCost(TreePatternNode *P,
   if (Op->isSubClassOf("Instruction")) {
     Cost++;
     CodeGenInstruction &II = CGP.getTargetInfo().getInstruction(Op->getName());
-    if (II.usesCustomDAGSchedInserter)
+    if (II.usesCustomInserter)
       Cost += 10;
   }
   for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i)
@@ -1292,8 +1292,8 @@ public:
       // possible and it avoids CSE map recalculation for the node's
       // users, however it's tricky to use in a non-root context.
       //
-      // We also don't use if the pattern replacement is being used to
-      // jettison a chain result, since morphing the node in place
+      // We also don't use SelectNodeTo if the pattern replacement is being
+      // used to jettison a chain result, since morphing the node in place
       // would leave users of the chain dangling.
       //
       if (!isRoot || (InputHasChain && !NodeHasChain)) {
@@ -1359,7 +1359,7 @@ public:
       Pat->setTypes(Other->getExtTypes());
       // The top level node type is checked outside of the select function.
       if (!isRoot)
-        emitCheck(Prefix + ".getNode()->getValueType(0) == " +
+        emitCheck(Prefix + ".getValueType() == " +
                   getName(Pat->getTypeNum(0)));
       return true;
     }
@@ -1786,11 +1786,7 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
         }
 
         CallerCode += ");";
-        CalleeCode += ") ";
-        // Prevent emission routines from being inlined to reduce selection
-        // routines stack frame sizes.
-        CalleeCode += "DISABLE_INLINE ";
-        CalleeCode += "{\n";
+        CalleeCode += ") {\n";
 
         for (std::vector<std::string>::const_reverse_iterator
                I = AddedInits.rbegin(), E = AddedInits.rend(); I != E; ++I)
@@ -1811,6 +1807,9 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
         } else {
           EmitFuncNum = EmitFunctions.size();
           EmitFunctions.insert(std::make_pair(CalleeCode, EmitFuncNum));
+          // Prevent emission routines from being inlined to reduce selection
+          // routines stack frame sizes.
+          OS << "DISABLE_INLINE ";
           OS << "SDNode *Emit_" << utostr(EmitFuncNum) << CalleeCode;
         }
 
@@ -1917,40 +1916,6 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
     }
   }
   
-  // Emit boilerplate.
-  OS << "SDNode *Select_INLINEASM(SDValue N) {\n"
-     << "  std::vector<SDValue> Ops(N.getNode()->op_begin(), N.getNode()->op_end());\n"
-     << "  SelectInlineAsmMemoryOperands(Ops);\n\n"
-    
-     << "  std::vector<EVT> VTs;\n"
-     << "  VTs.push_back(MVT::Other);\n"
-     << "  VTs.push_back(MVT::Flag);\n"
-     << "  SDValue New = CurDAG->getNode(ISD::INLINEASM, N.getDebugLoc(), "
-                 "VTs, &Ops[0], Ops.size());\n"
-     << "  return New.getNode();\n"
-     << "}\n\n";
-
-  OS << "SDNode *Select_UNDEF(const SDValue &N) {\n"
-     << "  return CurDAG->SelectNodeTo(N.getNode(), TargetInstrInfo::IMPLICIT_DEF,\n"
-     << "                              N.getValueType());\n"
-     << "}\n\n";
-
-  OS << "SDNode *Select_DBG_LABEL(const SDValue &N) {\n"
-     << "  SDValue Chain = N.getOperand(0);\n"
-     << "  unsigned C = cast<LabelSDNode>(N)->getLabelID();\n"
-     << "  SDValue Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
-     << "  return CurDAG->SelectNodeTo(N.getNode(), TargetInstrInfo::DBG_LABEL,\n"
-     << "                              MVT::Other, Tmp, Chain);\n"
-     << "}\n\n";
-
-  OS << "SDNode *Select_EH_LABEL(const SDValue &N) {\n"
-     << "  SDValue Chain = N.getOperand(0);\n"
-     << "  unsigned C = cast<LabelSDNode>(N)->getLabelID();\n"
-     << "  SDValue Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n"
-     << "  return CurDAG->SelectNodeTo(N.getNode(), TargetInstrInfo::EH_LABEL,\n"
-     << "                              MVT::Other, Tmp, Chain);\n"
-     << "}\n\n";
-
   OS << "// The main instruction selector code.\n"
      << "SDNode *SelectCode(SDValue N) {\n"
      << "  MVT::SimpleValueType NVT = N.getNode()->getValueType(0).getSimpleVT().SimpleTy;\n"
@@ -1967,6 +1932,7 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
      << "  case ISD::TargetConstantPool:\n"
      << "  case ISD::TargetFrameIndex:\n"
      << "  case ISD::TargetExternalSymbol:\n"
+     << "  case ISD::TargetBlockAddress:\n"
      << "  case ISD::TargetJumpTable:\n"
      << "  case ISD::TargetGlobalTLSAddress:\n"
      << "  case ISD::TargetGlobalAddress:\n"
@@ -1981,7 +1947,6 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
      << "    return NULL;\n"
      << "  }\n"
      << "  case ISD::INLINEASM: return Select_INLINEASM(N);\n"
-     << "  case ISD::DBG_LABEL: return Select_DBG_LABEL(N);\n"
      << "  case ISD::EH_LABEL: return Select_EH_LABEL(N);\n"
      << "  case ISD::UNDEF: return Select_UNDEF(N);\n";
 
@@ -2054,22 +2019,6 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) {
      << "  }\n"
      << "  return NULL;\n"
      << "}\n\n";
-
-  OS << "void CannotYetSelect(SDValue N) DISABLE_INLINE {\n"
-     << "  std::string msg;\n"
-     << "  raw_string_ostream Msg(msg);\n"
-     << "  Msg << \"Cannot yet select: \";\n"
-     << "  N.getNode()->print(Msg, CurDAG);\n"
-     << "  llvm_report_error(Msg.str());\n"
-     << "}\n\n";
-
-  OS << "void CannotYetSelectIntrinsic(SDValue N) DISABLE_INLINE {\n"
-     << "  errs() << \"Cannot yet select: \";\n"
-     << "  unsigned iid = cast<ConstantSDNode>(N.getOperand("
-     << "N.getOperand(0).getValueType() == MVT::Other))->getZExtValue();\n"
-     << " llvm_report_error(\"Cannot yet select: intrinsic %\" +\n"
-     << "Intrinsic::getName((Intrinsic::ID)iid));\n"
-     << "}\n\n";
 }
 
 void DAGISelEmitter::run(raw_ostream &OS) {