[llvm-commits] [llvm] r63009 - in /llvm/trunk: include/llvm/CodeGen/DebugLoc.h include/llvm/CodeGen/MachineFunction.h lib/CodeGen/MachineFunction.cpp

Evan Cheng evan.cheng at apple.com
Sun Jan 25 23:53:42 PST 2009


Author: evancheng
Date: Mon Jan 26 01:53:42 2009
New Revision: 63009

URL: http://llvm.org/viewvc/llvm-project?rev=63009&view=rev
Log:
Actually source file has already been uniquified into an id during isel. Eliminate the StringMap.

Modified:
    llvm/trunk/include/llvm/CodeGen/DebugLoc.h
    llvm/trunk/include/llvm/CodeGen/MachineFunction.h
    llvm/trunk/lib/CodeGen/MachineFunction.cpp

Modified: llvm/trunk/include/llvm/CodeGen/DebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DebugLoc.h?rev=63009&r1=63008&r2=63009&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DebugLoc.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DebugLoc.h Mon Jan 26 01:53:42 2009
@@ -14,7 +14,6 @@
 #define LLVM_CODEGEN_DEBUGLOC_H
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/StringMap.h"
 #include <vector>
 
 namespace llvm {
@@ -22,10 +21,10 @@
   /// DebugLocTuple - Debug location tuple of filename id, line and column.
   ///
   struct DebugLocTuple {
-    unsigned FileId, Line, Col;
+    unsigned Src, Line, Col;
 
-    DebugLocTuple(unsigned fi, unsigned l, unsigned c)
-      : FileId(fi), Line(l), Col(c) {};
+    DebugLocTuple(unsigned s, unsigned l, unsigned c)
+      : Src(s), Line(l), Col(c) {};
   };
 
   /// DebugLoc - Debug location id. This is carried by SDNode and
@@ -51,14 +50,14 @@
       return DebugLocTuple(~1U, ~1U, ~1U);
     }
     static unsigned getHashValue(const DebugLocTuple &Val) {
-      return DenseMapInfo<unsigned>::getHashValue(Val.FileId) ^
+      return DenseMapInfo<unsigned>::getHashValue(Val.Src) ^
              DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
              DenseMapInfo<unsigned>::getHashValue(Val.Col);
     }
     static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
-      return LHS.FileId == RHS.FileId &&
+      return LHS.Src  == RHS.Src &&
              LHS.Line == RHS.Line &&
-             LHS.Col == RHS.Col;
+             LHS.Col  == RHS.Col;
     }
 
     static bool isPod() { return true; }
@@ -70,18 +69,6 @@
   /// DebugLocTracker - This class tracks debug location information.
   ///
   struct DebugLocTracker {
-    // NumFilenames - Size of the DebugFilenames vector.
-    //
-    unsigned NumFilenames;
-    
-    // DebugFilenames - A vector of unique file names.
-    //
-    std::vector<std::string> DebugFilenames;
-
-    // DebugFilenamesMap - File name to DebugFilenames index map.
-    //
-    StringMap<unsigned> DebugFilenamesMap;
-
     // NumDebugLocations - Size of the DebugLocations vector.
     unsigned NumDebugLocations;
 
@@ -93,12 +80,9 @@
     // DebugLocations vector.
     DebugIdMapType DebugIdMap;
 
-    DebugLocTracker() : NumFilenames(0), NumDebugLocations(0) {}
+    DebugLocTracker() : NumDebugLocations(0) {}
 
     ~DebugLocTracker() {
-      NumFilenames = 0;
-      DebugFilenames.clear();
-      DebugFilenamesMap.clear();
       DebugLocations.clear();
       DebugIdMap.clear();
     }

Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=63009&r1=63008&r2=63009&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Jan 26 01:53:42 2009
@@ -312,9 +312,9 @@
   //
 
   /// lookUpDebugLocId - Look up the DebugLocTuple index with the given
-  /// filename, line, and column. It may add a new filename and / or
+  /// source file, line, and column. It may add a new filename and / or
   /// a new DebugLocTuple.
-  unsigned lookUpDebugLocId(const char *Filename, unsigned Line, unsigned Col);
+  unsigned lookUpDebugLocId(unsigned Src, unsigned Line, unsigned Col);
 };
 
 //===--------------------------------------------------------------------===//

Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=63009&r1=63008&r2=63009&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Jan 26 01:53:42 2009
@@ -379,23 +379,11 @@
 }
 
 /// lookUpDebugLocId - Look up the DebugLocTuple index with the given
-/// filename, line, and column. It may add a new filename and / or
+/// source file, line, and column. It may add a new filename and / or
 /// a new DebugLocTuple.
-unsigned MachineFunction::lookUpDebugLocId(const char *Filename, unsigned Line,
+unsigned MachineFunction::lookUpDebugLocId(unsigned Src, unsigned Line,
                                            unsigned Col) {
-  unsigned FileId;
-  StringMap<unsigned>::iterator I =
-    DebugLocInfo.DebugFilenamesMap.find(Filename);
-  if (I != DebugLocInfo.DebugFilenamesMap.end())
-    FileId = I->second;
-  else {
-    // Add a new filename.
-    FileId = DebugLocInfo.NumFilenames++;
-    DebugLocInfo.DebugFilenames.push_back(Filename);
-    DebugLocInfo.DebugFilenamesMap[Filename] = FileId;
-  }
-
-  struct DebugLocTuple Tuple(FileId, Line, Col);
+  struct DebugLocTuple Tuple(Src, Line, Col);
   DebugIdMapType::iterator II = DebugLocInfo.DebugIdMap.find(Tuple);
   if (II != DebugLocInfo.DebugIdMap.end())
     return II->second;





More information about the llvm-commits mailing list