[llvm-commits] [llvm] r98432 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfDebug.cpp DwarfException.cpp DwarfPrinter.cpp DwarfPrinter.h

Chris Lattner sabre at nondot.org
Sat Mar 13 00:05:25 PST 2010


Author: lattner
Date: Sat Mar 13 02:05:25 2010
New Revision: 98432

URL: http://llvm.org/viewvc/llvm-project?rev=98432&view=rev
Log:
simplify EmitFrameMoves to take BaseLabel in as a symbol
instead of as a stem+idx pair, simplify the "is a new 
location" check to use symbol comparison.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=98432&r1=98431&r2=98432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sat Mar 13 02:05:25 2010
@@ -2725,7 +2725,7 @@
   std::vector<MachineMove> Moves;
   RI->getInitialFrameState(Moves);
 
-  EmitFrameMoves(NULL, 0, Moves, false);
+  EmitFrameMoves(0, Moves, false);
 
   Asm->EmitAlignment(2, 0, 0, false);
   Asm->OutStreamer.EmitLabel(getTempLabel("debug_frame_common_end"));
@@ -2764,9 +2764,7 @@
   Asm->OutStreamer.AddComment("FDE address range");
   EmitDifference(getDWLabel("func_end", DebugFrameInfo.Number), FuncBeginSym);
 
-  // FuncBeginSym.
-  EmitFrameMoves("func_begin", DebugFrameInfo.Number, DebugFrameInfo.Moves,
-                 false);
+  EmitFrameMoves(FuncBeginSym, DebugFrameInfo.Moves, false);
 
   Asm->EmitAlignment(2, 0, 0, false);
   Asm->OutStreamer.EmitLabel(DebugFrameEnd);

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=98432&r1=98431&r2=98432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Sat Mar 13 02:05:25 2010
@@ -150,7 +150,7 @@
   // Indicate locations of general callee saved registers in frame.
   std::vector<MachineMove> Moves;
   RI->getInitialFrameState(Moves);
-  EmitFrameMoves(NULL, 0, Moves, true);
+  EmitFrameMoves(0, Moves, true);
 
   // On Darwin the linker honors the alignment of eh_frame, which means it must
   // be 8-byte on 64-bit targets to match what gcc does.  Otherwise you get
@@ -247,9 +247,7 @@
     }
 
     // Indicate locations of function specific callee saved registers in frame.
-    // EHFuncBeginSym
-    EmitFrameMoves("eh_func_begin", EHFrameInfo.Number, EHFrameInfo.Moves,
-                   true);
+    EmitFrameMoves(EHFuncBeginSym, EHFrameInfo.Moves, true);
 
     // On Darwin the linker honors the alignment of eh_frame, which means it
     // must be 8-byte on 64-bit targets to match what gcc does.  Otherwise you

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=98432&r1=98431&r2=98432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Sat Mar 13 02:05:25 2010
@@ -237,7 +237,7 @@
 
 /// EmitFrameMoves - Emit frame instructions to describe the layout of the
 /// frame.
-void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
+void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel,
                                   const std::vector<MachineMove> &Moves,
                                   bool isEH) {
   int stackGrowth = TD->getPointerSize();
@@ -245,7 +245,6 @@
       TargetFrameInfo::StackGrowsUp)
     stackGrowth *= -1;
   
-  bool IsLocal = false;
   for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
     const MachineMove &Move = Moves[i];
     unsigned LabelID = Move.getLabelID();
@@ -258,13 +257,13 @@
     const MachineLocation &Src = Move.getSource();
 
     // Advance row if new location.
-    if (BaseLabel && LabelID && (BaseLabelID != LabelID || !IsLocal)) {
-      EmitCFAByte(dwarf::DW_CFA_advance_loc4);
-      EmitDifference(getDWLabel("label", LabelID),
-                     getDWLabel(BaseLabel, BaseLabelID), true);
-      BaseLabelID = LabelID;
-      BaseLabel = "label";
-      IsLocal = true;
+    if (BaseLabel && LabelID) {
+      MCSymbol *ThisSym = getDWLabel("label", LabelID);
+      if (ThisSym != BaseLabel) {
+        EmitCFAByte(dwarf::DW_CFA_advance_loc4);
+        EmitDifference(ThisSym, BaseLabel, true);
+        BaseLabel = ThisSym;
+      }
     }
 
     // If advancing cfa.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=98432&r1=98431&r2=98432&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Sat Mar 13 02:05:25 2010
@@ -122,7 +122,7 @@
   
   /// EmitFrameMoves - Emit frame instructions to describe the layout of the
   /// frame.
-  void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
+  void EmitFrameMoves(MCSymbol *BaseLabel,
                       const std::vector<MachineMove> &Moves, bool isEH);
 };
 





More information about the llvm-commits mailing list