[llvm-commits] [llvm] r62185 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/CodeGen/DwarfWriter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Devang Patel dpatel at apple.com
Tue Jan 13 13:44:10 PST 2009


Author: dpatel
Date: Tue Jan 13 15:44:10 2009
New Revision: 62185

URL: http://llvm.org/viewvc/llvm-project?rev=62185&view=rev
Log:
Use DwarfWriter to record dbg variables.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/include/llvm/CodeGen/DwarfWriter.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=62185&r1=62184&r2=62185&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jan 13 15:44:10 2009
@@ -32,7 +32,7 @@
   class GlobalVariable;
   class MachineConstantPoolEntry;
   class MachineConstantPoolValue;
-  class MachineModuleInfo;
+  class DwarfWriter;
   class Mangler;
   class Section;
   class TargetAsmInfo;
@@ -51,10 +51,10 @@
     ///
     unsigned FunctionNumber;
 
-    /// MachineModuleInfo - This is needed because printDeclare() has to insert
-    /// DebugVariable entries into the dwarf table. This is a short term hack
+    /// DW -This is needed because printDeclare() has to insert
+    /// DbgVariable entries into the dwarf table. This is a short term hack
     /// that ought be fixed soon.
-    MachineModuleInfo *MMI;
+    DwarfWriter *DW;
     
     // GCMetadataPrinters - The garbage collection metadata printer table.
     typedef DenseMap<GCStrategy*,GCMetadataPrinter*> gcp_map_type;

Modified: llvm/trunk/include/llvm/CodeGen/DwarfWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DwarfWriter.h?rev=62185&r1=62184&r2=62185&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DwarfWriter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DwarfWriter.h Tue Jan 13 15:44:10 2009
@@ -93,6 +93,10 @@
   /// getRecordSourceLineCount - Count source lines.
   unsigned getRecordSourceLineCount();
 
+  /// RecordVariable - Indicate the declaration of  a local variable.
+  ///
+  void RecordVariable(GlobalVariable *GV, unsigned FrameIndex);
+
   /// hasDebugInfo - Return true if debug info intrinsics are seen in 
   /// this module.
   bool hasDebugInfo();

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jan 13 15:44:10 2009
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/DwarfWriter.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetAsmInfo.h"
@@ -162,9 +163,9 @@
 
   SwitchToDataSection("");   // Reset back to no section.
   
-  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>();
   if (MMI) MMI->AnalyzeModule(M);
-  
+  DW = getAnalysisToUpdate<DwarfWriter>();
   return false;
 }
 
@@ -1419,9 +1420,9 @@
 /// FIXME: It doesn't really print anything rather it inserts a DebugVariable
 /// entry into dwarf table.
 void AsmPrinter::printDeclare(const MachineInstr *MI) const {
-  int FI = MI->getOperand(0).getIndex();
+  unsigned FI = MI->getOperand(0).getIndex();
   GlobalValue *GV = MI->getOperand(1).getGlobal();
-  MMI->RecordVariable(GV, FI);
+  DW->RecordVariable(cast<GlobalVariable>(GV), FI);
 }
 
 /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Tue Jan 13 15:44:10 2009
@@ -4985,6 +4985,12 @@
   return DD->getRecordSourceLineCount();
 }
 
+/// RecordVariable - Indicate the declaration of  a local variable.
+///
+void DwarfWriter::RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
+  DD->RecordVariable(GV, FrameIndex);
+}
+
 /// hasDebugInfo - Return true if debug info intrinsics are seen in 
 /// this module.
 bool DwarfWriter::hasDebugInfo() {





More information about the llvm-commits mailing list