change AsmPrinter to use DwarfDebug/DwarfException directly
[oota-llvm.git] / include / llvm / CodeGen / DwarfWriter.h
1 //===-- llvm/CodeGen/DwarfWriter.h - Dwarf Framework ------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains support for writing Dwarf debug and exception info into
11 // asm files.  For Details on the Dwarf 3 specfication see DWARF Debugging
12 // Information Format V.3 reference manual http://dwarf.freestandards.org ,
13 //
14 // The role of the Dwarf Writer class is to extract information from the
15 // MachineModuleInfo object, organize it in Dwarf form and then emit it into asm
16 // the current asm file using data and high level Dwarf directives.
17 // 
18 //===----------------------------------------------------------------------===//
19
20 #ifndef LLVM_CODEGEN_DWARFWRITER_H
21 #define LLVM_CODEGEN_DWARFWRITER_H
22
23 #include "llvm/Pass.h"
24 #include "llvm/Target/TargetMachine.h"
25
26 namespace llvm {
27
28 class AsmPrinter;
29 class DwarfDebug;
30 class DwarfException;
31 class MachineModuleInfo;
32 class MachineFunction;
33 class MachineInstr;
34 class Value;
35 class Module;
36 class MDNode;
37 class MCAsmInfo;
38 class MCSymbol;
39 class raw_ostream;
40 class Instruction;
41 class DICompileUnit;
42 class DISubprogram;
43 class DIVariable;
44
45 //===----------------------------------------------------------------------===//
46 // DwarfWriter - Emits Dwarf debug and exception handling directives.
47 //
48
49 class DwarfWriter : public ImmutablePass {
50 private:
51   /// DD - Provides the DwarfWriter debug implementation.
52   ///
53   DwarfDebug *DD;
54
55   /// DE - Provides the DwarfWriter exception implementation.
56   ///
57   DwarfException *DE;
58
59 public:
60   static char ID; // Pass identification, replacement for typeid
61
62   DwarfWriter();
63   virtual ~DwarfWriter();
64
65   //===--------------------------------------------------------------------===//
66   // Main entry points.
67   //
68   
69   /// BeginModule - Emit all Dwarf sections that should come prior to the
70   /// content.
71   void BeginModule(Module *M, AsmPrinter *A);
72   
73   /// EndModule - Emit all Dwarf sections that should come after the content.
74   ///
75   void EndModule();
76   
77   /// BeginFunction - Gather pre-function debug information.  Assumes being 
78   /// emitted immediately after the function entry point.
79   void BeginFunction(const MachineFunction *MF);
80   
81   /// EndFunction - Gather and emit post-function debug information.
82   ///
83   void EndFunction(const MachineFunction *MF);
84
85   /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
86   /// be emitted.
87   bool ShouldEmitDwarfDebug() const;
88
89   void BeginScope(const MachineInstr *MI);
90   void EndScope(const MachineInstr *MI);
91 };
92
93 } // end llvm namespace
94
95 #endif