Remove dead code.
[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
25 namespace llvm {
26
27 class AsmPrinter;
28 class DwarfDebug;
29 class DwarfException;
30 class MachineModuleInfo;
31 class MachineFunction;
32 class Value;
33 class Module;
34 class GlobalVariable;
35 class TargetAsmInfo;
36 class raw_ostream;
37
38 //===----------------------------------------------------------------------===//
39 // DwarfWriter - Emits Dwarf debug and exception handling directives.
40 //
41
42 class DwarfWriter : public ImmutablePass {
43 private:
44   /// DD - Provides the DwarfWriter debug implementation.
45   ///
46   DwarfDebug *DD;
47
48   /// DE - Provides the DwarfWriter exception implementation.
49   ///
50   DwarfException *DE;
51
52 public:
53   static char ID; // Pass identification, replacement for typeid
54
55   DwarfWriter();
56   virtual ~DwarfWriter();
57
58   //===--------------------------------------------------------------------===//
59   // Main entry points.
60   //
61   
62   /// BeginModule - Emit all Dwarf sections that should come prior to the
63   /// content.
64   void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
65                    AsmPrinter *A, const TargetAsmInfo *T);
66   
67   /// EndModule - Emit all Dwarf sections that should come after the content.
68   ///
69   void EndModule();
70   
71   /// BeginFunction - Gather pre-function debug information.  Assumes being 
72   /// emitted immediately after the function entry point.
73   void BeginFunction(MachineFunction *MF);
74   
75   /// EndFunction - Gather and emit post-function debug information.
76   ///
77   void EndFunction(MachineFunction *MF);
78
79   /// ValidDebugInfo - Return true if V represents valid debug info value.
80   bool ValidDebugInfo(Value *V);
81
82   /// RecordSourceLine - Register a source line with debug info. Returns a
83   /// unique label ID used to generate a label and provide correspondence to
84   /// the source line list.
85   unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
86
87   /// getOrCreateSourceID - Look up the source id with the given directory and
88   /// source file names. If none currently exists, create a new id and insert it
89   /// in the SourceIds map. This can update DirectoryIds and SourceFileIds maps
90   /// as well.
91   unsigned getOrCreateSourceID(const std::string &DirName,
92                                const std::string &FileName);
93
94   /// RecordRegionStart - Indicate the start of a region.
95   unsigned RecordRegionStart(GlobalVariable *V);
96
97   /// RecordRegionEnd - Indicate the end of a region.
98   unsigned RecordRegionEnd(GlobalVariable *V);
99
100   /// getRecordSourceLineCount - Count source lines.
101   unsigned getRecordSourceLineCount();
102
103   /// RecordVariable - Indicate the declaration of  a local variable.
104   ///
105   void RecordVariable(GlobalVariable *GV, unsigned FrameIndex);
106
107   /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
108   /// be emitted.
109   bool ShouldEmitDwarfDebug() const;
110 };
111
112
113 } // end llvm namespace
114
115 #endif