[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Passes.h

Jim Laskey jlaskey at apple.com
Tue Nov 7 11:34:03 PST 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.44 -> 1.45
Passes.h updated: 1.21 -> 1.22
---
Log message:

1. Add a pass to fold debug label instructions so a debug info client can detect
empty ranges.

2. Reorg how MachineDebugInfo maintains changes to debug labels.

3. Have dwarf writer use debug label info to simplify scopes and source line
coorespondence.

4. Revert the merging of compile units until I can get the bugs ironed out.



---
Diffs of the changes:  (+30 -11)

 MachineDebugInfo.h |   36 +++++++++++++++++++++++++-----------
 Passes.h           |    5 +++++
 2 files changed, 30 insertions(+), 11 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.45
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44	Tue Oct 24 06:50:43 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.h	Tue Nov  7 13:33:46 2006
@@ -969,8 +969,11 @@
   // Lines - List of of source line correspondence.
   std::vector<SourceLineInfo> Lines;
   
-  // LabelID - Current number assigned to unique label numbers.
-  unsigned LabelID;
+  // LabelIDList - One entry per assigned label.  Normally the entry is equal to
+  // the list index(+1).  If the entry is zero then the label has been deleted.
+  // Any other value indicates the label has been deleted by is mapped to
+  // another label.
+  std::vector<unsigned> LabelIDList;
   
   // ScopeMap - Tracks the scopes in the current function.
   std::map<DebugInfoDesc *, DebugScope *> ScopeMap;
@@ -979,10 +982,6 @@
   //
   DebugScope *RootScope;
   
-  // DeletedLabelIDs - Sorted list of label IDs that have been removed from the
-  // module.
-  std::vector<unsigned> DeletedLabelIDs;
-  
   // FrameMoves - List of moves done by a function's prolog.  Used to construct
   // frame maps by debug consumers.
   std::vector<MachineMove *> FrameMoves;
@@ -1026,7 +1025,11 @@
   
   /// NextLabelID - Return the next unique label id.
   ///
-  unsigned NextLabelID() { return ++LabelID; }
+  unsigned NextLabelID() {
+    unsigned ID = LabelIDList.size() + 1;
+    LabelIDList.push_back(ID);
+    return ID;
+  }
   
   /// RecordLabel - Records location information and associates it with a
   /// debug label.  Returns a unique label ID used to generate a label and 
@@ -1035,11 +1038,22 @@
   
   /// InvalidateLabel - Inhibit use of the specified label # from
   /// MachineDebugInfo, for example because the code was deleted.
-  void InvalidateLabel(unsigned LabelID);
+  void InvalidateLabel(unsigned LabelID) {
+    // Remap to zero to indicate deletion.
+    RemapLabel(LabelID, 0);
+  }
+
+  /// RemapLabel - Indicate that a label has been merged into another.
+  ///
+  void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) {
+    LabelIDList[OldLabelID - 1] = NewLabelID;
+  }
   
-  /// isLabelValid - Check to make sure the label is still valid before
-  /// attempting to use.
-  bool isLabelValid(unsigned LabelID);
+  /// 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 {
+    return LabelIDList[LabelID - 1];
+  }
 
   /// RecordSource - Register a source file with debug info. Returns an source
   /// ID.


Index: llvm/include/llvm/CodeGen/Passes.h
diff -u llvm/include/llvm/CodeGen/Passes.h:1.21 llvm/include/llvm/CodeGen/Passes.h:1.22
--- llvm/include/llvm/CodeGen/Passes.h:1.21	Sun Oct 23 23:13:21 2005
+++ llvm/include/llvm/CodeGen/Passes.h	Tue Nov  7 13:33:46 2006
@@ -81,6 +81,11 @@
   /// branches.
   FunctionPass *createBranchFoldingPass();
 
+  /// DebugLabelFoldingPass - This pass prunes out redundant debug labels.  This
+  /// allows a debug emitter to determine if the range of two labels is empty,
+  /// by seeing if the labels map to the same reduced label.
+  FunctionPass *createDebugLabelFoldingPass();
+
   /// MachineCodeDeletion Pass - This pass deletes all of the machine code for
   /// the current function, which should happen after the function has been
   /// emitted to a .s file or to memory.






More information about the llvm-commits mailing list