[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp MachineDebugInfo.cpp

Jim Laskey jlaskey at apple.com
Wed Jan 24 10:45:38 PST 2007



Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.112 -> 1.113
MachineDebugInfo.cpp updated: 1.69 -> 1.70
---
Log message:

Repair debug frames as a prelude to eh_frames.  Switched to using MachineMoves
by value so that clean up is less confusing (these vectors tend to be small.)


---
Diffs of the changes:  (+28 -16)

 DwarfWriter.cpp      |   43 ++++++++++++++++++++++++++++---------------
 MachineDebugInfo.cpp |    1 -
 2 files changed, 28 insertions(+), 16 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.112 llvm/lib/CodeGen/DwarfWriter.cpp:1.113
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.112	Wed Jan 24 07:12:32 2007
+++ llvm/lib/CodeGen/DwarfWriter.cpp	Wed Jan 24 12:45:13 2007
@@ -2112,16 +2112,25 @@
   /// EmitFrameMoves - Emit frame instructions to describe the layout of the
   /// frame.
   void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
-                                   std::vector<MachineMove *> &Moves) {
+                                   std::vector<MachineMove> &Moves) {
+    int stackGrowth =
+        Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
+          TargetFrameInfo::StackGrowsUp ?
+            TAI->getAddressSize() : -TAI->getAddressSize();
+
     for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
-      MachineMove *Move = Moves[i];
-      unsigned LabelID = DebugInfo->MappedLabel(Move->getLabelID());
+      MachineMove &Move = Moves[i];
+      unsigned LabelID = Move.getLabelID();
       
-      // Throw out move if the label is invalid.
-      if (!LabelID) continue;
+      if (LabelID) {
+        LabelID = DebugInfo->MappedLabel(LabelID);
       
-      const MachineLocation &Dst = Move->getDestination();
-      const MachineLocation &Src = Move->getSource();
+        // Throw out move if the label is invalid.
+        if (!LabelID) continue;
+      }
+      
+      const MachineLocation &Dst = Move.getDestination();
+      const MachineLocation &Src = Move.getSource();
       
       // Advance row if new location.
       if (BaseLabel && LabelID && BaseLabelID != LabelID) {
@@ -2134,11 +2143,6 @@
         BaseLabel = "loc";
       }
       
-      int stackGrowth =
-          Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
-            TargetFrameInfo::StackGrowsUp ?
-              TAI->getAddressSize() : -TAI->getAddressSize();
-
       // If advancing cfa.
       if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) {
         if (!Src.isRegister()) {
@@ -2159,6 +2163,16 @@
         } else {
           assert(0 && "Machine move no supported yet.");
         }
+      } else if (Src.isRegister() &&
+        Src.getRegister() == MachineLocation::VirtualFP) {
+        if (Dst.isRegister()) {
+          EmitInt8(DW_CFA_def_cfa_register);
+          EOL("DW_CFA_def_cfa_register");
+          EmitULEB128Bytes(RI->getDwarfRegNum(Dst.getRegister()));
+          EOL("Register");
+        } else {
+          assert(0 && "Machine move no supported yet.");
+        }
       } else {
         unsigned Reg = RI->getDwarfRegNum(Src.getRegister());
         int Offset = Dst.getOffset() / stackGrowth;
@@ -2433,10 +2447,9 @@
     EmitSLEB128Bytes(stackGrowth); EOL("CIE Data Alignment Factor");   
     EmitInt8(RI->getDwarfRegNum(RI->getRARegister())); EOL("CIE RA Column");
     
-    std::vector<MachineMove *> Moves;
+    std::vector<MachineMove> Moves;
     RI->getInitialFrameState(Moves);
     EmitFrameMoves(NULL, 0, Moves);
-    for (unsigned i = 0, N = Moves.size(); i < N; ++i) delete Moves[i];
 
     Asm->EmitAlignment(2);
     EmitLabel("frame_common_end", 0);
@@ -2467,7 +2480,7 @@
                    "func_begin", SubprogramCount);
     EOL("FDE address range");
     
-    std::vector<MachineMove *> &Moves = DebugInfo->getFrameMoves();
+    std::vector<MachineMove> &Moves = DebugInfo->getFrameMoves();
     
     EmitFrameMoves("func_begin", SubprogramCount, Moves);
     


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.69 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.70
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.69	Thu Jan 11 22:24:45 2007
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp	Wed Jan 24 12:45:13 2007
@@ -1505,7 +1505,6 @@
   }
   
   // Clean up frame info.
-  for (unsigned i = 0, N = FrameMoves.size(); i < N; ++i) delete FrameMoves[i];
   FrameMoves.clear();
 }
 






More information about the llvm-commits mailing list