[llvm] r287686 - Restructure DwarfDebug::beginInstruction(). [NFC]

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 11:46:52 PST 2016


Author: probinson
Date: Tue Nov 22 13:46:51 2016
New Revision: 287686

URL: http://llvm.org/viewvc/llvm-project?rev=287686&view=rev
Log:
Restructure DwarfDebug::beginInstruction(). [NFC]
Will help a pending patch.

Differential Revision: http://reviews.llvm.org/D26982

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=287686&r1=287685&r2=287686&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Nov 22 13:46:51 2016
@@ -1007,29 +1007,34 @@ void DwarfDebug::beginInstruction(const
   assert(CurMI);
 
   // Check if source location changes, but ignore DBG_VALUE locations.
-  if (!MI->isDebugValue()) {
-    const DebugLoc &DL = MI->getDebugLoc();
-    if (DL != PrevInstLoc) {
-      if (DL) {
-        unsigned Flags = 0;
-        PrevInstLoc = DL;
-        if (DL == PrologEndLoc) {
-          Flags |= DWARF2_FLAG_PROLOGUE_END;
-          PrologEndLoc = DebugLoc();
-          Flags |= DWARF2_FLAG_IS_STMT;
-        }
-        if (DL.getLine() !=
-            Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine())
-          Flags |= DWARF2_FLAG_IS_STMT;
+  if (MI->isDebugValue())
+    return;
+  const DebugLoc &DL = MI->getDebugLoc();
+  if (DL == PrevInstLoc)
+    return;
 
-        const MDNode *Scope = DL.getScope();
-        recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
-      } else if (UnknownLocations) {
-        PrevInstLoc = DL;
-        recordSourceLine(0, 0, nullptr, 0);
-      }
+  if (!DL) {
+    // We have an unspecified location, which might want to be line 0.
+    if (UnknownLocations) {
+      PrevInstLoc = DL;
+      recordSourceLine(0, 0, nullptr, 0);
     }
+    return;
   }
+
+  // We have a new, explicit location.
+  unsigned Flags = 0;
+  PrevInstLoc = DL;
+  if (DL == PrologEndLoc) {
+    Flags |= DWARF2_FLAG_PROLOGUE_END | DWARF2_FLAG_IS_STMT;
+    PrologEndLoc = DebugLoc();
+  }
+  if (DL.getLine() !=
+      Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine())
+    Flags |= DWARF2_FLAG_IS_STMT;
+
+  const MDNode *Scope = DL.getScope();
+  recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags);
 }
 
 static DebugLoc findPrologueEndLoc(const MachineFunction *MF) {




More information about the llvm-commits mailing list