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 MCAsmInfo *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, MDNode *Scope);
90 /// getRecordSourceLineCount - Count source lines.
91 unsigned getRecordSourceLineCount();
93 /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
95 bool ShouldEmitDwarfDebug() const;
97 void BeginScope(const MachineInstr *MI, unsigned Label);
98 void EndScope(const MachineInstr *MI);
101 } // end llvm namespace