Add support to handle debug info attached to an instruction.
authorDevang Patel <dpatel@apple.com>
Tue, 6 Oct 2009 18:37:31 +0000 (18:37 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 6 Oct 2009 18:37:31 +0000 (18:37 +0000)
This is not yet enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83400 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DwarfWriter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfWriter.cpp
lib/CodeGen/SelectionDAG/FastISel.cpp

index 46be8d2c59afd0554f9218fb540652604397bd1c..e7a2f664eb4c5dc1a644222577311d17cfa74f1c 100644 (file)
@@ -110,9 +110,10 @@ public:
 
   /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
   unsigned RecordInlinedFnEnd(DISubprogram SP);
+  void SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L);
+  void SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L);
 };
 
-
 } // end llvm namespace
 
 #endif
index f149f10f3b45e5cbb63791c6d14f7090f9de7934..3a7fe0e24e8aacb49070212b332e0a8194d36b03 100644 (file)
@@ -1363,12 +1363,18 @@ void AsmPrinter::processDebugLoc(const MachineInstr *MI,
       DebugLocTuple CurDLT = MF->getDebugLocTuple(DL);
       if (BeforePrintingInsn) {
         if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) {
-          printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col, 
-                                          CurDLT.CompileUnit));
-          O << '\n';
+         unsigned L = DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
+                                           CurDLT.CompileUnit);
+          printLabel(L);
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+          DW->SetDbgScopeBeginLabels(MI, L);
+#endif
+        } else {
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+          DW->SetDbgScopeEndLabels(MI, 0);
+#endif
         }
-      }
-
+      } 
       PrevDLT = CurDLT;
     }
   }
index cd4fd768ba9878946778ced16514c5bd78d80b46..5b3f3cee39ffb501f06c0f96eac08d1b5994f0bc 100644 (file)
@@ -1322,7 +1322,6 @@ DbgScope *DwarfDebug::getDbgScope(MDNode *N, const MachineInstr *MI) {
     Parent->AddScope(Slot);
   else
     // First function is top level function.
-    // FIXME - Dpatel - What is FunctionDbgScope ?
     if (!FunctionDbgScope)
       FunctionDbgScope = Slot;
 
@@ -1901,6 +1900,12 @@ void DwarfDebug::BeginFunction(MachineFunction *MF) {
   if (TimePassesIsEnabled)
     DebugTimer->startTimer();
 
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+  if (!ExtractScopeInformation(MF))
+    return;
+  CollectVariableInfo();
+#endif
+
   // Begin accumulating function debug information.
   MMI->BeginFunction(MF);
 
index bebf8e079975f4b4a653ab19c183bcd1445708b4..0638d35685490eb065e565b0ef68c4fb8a42678f 100644 (file)
@@ -119,3 +119,9 @@ unsigned DwarfWriter::RecordInlinedFnEnd(DISubprogram SP) {
   return DD->RecordInlinedFnEnd(SP);
 }
 
+void DwarfWriter::SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L) {
+  DD->SetDbgScopeEndLabels(MI, L);
+}
+void DwarfWriter::SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L) {
+  DD->SetDbgScopeBeginLabels(MI, L);
+}
index 0bec2cf9b1f934d572a390bdad1626e239289277..bccff160ce9a5865b7ad2a081bba63060c92a48d 100644 (file)
@@ -425,7 +425,9 @@ bool FastISel::SelectCall(User *I) {
       if (AllocaLocation)
         MMI->setVariableDbgInfo(DI->getVariable(), AllocaLocation, FI);
     }
+#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
     DW->RecordVariable(DI->getVariable(), FI);
+#endif
     return true;
   }
   case Intrinsic::eh_exception: {