LLVM API Documentation
00001 //===-- llvm/CodeGen/DwarfWriter.h - Dwarf Framework ------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains support for writing Dwarf debug and exception info into 00011 // asm files. For Details on the Dwarf 3 specfication see DWARF Debugging 00012 // Information Format V.3 reference manual http://dwarf.freestandards.org , 00013 // 00014 // The role of the Dwarf Writer class is to extract information from the 00015 // MachineModuleInfo object, organize it in Dwarf form and then emit it into asm 00016 // the current asm file using data and high level Dwarf directives. 00017 // 00018 //===----------------------------------------------------------------------===// 00019 00020 #ifndef LLVM_CODEGEN_DWARFWRITER_H 00021 #define LLVM_CODEGEN_DWARFWRITER_H 00022 00023 #include "llvm/Pass.h" 00024 00025 namespace llvm { 00026 00027 class AsmPrinter; 00028 class DwarfDebug; 00029 class DwarfException; 00030 class MachineModuleInfo; 00031 class MachineFunction; 00032 class Value; 00033 class Module; 00034 class GlobalVariable; 00035 class TargetAsmInfo; 00036 class raw_ostream; 00037 00038 //===----------------------------------------------------------------------===// 00039 // DwarfWriter - Emits Dwarf debug and exception handling directives. 00040 // 00041 00042 class DwarfWriter : public ImmutablePass { 00043 private: 00044 /// DD - Provides the DwarfWriter debug implementation. 00045 /// 00046 DwarfDebug *DD; 00047 00048 /// DE - Provides the DwarfWriter exception implementation. 00049 /// 00050 DwarfException *DE; 00051 00052 public: 00053 static char ID; // Pass identification, replacement for typeid 00054 00055 DwarfWriter(); 00056 virtual ~DwarfWriter(); 00057 00058 //===--------------------------------------------------------------------===// 00059 // Main entry points. 00060 // 00061 00062 /// BeginModule - Emit all Dwarf sections that should come prior to the 00063 /// content. 00064 void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS, 00065 AsmPrinter *A, const TargetAsmInfo *T); 00066 00067 /// EndModule - Emit all Dwarf sections that should come after the content. 00068 /// 00069 void EndModule(); 00070 00071 /// BeginFunction - Gather pre-function debug information. Assumes being 00072 /// emitted immediately after the function entry point. 00073 void BeginFunction(MachineFunction *MF); 00074 00075 /// EndFunction - Gather and emit post-function debug information. 00076 /// 00077 void EndFunction(MachineFunction *MF); 00078 00079 /// ValidDebugInfo - Return true if V represents valid debug info value. 00080 bool ValidDebugInfo(Value *V); 00081 00082 /// RecordSourceLine - Register a source line with debug info. Returns a 00083 /// unique label ID used to generate a label and provide correspondence to 00084 /// the source line list. 00085 unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src); 00086 00087 /// RecordSource - Register a source file with debug info. Returns an source 00088 /// ID. 00089 unsigned RecordSource(const std::string &Dir, const std::string &File); 00090 00091 /// RecordRegionStart - Indicate the start of a region. 00092 unsigned RecordRegionStart(GlobalVariable *V); 00093 00094 /// RecordRegionEnd - Indicate the end of a region. 00095 unsigned RecordRegionEnd(GlobalVariable *V); 00096 00097 /// getRecordSourceLineCount - Count source lines. 00098 unsigned getRecordSourceLineCount(); 00099 00100 /// RecordVariable - Indicate the declaration of a local variable. 00101 /// 00102 void RecordVariable(GlobalVariable *GV, unsigned FrameIndex); 00103 00104 }; 00105 00106 00107 } // end llvm namespace 00108 00109 #endif