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

Bill Wendling isanbard at gmail.com
Fri May 1 01:42:18 PDT 2009


Author: void
Date: Fri May  1 03:42:18 2009
New Revision: 70540

URL: http://llvm.org/viewvc/llvm-project?rev=70540&view=rev
Log:
Simplify more code and add timer stuff.

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=70540&r1=70539&r2=70540&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Fri May  1 03:42:18 2009
@@ -3532,6 +3532,12 @@
     if (!TAI->doesDwarfUsesInlineInfoSection())
       return;
 
+    if (TimePassesIsEnabled)
+      DebugTimer->startTimer();
+
+    std::string Dir, Fn;
+    unsigned Src = GetOrCreateSourceID(CU.getDirectory(Dir),
+                                       CU.getFilename(Fn));
     DbgScope *Scope = createInlinedSubroutineScope(SP, Src, Line, Col);
     Scope->setStartLabelID(LabelID);
     MMI->RecordUsedDbgLabel(LabelID);
@@ -3551,6 +3557,9 @@
       InlineInfo[GV].push_back(LabelID);
     else
       I->second.push_back(LabelID);
+
+    if (TimePassesIsEnabled)
+      DebugTimer->stopTimer();
   }
 
   /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
@@ -3558,11 +3567,18 @@
     if (!TAI->doesDwarfUsesInlineInfoSection())
       return 0;
 
+    if (TimePassesIsEnabled)
+      DebugTimer->startTimer();
+
     GlobalVariable *GV = SP.getGV();
     DenseMap<GlobalVariable *, SmallVector<DbgScope *, 2> >::iterator
       I = DbgInlinedScopeMap.find(GV);
-    if (I == DbgInlinedScopeMap.end()) 
+    if (I == DbgInlinedScopeMap.end()) {
+      if (TimePassesIsEnabled)
+        DebugTimer->stopTimer();
+
       return 0;
+    }
 
     SmallVector<DbgScope *, 2> &Scopes = I->second;
     assert(!Scopes.empty() && "We should have at least one debug scope!");
@@ -3570,6 +3586,10 @@
     unsigned ID = MMI->NextLabelID();
     MMI->RecordUsedDbgLabel(ID);
     Scope->setEndLabelID(ID);
+
+    if (TimePassesIsEnabled)
+      DebugTimer->stopTimer();
+
     return ID;
   }
 
@@ -3578,18 +3598,26 @@
   /// Record scopes for only inlined subroutine variables. Other
   /// variables' scopes are determined during RecordVariable().
   void RecordVariableScope(DIVariable &DV, const MachineInstr *DeclareMI) {
+    if (TimePassesIsEnabled)
+      DebugTimer->startTimer();
+
     DISubprogram SP(DV.getContext().getGV());
-    if (SP.isNull())
+
+    if (SP.isNull()) {
+      if (TimePassesIsEnabled)
+        DebugTimer->stopTimer();
+
       return;
+    }
+
     DenseMap<GlobalVariable *, SmallVector<DbgScope *, 2> >::iterator
       I = DbgInlinedScopeMap.find(SP.getGV());
-    if (I == DbgInlinedScopeMap.end())
-      return;
+    if (I != DbgInlinedScopeMap.end())
+      InlinedVariableScopes[DeclareMI] = I->second.back();
 
-    SmallVector<DbgScope *, 2> &Scopes = I->second;
-    InlinedVariableScopes[DeclareMI] = Scopes.back();
+    if (TimePassesIsEnabled)
+      DebugTimer->stopTimer();
   }
-
 };
 
 //===----------------------------------------------------------------------===//





More information about the llvm-branch-commits mailing list