[llvm-branch-commits] [llvm-branch] r70541 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Target/X86/AsmPrinter/ utils/TableGen/

Bill Wendling isanbard at gmail.com
Fri May 1 01:47:55 PDT 2009


Author: void
Date: Fri May  1 03:47:52 2009
New Revision: 70541

URL: http://llvm.org/viewvc/llvm-project?rev=70541&view=rev
Log:
--- Merging r70520 into '.':
U    include/llvm/CodeGen/DwarfWriter.h
U    include/llvm/CodeGen/MachineFunction.h
U    include/llvm/CodeGen/DebugLoc.h
U    utils/TableGen/AsmWriterEmitter.cpp
U    lib/CodeGen/AsmPrinter/DwarfWriter.cpp
U    lib/CodeGen/MachineFunction.cpp
U    lib/CodeGen/MachineInstr.cpp
U    lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
U    lib/CodeGen/SelectionDAG/FastISel.cpp
U    lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
U    lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp

Make DebugLoc independent of DwarfWriter.

-Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable*
-Remove DwarfWriter::getOrCreateSourceID
-Make necessary changes for the above (fix callsites, etc.)

Modified:
    llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h
    llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h
    llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineFunction.h
    llvm/branches/Apple/Dib/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/MachineFunction.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/MachineInstr.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
    llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
    llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
    llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DebugLoc.h Fri May  1 03:47:52 2009
@@ -19,17 +19,20 @@
 #include <vector>
 
 namespace llvm {
+  class GlobalVariable;
 
   /// DebugLocTuple - Debug location tuple of filename id, line and column.
   ///
   struct DebugLocTuple {
-    unsigned Src, Line, Col;
+    GlobalVariable *CompileUnit;
+    unsigned Line, Col;
 
-    DebugLocTuple(unsigned s, unsigned l, unsigned c)
-      : Src(s), Line(l), Col(c) {};
+    DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c)
+      : CompileUnit(v), Line(l), Col(c) {};
 
     bool operator==(const DebugLocTuple &DLT) const {
-      return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col;
+      return CompileUnit == DLT.CompileUnit &&
+             Line == DLT.Line && Col == DLT.Col;
     }
     bool operator!=(const DebugLocTuple &DLT) const {
       return !(*this == DLT);
@@ -60,20 +63,20 @@
   // Partially specialize DenseMapInfo for DebugLocTyple.
   template<>  struct DenseMapInfo<DebugLocTuple> {
     static inline DebugLocTuple getEmptyKey() {
-      return DebugLocTuple(~0U, ~0U, ~0U);
+      return DebugLocTuple(0, ~0U, ~0U);
     }
     static inline DebugLocTuple getTombstoneKey() {
-      return DebugLocTuple(~1U, ~1U, ~1U);
+      return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U);
     }
     static unsigned getHashValue(const DebugLocTuple &Val) {
-      return DenseMapInfo<unsigned>::getHashValue(Val.Src) ^
+      return DenseMapInfo<GlobalVariable*>::getHashValue(Val.CompileUnit) ^
              DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
              DenseMapInfo<unsigned>::getHashValue(Val.Col);
     }
     static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
-      return LHS.Src  == RHS.Src &&
-             LHS.Line == RHS.Line &&
-             LHS.Col  == RHS.Col;
+      return LHS.CompileUnit == RHS.CompileUnit &&
+             LHS.Line        == RHS.Line &&
+             LHS.Col         == RHS.Col;
     }
 
     static bool isPod() { return true; }

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/DwarfWriter.h Fri May  1 03:47:52 2009
@@ -37,6 +37,7 @@
 class TargetAsmInfo;
 class raw_ostream;
 class Instruction;
+class DICompileUnit;
 class DISubprogram;
 class DIVariable;
 
@@ -87,14 +88,7 @@
   /// RecordSourceLine - Register a source line with debug info. Returns a
   /// unique label ID used to generate a label and provide correspondence to
   /// the source line list.
-  unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
-
-  /// getOrCreateSourceID - Look up the source id with the given directory and
-  /// source file names. If none currently exists, create a new id and insert it
-  /// in the SourceIds map. This can update DirectoryIds and SourceFileIds maps
-  /// as well.
-  unsigned getOrCreateSourceID(const std::string &DirName,
-                               const std::string &FileName);
+  unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU);
 
   /// RecordRegionStart - Indicate the start of a region.
   unsigned RecordRegionStart(GlobalVariable *V);
@@ -116,7 +110,7 @@
 
   //// RecordInlinedFnStart - Indicate the start of a inlined function.
   void RecordInlinedFnStart(Instruction *I, DISubprogram &SP, unsigned LabelID,
-                            unsigned Src, unsigned Line, unsigned Col);
+                            DICompileUnit CU, unsigned Line, unsigned Col);
 
   /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
   unsigned RecordInlinedFnEnd(DISubprogram &SP);

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineFunction.h?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineFunction.h Fri May  1 03:47:52 2009
@@ -332,7 +332,8 @@
   /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
   /// source file, line, and column. If none currently exists, create a new
   /// DebugLocTuple, and insert it into the DebugIdMap.
-  unsigned getOrCreateDebugLocID(unsigned Src, unsigned Line, unsigned Col);
+  unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit,
+                                 unsigned Line, unsigned Col);
 
   /// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
   DebugLocTuple getDebugLocTuple(DebugLoc DL) const;

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=70541&r1=70540&r2=70541&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:47:52 2009
@@ -1103,7 +1103,7 @@
 public:
   SrcLineInfo(unsigned L, unsigned C, unsigned S, unsigned I)
     : Line(L), Column(C), SourceID(S), LabelID(I) {}
-  
+
   // Accessors
   unsigned getLine()     const { return Line; }
   unsigned getColumn()   const { return Column; }
@@ -3425,10 +3425,13 @@
   /// RecordSourceLine - Records location information and associates it with a 
   /// label. Returns a unique label ID used to generate a label and provide
   /// correspondence to the source line list.
-  unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src) {
+  unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU) {
     if (TimePassesIsEnabled)
       DebugTimer->startTimer();
 
+    std::string Dir, Fn;
+    unsigned Src = GetOrCreateSourceID(CU.getDirectory(Dir),
+                                       CU.getFilename(Fn));
     unsigned ID = MMI->NextLabelID();
     Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
 
@@ -3528,7 +3531,7 @@
 
   //// RecordInlinedFnStart - Indicate the start of inlined subroutine.
   void RecordInlinedFnStart(Instruction *FSI, DISubprogram &SP, unsigned LabelID,
-                            unsigned Src, unsigned Line, unsigned Col) {
+                            DICompileUnit CU, unsigned Line, unsigned Col) {
     if (!TAI->doesDwarfUsesInlineInfoSection())
       return;
 
@@ -4758,17 +4761,8 @@
 /// label. Returns a unique label ID used to generate a label and provide
 /// correspondence to the source line list.
 unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col, 
-                                       unsigned Src) {
-  return DD->RecordSourceLine(Line, Col, Src);
-}
-
-/// getOrCreateSourceID - Look up the source id with the given directory and
-/// source file names. If none currently exists, create a new id and insert it
-/// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps
-/// as well.
-unsigned DwarfWriter::getOrCreateSourceID(const std::string &DirName,
-                                          const std::string &FileName) {
-  return DD->getOrCreateSourceID(DirName, FileName);
+                                       DICompileUnit CU) {
+  return DD->RecordSourceLine(Line, Col, CU);
 }
 
 /// RecordRegionStart - Indicate the start of a region.
@@ -4802,9 +4796,9 @@
 //// RecordInlinedFnStart - Global variable GV is inlined at the location marked
 //// by LabelID label.
 void DwarfWriter::RecordInlinedFnStart(Instruction *I, DISubprogram &SP, 
-                                       unsigned LabelID, unsigned Src, 
+                                       unsigned LabelID, DICompileUnit CU,
                                        unsigned Line, unsigned Col) {
-  DD->RecordInlinedFnStart(I, SP, LabelID, Src, Line, Col);
+  DD->RecordInlinedFnStart(I, SP, LabelID, CU, Line, Col);
 }
 
 /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.

Modified: llvm/branches/Apple/Dib/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/MachineFunction.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/MachineFunction.cpp Fri May  1 03:47:52 2009
@@ -398,9 +398,9 @@
 /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
 /// source file, line, and column. If none currently exists, create a new
 /// DebugLocTuple, and insert it into the DebugIdMap.
-unsigned MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line,
-                                                unsigned Col) {
-  DebugLocTuple Tuple(Src, Line, Col);
+unsigned MachineFunction::getOrCreateDebugLocID(GlobalVariable *CompileUnit,
+                                                unsigned Line, unsigned Col) {
+  DebugLocTuple Tuple(CompileUnit, Line, Col);
   DenseMap<DebugLocTuple, unsigned>::iterator II
     = DebugLocInfo.DebugIdMap.find(Tuple);
   if (II != DebugLocInfo.DebugIdMap.end())

Modified: llvm/branches/Apple/Dib/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/MachineInstr.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/MachineInstr.cpp Fri May  1 03:47:52 2009
@@ -22,6 +22,7 @@
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetInstrDesc.h"
 #include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Support/LeakDetector.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Streams.h"
@@ -977,8 +978,10 @@
   if (!debugLoc.isUnknown()) {
     const MachineFunction *MF = getParent()->getParent();
     DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
+    DICompileUnit CU(DLT.CompileUnit);
+    std::string Dir, Fn;
     OS << " [dbg: "
-       << DLT.Src  << ","
+       << CU.getDirectory(Dir) << '/' << CU.getFilename(Fn) << ","
        << DLT.Line << ","
        << DLT.Col  << "]";
   }

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/FastISel.cpp Fri May  1 03:47:52 2009
@@ -329,13 +329,10 @@
     DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
     if (DW && DW->ValidDebugInfo(SPI->getContext(), CodeGenOpt::None)) {
       DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
-      std::string Dir, FN;
-      unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
-                                                 CU.getFilename(FN));
       unsigned Line = SPI->getLine();
       unsigned Col = SPI->getColumn();
-      unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile);
-      unsigned Idx = MF.getOrCreateDebugLocID(SrcFile, Line, Col);
+      unsigned ID = DW->RecordSourceLine(Line, Col, CU);
+      unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col);
       setCurDebugLoc(DebugLoc::get(Idx));
       const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
       BuildMI(MBB, DL, II).addImm(ID);
@@ -386,9 +383,6 @@
       DebugLoc PrevLoc = DL;
       DISubprogram Subprogram(cast<GlobalVariable>(SP));
       DICompileUnit CompileUnit = Subprogram.getCompileUnit();
-      std::string Dir, FN;
-      unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
-                                                 CompileUnit.getFilename(FN));
 
       if (!Subprogram.describes(MF.getFunction())) {
         // This is a beginning of an inlined function.
@@ -400,21 +394,23 @@
           return true;
         // Record the source line.
         unsigned Line = Subprogram.getLineNumber();
-        unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
-        setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
+        unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit);
+        setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
+                                                CompileUnit.getGV(), Line, 0)));
 
         const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
         BuildMI(MBB, DL, II).addImm(LabelID);
         DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
         DW->RecordInlinedFnStart(FSI, Subprogram, LabelID, 
-                                 PrevLocTpl.Src,
+                                 DICompileUnit(PrevLocTpl.CompileUnit),
                                  PrevLocTpl.Line,
                                  PrevLocTpl.Col);
       } else {
         // Record the source line.
         unsigned Line = Subprogram.getLineNumber();
-        setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
-        DW->RecordSourceLine(Line, 0, SrcFile);
+        setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
+                                                CompileUnit.getGV(), Line, 0)));
+        DW->RecordSourceLine(Line, 0, CompileUnit);
         // llvm.dbg.func_start also defines beginning of function scope.
         DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram()));
       }

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri May  1 03:47:52 2009
@@ -1266,9 +1266,6 @@
       GlobalVariable *CU_GV = cast<GlobalVariable>(DSP->getCompileUnit());
       if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) {
         DICompileUnit CU(cast<GlobalVariable>(DSP->getCompileUnit()));
-        std::string Dir, FN;
-        unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
-                                                   CU.getFilename(FN));
 
         unsigned Line = DSP->getLine();
         unsigned Col = DSP->getColumn();
@@ -1279,10 +1276,10 @@
           if (useDEBUG_LOC) {
             SDValue Ops[] = { Tmp1, DAG.getConstant(Line, MVT::i32),
                               DAG.getConstant(Col, MVT::i32),
-                              DAG.getConstant(SrcFile, MVT::i32) };
+                              DAG.getSrcValue(CU.getGV()) };
             Result = DAG.getNode(ISD::DEBUG_LOC, dl, MVT::Other, Ops, 4);
           } else {
-            unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile);
+            unsigned ID = DW->RecordSourceLine(Line, Col, CU);
             Result = DAG.getLabel(ISD::DBG_LABEL, dl, Tmp1, ID);
           }
         } else {

Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Fri May  1 03:47:52 2009
@@ -337,10 +337,7 @@
             if (DW && DW->ValidDebugInfo(SPI->getContext(),
                                          CodeGenOpt::Default)) {
               DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
-              std::string Dir, FN;
-              unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
-                                                         CU.getFilename(FN));
-              unsigned idx = MF->getOrCreateDebugLocID(SrcFile,
+              unsigned idx = MF->getOrCreateDebugLocID(CU.getGV(),
                                                        SPI->getLine(),
                                                        SPI->getColumn());
               DL = DebugLoc::get(idx);
@@ -357,11 +354,9 @@
               if (DW->ValidDebugInfo(SP, CodeGenOpt::Default)) {
                 DISubprogram Subprogram(cast<GlobalVariable>(SP));
                 DICompileUnit CU(Subprogram.getCompileUnit());
-                std::string Dir, FN;
-                unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
-                                                           CU.getFilename(FN));
                 unsigned Line = Subprogram.getLineNumber();
-                DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0));
+                DL = DebugLoc::get(MF->getOrCreateDebugLocID(CU.getGV(),
+                                                             Line, 0));
               }
             }
 
@@ -3918,10 +3913,7 @@
                                         SPI.getColumn(),
                                         SPI.getContext()));
       DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
-      std::string Dir, FN;
-      unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
-                                                 CU.getFilename(FN));
-      unsigned idx = MF.getOrCreateDebugLocID(SrcFile,
+      unsigned idx = MF.getOrCreateDebugLocID(CU.getGV(),
                                               SPI.getLine(), SPI.getColumn());
       setCurDebugLoc(DebugLoc::get(idx));
     }
@@ -3987,9 +3979,6 @@
         DebugLoc PrevLoc = CurDebugLoc;
         DISubprogram Subprogram(cast<GlobalVariable>(SP));
         DICompileUnit CompileUnit = Subprogram.getCompileUnit();
-        std::string Dir, FN;
-        unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
-                                                   CompileUnit.getFilename(FN));
         
         if (!Subprogram.describes(MF.getFunction())) {
           // This is a beginning of an inlined function.
@@ -4002,21 +3991,23 @@
 
           // Record the source line.
           unsigned Line = Subprogram.getLineNumber();
-          unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
-          setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
+          unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit);
+          setCurDebugLoc(DebugLoc::get(
+                       MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
 
           DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
                                    getRoot(), LabelID));
           DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
           DW->RecordInlinedFnStart(&FSI, Subprogram, LabelID, 
-                                   PrevLocTpl.Src,
+                                   DICompileUnit(PrevLocTpl.CompileUnit),
                                    PrevLocTpl.Line,
                                    PrevLocTpl.Col);
         } else {
           // Record the source line.
           unsigned Line = Subprogram.getLineNumber();
-          setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
-          DW->RecordSourceLine(Line, 0, SrcFile);
+          setCurDebugLoc(DebugLoc::get(
+                       MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
+          DW->RecordSourceLine(Line, 0, CompileUnit);
           // llvm.dbg.func_start also defines beginning of function scope.
           DW->RecordRegionStart(cast<GlobalVariable>(FSI.getSubprogram()));
         }
@@ -4035,15 +4026,13 @@
         // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is
         // what (most?) gdb expects.
         DICompileUnit CompileUnit = Subprogram.getCompileUnit();
-        std::string Dir, FN;
-        unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
-                                                   CompileUnit.getFilename(FN));
         
         // Record the source line but does not create a label for the normal
         // function start. It will be emitted at asm emission time. However,
         // create a label if this is a beginning of inlined function.
         unsigned Line = Subprogram.getLineNumber();
-        setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
+        setCurDebugLoc(DebugLoc::get(
+                       MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
         // FIXME -  Start new region because llvm.dbg.func_start also defines 
         // beginning of function scope.
       }

Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri May  1 03:47:52 2009
@@ -28,6 +28,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/CodeGen/DwarfWriter.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
+#include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetAsmInfo.h"

Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Fri May  1 03:47:52 2009
@@ -26,6 +26,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/CodeGen/DwarfWriter.h"
+#include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetOptions.h"

Modified: llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp?rev=70541&r1=70540&r2=70541&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/branches/Apple/Dib/utils/TableGen/AsmWriterEmitter.cpp Fri May  1 03:47:52 2009
@@ -655,11 +655,11 @@
     << "      DW->ShouldEmitDwarfDebug() && OptLevel != CodeGenOpt::None) {\n"
     << "    DebugLoc CurDL = MI->getDebugLoc();\n\n"
     << "    if (!CurDL.isUnknown()) {\n"
-    << "      static DebugLocTuple PrevDLT(~0U, ~0U, ~0U);\n"
+    << "      static DebugLocTuple PrevDLT(0, ~0U, ~0U);\n"
     << "      DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n"
-    << "      if (PrevDLT.Src != ~0U && PrevDLT != CurDLT)\n"
+    << "      if (PrevDLT.CompileUnit != 0 && PrevDLT != CurDLT)\n"
     << "        printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n"
-    << "                                        CurDLT.Src));\n\n"
+    << "                               DICompileUnit(CurDLT.CompileUnit)));\n\n"
     << "      PrevDLT = CurDLT;\n"
     << "    }\n"
     << "  }\n\n";





More information about the llvm-branch-commits mailing list