We have logic in there to emit a default debugging label at the beginning of a
[oota-llvm.git] / utils / TableGen / AsmWriterEmitter.cpp
index 3b66b94525c6226ac4a534c1ca5929a8e3695e96..06495d883414e0003f24fb80e723c59cbedbbc9d 100644 (file)
@@ -640,16 +640,19 @@ void AsmWriterEmitter::run(std::ostream &O) {
   }
   O << "\";\n\n";
 
-  O << "  {\n"
+  O << "  if (TAI->doesSupportDebugInformation() &&\n"
+    << "      DW->ShouldEmitDwarfDebug()) {\n"
     << "    const MachineFunction *MF = MI->getParent()->getParent();\n"
-    << "    static DebugLoc PrevDL = DebugLoc::getUnknownLoc();\n"
     << "    DebugLoc CurDL = MI->getDebugLoc();\n\n"
-    << "    if (!CurDL.isUnknown() && PrevDL != CurDL) {\n"
-    << "      DebugLocTuple DLT = MF->getDebugLocTuple(CurDL);\n"
-    << "      printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src));\n"
-    << "    }\n\n"
-    << "    PrevDL = CurDL;\n"
-    << "  }\n";
+    << "    if (!CurDL.isUnknown()) {\n"
+    << "      static DebugLocTuple PrevDLT(~0U, ~0U, ~0U);\n"
+    << "      DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n"
+    << "      if (PrevDLT.Src != ~0U && PrevDLT != CurDLT)\n"
+    << "        printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n"
+    << "                                        CurDLT.Src));\n\n"
+    << "      PrevDLT = CurDLT;\n"
+    << "    }\n"
+    << "  }\n\n";
 
   O << "  if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n"
     << "    O << \"\\t\";\n"