Validate dbg_* intrinsics before lowering them.
[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   /// label. Returns a unique label ID used to generate a label and provide
83   /// correspondence to the source line list.
84   unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
85
86   /// RecordSource - Register a source file with debug info. Returns an source
87   /// ID.
88   unsigned RecordSource(const std::string &Dir, const std::string &File);
89
90   /// RecordRegionStart - Indicate the start of a region.
91   unsigned RecordRegionStart(GlobalVariable *V);
92
93   /// RecordRegionEnd - Indicate the end of a region.
94   unsigned RecordRegionEnd(GlobalVariable *V);
95
96   /// getRecordSourceLineCount - Count source lines.
97   unsigned getRecordSourceLineCount();
98
99   /// RecordVariable - Indicate the declaration of  a local variable.
100   ///
101   void RecordVariable(GlobalVariable *GV, unsigned FrameIndex);
102
103 };
104
105
106 } // end llvm namespace
107
108 #endif