Part 1.
[oota-llvm.git] / include / llvm / CodeGen / DwarfWriter.h
index d5d6925278d682bebc47e53d7b464b71dec3b6a1..facd5f6e6a5fff34d90c85ae36f52a40017c7b71 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by James M. Laskey and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -20,7 +20,8 @@
 #ifndef LLVM_CODEGEN_DWARFWRITER_H
 #define LLVM_CODEGEN_DWARFWRITER_H
 
-#include <iosfwd>
+#include "llvm/Pass.h"
+#include "llvm/Target/TargetMachine.h"
 
 namespace llvm {
 
@@ -29,14 +30,22 @@ class DwarfDebug;
 class DwarfException;
 class MachineModuleInfo;
 class MachineFunction;
+class MachineInstr;
+class Value;
 class Module;
+class GlobalVariable;
 class TargetAsmInfo;
+class raw_ostream;
+class Instruction;
+class DICompileUnit;
+class DISubprogram;
+class DIVariable;
 
 //===----------------------------------------------------------------------===//
 // DwarfWriter - Emits Dwarf debug and exception handling directives.
 //
 
-class DwarfWriter {
+class DwarfWriter : public ImmutablePass {
 private:
   /// DD - Provides the DwarfWriter debug implementation.
   ///
@@ -45,15 +54,12 @@ private:
   /// DE - Provides the DwarfWriter exception implementation.
   ///
   DwarfException *DE;
-  
+
 public:
-  
-  DwarfWriter(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T);
+  static char ID; // Pass identification, replacement for typeid
+
+  DwarfWriter();
   virtual ~DwarfWriter();
-  
-  /// SetModuleInfo - Set machine module info when it's known that pass manager
-  /// has created it.  Set by the target AsmPrinter.
-  void SetModuleInfo(MachineModuleInfo *MMI);
 
   //===--------------------------------------------------------------------===//
   // Main entry points.
@@ -61,7 +67,8 @@ public:
   
   /// BeginModule - Emit all Dwarf sections that should come prior to the
   /// content.
-  void BeginModule(Module *M);
+  void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
+                   AsmPrinter *A, const TargetAsmInfo *T);
   
   /// EndModule - Emit all Dwarf sections that should come after the content.
   ///
@@ -73,7 +80,41 @@ public:
   
   /// EndFunction - Gather and emit post-function debug information.
   ///
-  void EndFunction();
+  void EndFunction(MachineFunction *MF);
+
+  /// 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, DICompileUnit CU);
+
+  /// RecordRegionStart - Indicate the start of a region.
+  unsigned RecordRegionStart(GlobalVariable *V);
+
+  /// RecordRegionEnd - Indicate the end of a region.
+  unsigned RecordRegionEnd(GlobalVariable *V);
+
+  /// getRecordSourceLineCount - Count source lines.
+  unsigned getRecordSourceLineCount();
+
+  /// RecordVariable - Indicate the declaration of  a local variable.
+  ///
+  void RecordVariable(GlobalVariable *GV, unsigned FrameIndex, 
+                      const MachineInstr *MI);
+
+  /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
+  /// be emitted.
+  bool ShouldEmitDwarfDebug() const;
+
+  //// RecordInlinedFnStart - Indicate the start of a inlined function.
+  unsigned RecordInlinedFnStart(DISubprogram SP, DICompileUnit CU,
+                                unsigned Line, unsigned Col);
+
+  /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
+  unsigned RecordInlinedFnEnd(DISubprogram SP);
+
+  /// RecordVariableScope - Record scope for the variable declared by
+  /// DeclareMI. DeclareMI must describe TargetInstrInfo::DECLARE.
+  void RecordVariableScope(DIVariable &DV, const MachineInstr *DeclareMI);
 };