[llvm-commits] [llvm] r98031 - in /llvm/trunk: include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/MachineModuleInfo.cpp lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp

Chris Lattner sabre at nondot.org
Mon Mar 8 17:51:43 PST 2010


Author: lattner
Date: Mon Mar  8 19:51:43 2010
New Revision: 98031

URL: http://llvm.org/viewvc/llvm-project?rev=98031&view=rev
Log:
strength reduce MMI::MappedLabel to MMI::isLabelDeleted,
and add a FIXME about how we are eventually going to zap this
lookup table once mc world domination is complete.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=98031&r1=98030&r2=98031&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Mon Mar  8 19:51:43 2010
@@ -222,13 +222,14 @@
     LabelIDList[LabelID - 1] = 0;
   }
   
-  /// MappedLabel - Find out the label's final ID.  Zero indicates deletion.
-  /// ID != Mapped ID indicates that the label was folded into another label.
-  unsigned MappedLabel(unsigned LabelID) const {
+  /// isLabelDeleted - Return true if the label was deleted.
+  /// FIXME: This should eventually be eliminated and use the 'is emitted' bit
+  /// on MCSymbol.
+  bool isLabelDeleted(unsigned LabelID) const {
     assert(LabelID <= LabelIDList.size() && "Debug label ID out of range.");
-    return LabelID ? LabelIDList[LabelID - 1] : 0;
+    return LabelID == 0 || LabelIDList[LabelID - 1] == 0;
   }
-
+  
   /// getFrameMoves - Returns a reference to a list of moves done in the current
   /// function's prologue.  Used to construct frame maps for debug and exception
   /// handling comsumers.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=98031&r1=98030&r2=98031&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Mar  8 19:51:43 2010
@@ -1362,9 +1362,14 @@
 /// constructLexicalScope - Construct new DW_TAG_lexical_block
 /// for this scope and attach DW_AT_low_pc/DW_AT_high_pc labels.
 DIE *DwarfDebug::constructLexicalScopeDIE(DbgScope *Scope) {
-  unsigned StartID = MMI->MappedLabel(Scope->getStartLabelID());
-  unsigned EndID = MMI->MappedLabel(Scope->getEndLabelID());
+  unsigned StartID = Scope->getStartLabelID();
+  unsigned EndID = Scope->getEndLabelID();
 
+  assert(!MMI->isLabelDeleted(StartID) &&
+         "Invalid starting label for an inlined scope!");
+  assert(!MMI->isLabelDeleted(EndID) &&
+         "Invalid end label for an inlined scope!");
+  
   // Ignore empty scopes.
   if (StartID == EndID && StartID != 0)
     return NULL;
@@ -1387,12 +1392,14 @@
 /// a function. Construct DIE to represent this concrete inlined copy
 /// of the function.
 DIE *DwarfDebug::constructInlinedScopeDIE(DbgScope *Scope) {
-  unsigned StartID = MMI->MappedLabel(Scope->getStartLabelID());
-  unsigned EndID = MMI->MappedLabel(Scope->getEndLabelID());
-  assert (StartID && "Invalid starting label for an inlined scope!");
-  assert (EndID && "Invalid end label for an inlined scope!");
+  unsigned StartID = Scope->getStartLabelID();
+  unsigned EndID = Scope->getEndLabelID();
+  assert(!MMI->isLabelDeleted(StartID) &&
+         "Invalid starting label for an inlined scope!");
+  assert(!MMI->isLabelDeleted(EndID) &&
+         "Invalid end label for an inlined scope!");
   // Ignore empty scopes.
-  if (StartID == EndID && StartID != 0)
+  if (StartID == EndID)
     return NULL;
   if (!Scope->getScopeNode())
     return NULL;
@@ -2589,8 +2596,8 @@
     // Construct rows of the address, source, line, column matrix.
     for (unsigned i = 0, N = LineInfos.size(); i < N; ++i) {
       const SrcLineInfo &LineInfo = LineInfos[i];
-      unsigned LabelID = MMI->MappedLabel(LineInfo.getLabelID());
-      if (!LabelID) continue;
+      unsigned LabelID = LineInfo.getLabelID();
+      if (MMI->isLabelDeleted(LabelID)) continue;
 
       if (LineInfo.getLine() == 0) continue;
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=98031&r1=98030&r2=98031&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Mon Mar  8 19:51:43 2010
@@ -277,12 +277,9 @@
     const MachineMove &Move = Moves[i];
     unsigned LabelID = Move.getLabelID();
 
-    if (LabelID) {
-      LabelID = MMI->MappedLabel(LabelID);
-
-      // Throw out move if the label is invalid.
-      if (!LabelID) continue;
-    }
+    // Throw out move if the label is invalid.
+    if (LabelID && MMI->isLabelDeleted(LabelID))
+      continue;
 
     const MachineLocation &Dst = Move.getDestination();
     const MachineLocation &Src = Move.getSource();

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=98031&r1=98030&r2=98031&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Mar  8 19:51:43 2010
@@ -185,7 +185,8 @@
 void MachineModuleInfo::TidyLandingPads() {
   for (unsigned i = 0; i != LandingPads.size(); ) {
     LandingPadInfo &LandingPad = LandingPads[i];
-    LandingPad.LandingPadLabel = MappedLabel(LandingPad.LandingPadLabel);
+    if (isLabelDeleted(LandingPad.LandingPadLabel))
+      LandingPad.LandingPadLabel = 0;
 
     // Special case: we *should* emit LPs with null LP MBB. This indicates
     // "nounwind" case.
@@ -195,17 +196,14 @@
     }
 
     for (unsigned j=0; j != LandingPads[i].BeginLabels.size(); ) {
-      unsigned BeginLabel = MappedLabel(LandingPad.BeginLabels[j]);
-      unsigned EndLabel = MappedLabel(LandingPad.EndLabels[j]);
-
-      if (!BeginLabel || !EndLabel) {
+      unsigned BeginLabel = LandingPad.BeginLabels[j];
+      unsigned EndLabel = LandingPad.EndLabels[j];
+      if (isLabelDeleted(BeginLabel) || isLabelDeleted(EndLabel)) {
         LandingPad.BeginLabels.erase(LandingPad.BeginLabels.begin() + j);
         LandingPad.EndLabels.erase(LandingPad.EndLabels.begin() + j);
         continue;
       }
 
-      LandingPad.BeginLabels[j] = BeginLabel;
-      LandingPad.EndLabels[j] = EndLabel;
       ++j;
     }
 

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=98031&r1=98030&r2=98031&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Mon Mar  8 19:51:43 2010
@@ -75,10 +75,9 @@
     unsigned LabelID = Move.getLabelID();
     
     if (LabelID) {
-      LabelID = MMI->MappedLabel(LabelID);
-    
       // Throw out move if the label is invalid.
-      if (!LabelID) continue;
+      if (MMI->isLabelDeleted(LabelID))
+        continue;
     }
     
     intptr_t LabelPtr = 0;
@@ -722,10 +721,9 @@
     unsigned LabelID = Move.getLabelID();
     
     if (LabelID) {
-      LabelID = MMI->MappedLabel(LabelID);
-    
       // Throw out move if the label is invalid.
-      if (!LabelID) continue;
+      if (MMI->isLabelDeleted(LabelID))
+        continue;
     }
     
     intptr_t LabelPtr = 0;





More information about the llvm-commits mailing list