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"
30 class MachineModuleInfo;
31 class MachineFunction;
38 //===----------------------------------------------------------------------===//
39 // DwarfWriter - Emits Dwarf debug and exception handling directives.
42 class DwarfWriter : public ImmutablePass {
44 /// DD - Provides the DwarfWriter debug implementation.
48 /// DE - Provides the DwarfWriter exception implementation.
53 static char ID; // Pass identification, replacement for typeid
56 virtual ~DwarfWriter();
58 //===--------------------------------------------------------------------===//
62 /// BeginModule - Emit all Dwarf sections that should come prior to the
64 void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
65 AsmPrinter *A, const TargetAsmInfo *T);
67 /// EndModule - Emit all Dwarf sections that should come after the content.
71 /// BeginFunction - Gather pre-function debug information. Assumes being
72 /// emitted immediately after the function entry point.
73 void BeginFunction(MachineFunction *MF);
75 /// EndFunction - Gather and emit post-function debug information.
77 void EndFunction(MachineFunction *MF);
79 /// ValidDebugInfo - Return true if V represents valid debug info value.
80 bool ValidDebugInfo(Value *V);
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);
87 /// RecordSource - Register a source file with debug info. Returns an source
89 unsigned RecordSource(const std::string &Dir, const std::string &File);
91 /// RecordRegionStart - Indicate the start of a region.
92 unsigned RecordRegionStart(GlobalVariable *V);
94 /// RecordRegionEnd - Indicate the end of a region.
95 unsigned RecordRegionEnd(GlobalVariable *V);
97 /// getRecordSourceLineCount - Count source lines.
98 unsigned getRecordSourceLineCount();
100 /// RecordVariable - Indicate the declaration of a local variable.
102 void RecordVariable(GlobalVariable *GV, unsigned FrameIndex);
107 } // end llvm namespace