1 //===-- llvm/CodeGen/DwarfWriter.h - Dwarf Framework ------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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 ,
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.
18 //===----------------------------------------------------------------------===//
20 #ifndef LLVM_CODEGEN_DWARFWRITER_H
21 #define LLVM_CODEGEN_DWARFWRITER_H
23 #include "llvm/Pass.h"
24 #include "llvm/Target/TargetMachine.h"
31 class MachineModuleInfo;
32 class MachineFunction;
44 //===----------------------------------------------------------------------===//
45 // DwarfWriter - Emits Dwarf debug and exception handling directives.
48 class DwarfWriter : public ImmutablePass {
50 /// DD - Provides the DwarfWriter debug implementation.
54 /// DE - Provides the DwarfWriter exception implementation.
59 static char ID; // Pass identification, replacement for typeid
62 virtual ~DwarfWriter();
64 //===--------------------------------------------------------------------===//
68 /// BeginModule - Emit all Dwarf sections that should come prior to the
70 void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
71 AsmPrinter *A, const TargetAsmInfo *T);
73 /// EndModule - Emit all Dwarf sections that should come after the content.
77 /// BeginFunction - Gather pre-function debug information. Assumes being
78 /// emitted immediately after the function entry point.
79 void BeginFunction(MachineFunction *MF);
81 /// EndFunction - Gather and emit post-function debug information.
83 void EndFunction(MachineFunction *MF);
85 /// RecordSourceLine - Register a source line with debug info. Returns a
86 /// unique label ID used to generate a label and provide correspondence to
87 /// the source line list.
88 unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU);
90 /// RecordRegionStart - Indicate the start of a region.
91 unsigned RecordRegionStart(GlobalVariable *V);
93 /// RecordRegionEnd - Indicate the end of a region.
94 unsigned RecordRegionEnd(GlobalVariable *V);
96 /// getRecordSourceLineCount - Count source lines.
97 unsigned getRecordSourceLineCount();
99 /// RecordVariable - Indicate the declaration of a local variable.
101 void RecordVariable(GlobalVariable *GV, unsigned FrameIndex,
102 const MachineInstr *MI);
104 /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
106 bool ShouldEmitDwarfDebug() const;
108 //// RecordInlinedFnStart - Indicate the start of a inlined function.
109 unsigned RecordInlinedFnStart(DISubprogram SP, DICompileUnit CU,
110 unsigned Line, unsigned Col);
112 /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
113 unsigned RecordInlinedFnEnd(DISubprogram SP);
115 /// RecordVariableScope - Record scope for the variable declared by
116 /// DeclareMI. DeclareMI must describe TargetInstrInfo::DECLARE.
117 void RecordVariableScope(DIVariable &DV, const MachineInstr *DeclareMI);
121 } // end llvm namespace