[llvm-commits] [llvm] r83190 - in /llvm/trunk: include/llvm/Support/DebugLoc.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Devang Patel dpatel at apple.com
Wed Sep 30 18:15:28 PDT 2009


Author: dpatel
Date: Wed Sep 30 20:15:28 2009
New Revision: 83190

URL: http://llvm.org/viewvc/llvm-project?rev=83190&view=rev
Log:
Add another MDNode into DebugLocTuple. This will be used to keep track of inlined functions.

Modified:
    llvm/trunk/include/llvm/Support/DebugLoc.h
    llvm/trunk/lib/Analysis/DebugInfo.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/include/llvm/Support/DebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DebugLoc.h?rev=83190&r1=83189&r2=83190&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/DebugLoc.h (original)
+++ llvm/trunk/include/llvm/Support/DebugLoc.h Wed Sep 30 20:15:28 2009
@@ -25,17 +25,19 @@
   ///
   struct DebugLocTuple {
     MDNode *CompileUnit;
+    MDNode *InlinedLoc;
     unsigned Line, Col;
 
     DebugLocTuple()
-      : CompileUnit(0), Line(~0U), Col(~0U) {};
+      : CompileUnit(0), InlinedLoc(0), Line(~0U), Col(~0U) {};
 
-    DebugLocTuple(MDNode *n, unsigned l, unsigned c)
-      : CompileUnit(n), Line(l), Col(c) {};
+    DebugLocTuple(MDNode *n, MDNode *i, unsigned l, unsigned c)
+      : CompileUnit(n), InlinedLoc(i), Line(l), Col(c) {};
 
     bool operator==(const DebugLocTuple &DLT) const {
       return CompileUnit == DLT.CompileUnit &&
-             Line == DLT.Line && Col == DLT.Col;
+        InlinedLoc == DLT.InlinedLoc &&
+        Line == DLT.Line && Col == DLT.Col;
     }
     bool operator!=(const DebugLocTuple &DLT) const {
       return !(*this == DLT);
@@ -66,18 +68,20 @@
   // Specialize DenseMapInfo for DebugLocTuple.
   template<>  struct DenseMapInfo<DebugLocTuple> {
     static inline DebugLocTuple getEmptyKey() {
-      return DebugLocTuple(0, ~0U, ~0U);
+      return DebugLocTuple(0, 0, ~0U, ~0U);
     }
     static inline DebugLocTuple getTombstoneKey() {
-      return DebugLocTuple((MDNode*)~1U, ~1U, ~1U);
+      return DebugLocTuple((MDNode*)~1U, (MDNode*)~1U, ~1U, ~1U);
     }
     static unsigned getHashValue(const DebugLocTuple &Val) {
       return DenseMapInfo<MDNode*>::getHashValue(Val.CompileUnit) ^
+             DenseMapInfo<MDNode*>::getHashValue(Val.InlinedLoc) ^
              DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
              DenseMapInfo<unsigned>::getHashValue(Val.Col);
     }
     static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
       return LHS.CompileUnit == RHS.CompileUnit &&
+             LHS.InlinedLoc  == RHS.InlinedLoc &&
              LHS.Line        == RHS.Line &&
              LHS.Col         == RHS.Col;
     }

Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=83190&r1=83189&r2=83190&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Wed Sep 30 20:15:28 2009
@@ -952,7 +952,6 @@
 /// processModule - Process entire module and collect debug info.
 void DebugInfoFinder::processModule(Module &M) {
 
-
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
       for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE;
@@ -1271,7 +1270,7 @@
     Value *Context = SPI.getContext();
 
     // If this location is already tracked then use it.
-    DebugLocTuple Tuple(cast<MDNode>(Context), SPI.getLine(),
+    DebugLocTuple Tuple(cast<MDNode>(Context), NULL, SPI.getLine(),
                         SPI.getColumn());
     DenseMap<DebugLocTuple, unsigned>::iterator II
       = DebugLocInfo.DebugIdMap.find(Tuple);
@@ -1292,9 +1291,11 @@
                                 DebugLocTracker &DebugLocInfo) {
     DebugLoc DL;
     MDNode *Context = Loc.getScope().getNode();
-
+    MDNode *InlinedLoc = NULL;
+    if (!Loc.getOrigLocation().isNull())
+      InlinedLoc = Loc.getOrigLocation().getNode();
     // If this location is already tracked then use it.
-    DebugLocTuple Tuple(Context, Loc.getLineNumber(),
+    DebugLocTuple Tuple(Context, InlinedLoc, Loc.getLineNumber(),
                         Loc.getColumnNumber());
     DenseMap<DebugLocTuple, unsigned>::iterator II
       = DebugLocInfo.DebugIdMap.find(Tuple);
@@ -1321,7 +1322,7 @@
     DICompileUnit CU(Subprogram.getCompileUnit());
 
     // If this location is already tracked then use it.
-    DebugLocTuple Tuple(CU.getNode(), Line, /* Column */ 0);
+    DebugLocTuple Tuple(CU.getNode(), NULL, Line, /* Column */ 0);
     DenseMap<DebugLocTuple, unsigned>::iterator II
       = DebugLocInfo.DebugIdMap.find(Tuple);
     if (II != DebugLocInfo.DebugIdMap.end())

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=83190&r1=83189&r2=83190&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Sep 30 20:15:28 2009
@@ -60,7 +60,7 @@
     OutStreamer(*createAsmStreamer(OutContext, O, *T, 0)),
 
     LastMI(0), LastFn(0), Counter(~0U),
-    PrevDLT(0, ~0U, ~0U) {
+    PrevDLT(0, 0, ~0U, ~0U) {
   DW = 0; MMI = 0;
   switch (AsmVerbose) {
   case cl::BOU_UNSET: VerboseAsm = VDef;  break;





More information about the llvm-commits mailing list