simplify EmitFrameMoves to take BaseLabel in as a symbol
authorChris Lattner <sabre@nondot.org>
Sat, 13 Mar 2010 08:05:25 +0000 (08:05 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 13 Mar 2010 08:05:25 +0000 (08:05 +0000)
instead of as a stem+idx pair, simplify the "is a new
location" check to use symbol comparison.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98432 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfException.cpp
lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfPrinter.h

index 8510ae776fd5333dcda63edcb2a0f2e2e3c0c0fe..98e60a7616cd2677b651b3cc388a08ef5a2aae49 100644 (file)
@@ -2725,7 +2725,7 @@ void DwarfDebug::emitCommonDebugFrame() {
   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 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) {
   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);
index 58ebafa105081f745701e1ac1a008c07bbc378fd..16c9aa38e31548d9fdc136fdcba8b5d48aad2754 100644 (file)
@@ -150,7 +150,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
   // 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 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
     }
 
     // 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
index 3c00839aa77306ddea5840302671b80b9dfc6118..8d633f3dd6af94f68a8c14ebf0157b5c1fdb4385 100644 (file)
@@ -237,7 +237,7 @@ void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
 
 /// 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 @@ void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
       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 @@ void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
     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.
index 5e2d806a66a5755b13eb3467fe20329022b99612..0b94645a8c7b335e69fa42f3147ca85da438f5fa 100644 (file)
@@ -122,7 +122,7 @@ public:
   
   /// 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);
 };