[llvm-branch-commits] [llvm-branch] r68733 - /llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Bill Wendling isanbard at gmail.com
Thu Apr 9 16:11:02 PDT 2009


Author: void
Date: Thu Apr  9 18:11:01 2009
New Revision: 68733

URL: http://llvm.org/viewvc/llvm-project?rev=68733&view=rev
Log:
--- Merging (from foreign repository) r68728 into '.':
U    lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Use a StringMap instead of std::map for storing std::string->DIE* maps. This
gives a micro speedup in the Dwarf writer.

Modified:
    llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Modified: llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=68733&r1=68732&r2=68733&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Thu Apr  9 18:11:01 2009
@@ -727,7 +727,7 @@
 
   /// Globals - A map of globally visible named entities for this unit.
   ///
-  std::map<std::string, DIE *> Globals;
+  StringMap<DIE*> Globals;
 
   /// DiesSet - Used to uniquely define dies within the compile unit.
   ///
@@ -745,7 +745,7 @@
   // Accessors.
   unsigned getID()           const { return ID; }
   DIE* getDie()              const { return Die; }
-  std::map<std::string, DIE *> &getGlobals() { return Globals; }
+  StringMap<DIE*> &getGlobals() { return Globals; }
 
   /// hasContent - Return true if this compile unit has something to write out.
   ///
@@ -2101,8 +2101,8 @@
   void ConstructDefaultDbgScope(MachineFunction *MF) {
     const char *FnName = MF->getFunction()->getNameStart();
     if (MainCU) {
-      std::map<std::string, DIE*> &Globals = MainCU->getGlobals();
-      std::map<std::string, DIE*>::iterator GI = Globals.find(FnName);
+      StringMap<DIE*> &Globals = MainCU->getGlobals();
+      StringMap<DIE*>::iterator GI = Globals.find(FnName);
       if (GI != Globals.end()) {
         DIE *SPDie = GI->second;
 
@@ -2119,8 +2119,8 @@
     } else {
       for (unsigned i = 0, e = CompileUnits.size(); i != e; ++i) {
         CompileUnit *Unit = CompileUnits[i];
-        std::map<std::string, DIE*> &Globals = Unit->getGlobals();
-        std::map<std::string, DIE*>::iterator GI = Globals.find(FnName);
+        StringMap<DIE*> &Globals = Unit->getGlobals();
+        StringMap<DIE*>::iterator GI = Globals.find(FnName);
         if (GI != Globals.end()) {
           DIE *SPDie = GI->second;
 
@@ -2661,10 +2661,10 @@
                    true);
     Asm->EOL("Compilation Unit Length");
       
-    std::map<std::string, DIE *> &Globals = Unit->getGlobals();
-    for (std::map<std::string, DIE *>::iterator GI = Globals.begin(),
-           GE = Globals.end(); GI != GE; ++GI) {
-      const std::string &Name = GI->first;
+    StringMap<DIE*> &Globals = Unit->getGlobals();
+    for (StringMap<DIE*>::iterator
+           GI = Globals.begin(), GE = Globals.end(); GI != GE; ++GI) {
+      const std::string &Name = GI->first();
       DIE * Entity = GI->second;
         
       Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset");





More information about the llvm-branch-commits mailing list