[llvm-commits] [llvm] r104705 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Devang Patel dpatel at apple.com
Wed May 26 10:29:32 PDT 2010


Author: dpatel
Date: Wed May 26 12:29:32 2010
New Revision: 104705

URL: http://llvm.org/viewvc/llvm-project?rev=104705&view=rev
Log:
Do not construct location list backword!

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=104705&r1=104704&r2=104705&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed May 26 12:29:32 2010
@@ -2215,22 +2215,26 @@
     RegVar->setDotDebugLocOffset(DotDebugLocEntries.size());
     if (DotDebugLocEntries.empty())
       DotDebugLocEntries.push_back(DotDebugLocEntry());
-    const MachineInstr *Current = MultipleValues.back(); 
-    MultipleValues.pop_back();
-    while (!MultipleValues.empty()) {
-      const MachineInstr *Next = MultipleValues.back();
-      MultipleValues.pop_back();
-      DbgValueStartMap[Next] = RegVar;
+    const MachineInstr *Begin = NULL;
+    const MachineInstr *End = NULL;
+    for (SmallVector<const MachineInstr *, 4>::iterator 
+           MVI = MultipleValues.begin(), MVE = MultipleValues.end(); MVI != MVE; ++MVI) {
+      if (!Begin) {
+        Begin = *MVI;
+        continue;
+      } 
+      End = *MVI;
+      DbgValueStartMap[End] = RegVar;
       MachineLocation MLoc;
-      MLoc.set(Current->getOperand(0).getReg(), 0);
-      const MCSymbol *FLabel = getLabelBeforeInsn(Next);
-      const MCSymbol *SLabel = getLabelBeforeInsn(Current);
+      MLoc.set(Begin->getOperand(0).getReg(), 0);
+      const MCSymbol *FLabel = getLabelBeforeInsn(Begin);
+      const MCSymbol *SLabel = getLabelBeforeInsn(End);
       DotDebugLocEntries.push_back(DotDebugLocEntry(FLabel, SLabel, MLoc));
-      Current = Next;
-      if (MultipleValues.empty()) {
-        // If Next is the last instruction then its value is valid
+      Begin = End;
+      if (MVI + 1 == MVE) {
+        // If End is the last instruction then its value is valid
         // until the end of the funtion.
-        MLoc.set(Next->getOperand(0).getReg(), 0);
+        MLoc.set(End->getOperand(0).getReg(), 0);
         DotDebugLocEntries.
           push_back(DotDebugLocEntry(SLabel, FunctionEndSym, MLoc));
       }





More information about the llvm-commits mailing list