[llvm-branch-commits] [llvm-branch] r83605 - in /llvm/branches/Apple/Leela/lib/CodeGen: AsmPrinter/DwarfDebug.cpp AsmPrinter/DwarfDebug.h MachineModuleInfo.cpp

Bill Wendling isanbard at gmail.com
Thu Oct 8 17:27:10 PDT 2009


Author: void
Date: Thu Oct  8 19:27:09 2009
New Revision: 83605

URL: http://llvm.org/viewvc/llvm-project?rev=83605&view=rev
Log:
$ svn merge -c 83563 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r83563 into '.':
U    lib/CodeGen/AsmPrinter/DwarfDebug.h
U    lib/CodeGen/AsmPrinter/DwarfDebug.cpp
$ svn merge -c 83571 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r83571 into '.':
U    lib/CodeGen/MachineModuleInfo.cpp


Modified:
    llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/branches/Apple/Leela/lib/CodeGen/MachineModuleInfo.cpp

Modified: llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=83605&r1=83604&r2=83605&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Oct  8 19:27:09 2009
@@ -1782,17 +1782,23 @@
 }
 
 /// CollectVariableInfo - Populate DbgScope entries with variables' info.
-void DwarfDebug::CollectVariableInfo() {
-  if (!MMI) return;
+bool DwarfDebug::CollectVariableInfo() {
+  if (!MMI) return false;
+  bool ArgsCollected = false;
   MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();
   for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
          VE = VMap.end(); VI != VE; ++VI) {
     MDNode *Var = VI->first;
+    DIVariable DV (Var);
+    if (DV.isNull()) continue;
+    if (DV.getTag() == dwarf::DW_TAG_arg_variable)
+      ArgsCollected = true;
     DILocation VLoc(VI->second.first);
     unsigned VSlot = VI->second.second;
     DbgScope *Scope = getDbgScope(VLoc.getScope().getNode(), NULL);
-    Scope->AddVariable(new DbgVariable(DIVariable(Var), VSlot, false));
+    Scope->AddVariable(new DbgVariable(DV, VSlot, false));
   }
+  return ArgsCollected;
 }
 
 /// SetDbgScopeBeginLabels - Update DbgScope begin labels for the scopes that
@@ -1903,7 +1909,7 @@
 #ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
   if (!ExtractScopeInformation(MF))
     return;
-  CollectVariableInfo();
+  bool ArgsCollected = CollectVariableInfo();
 #endif
 
   // Begin accumulating function debug information.
@@ -1914,14 +1920,19 @@
 
   // Emit label for the implicitly defined dbg.stoppoint at the start of the
   // function.
-  DebugLoc FDL = MF->getDefaultDebugLoc();
-  if (!FDL.isUnknown()) {
-    DebugLocTuple DLT = MF->getDebugLocTuple(FDL);
-    unsigned LabelID = RecordSourceLine(DLT.Line, DLT.Col, DLT.CompileUnit);
-    Asm->printLabel(LabelID);
-    O << '\n';
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+  if (!ArgsCollected) {
+#else
+  if (1) {
+#endif
+    DebugLoc FDL = MF->getDefaultDebugLoc();
+    if (!FDL.isUnknown()) {
+      DebugLocTuple DLT = MF->getDebugLocTuple(FDL);
+      unsigned LabelID = RecordSourceLine(DLT.Line, DLT.Col, DLT.CompileUnit);
+      Asm->printLabel(LabelID);
+      O << '\n';
+    }
   }
-
   if (TimePassesIsEnabled)
     DebugTimer->stopTimer();
 }

Modified: llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=83605&r1=83604&r2=83605&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/AsmPrinter/DwarfDebug.h Thu Oct  8 19:27:09 2009
@@ -556,7 +556,7 @@
   bool ExtractScopeInformation(MachineFunction *MF);
 
   /// CollectVariableInfo - Populate DbgScope entries with variables' info.
-  void CollectVariableInfo();
+  bool CollectVariableInfo();
 
   /// SetDbgScopeBeginLabels - Update DbgScope begin labels for the scopes that
   /// start with this machine instruction.

Modified: llvm/branches/Apple/Leela/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/MachineModuleInfo.cpp?rev=83605&r1=83604&r2=83605&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/MachineModuleInfo.cpp Thu Oct  8 19:27:09 2009
@@ -76,6 +76,9 @@
   FilterEnds.clear();
   CallsEHReturn = 0;
   CallsUnwindInit = 0;
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+  VariableDbgInfo.clear();
+#endif
 }
 
 /// AnalyzeModule - Scan the module for global debug information.





More information about the llvm-branch-commits mailing list