2005-12-21 19:44:40 +00:00
|
|
|
//===-- llvm/CodeGen/DwarfWriter.h - Dwarf Framework ------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 19:59:42 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-12-21 19:44:40 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2007-01-29 18:51:14 +00:00
|
|
|
// This file contains support for writing Dwarf debug and exception info into
|
|
|
|
// asm files. For Details on the Dwarf 3 specfication see DWARF Debugging
|
|
|
|
// Information Format V.3 reference manual http://dwarf.freestandards.org ,
|
2005-12-21 19:44:40 +00:00
|
|
|
//
|
2007-01-29 18:51:14 +00:00
|
|
|
// The role of the Dwarf Writer class is to extract information from the
|
2007-01-26 21:22:28 +00:00
|
|
|
// MachineModuleInfo object, organize it in Dwarf form and then emit it into asm
|
2006-01-17 17:31:53 +00:00
|
|
|
// the current asm file using data and high level Dwarf directives.
|
|
|
|
//
|
2005-12-21 19:44:40 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2006-01-17 19:12:24 +00:00
|
|
|
#ifndef LLVM_CODEGEN_DWARFWRITER_H
|
|
|
|
#define LLVM_CODEGEN_DWARFWRITER_H
|
2005-12-21 19:44:40 +00:00
|
|
|
|
2009-01-08 23:40:34 +00:00
|
|
|
#include "llvm/Pass.h"
|
|
|
|
|
2005-12-21 19:46:32 +00:00
|
|
|
namespace llvm {
|
2006-02-27 12:43:29 +00:00
|
|
|
|
|
|
|
class AsmPrinter;
|
2007-01-29 18:51:14 +00:00
|
|
|
class DwarfDebug;
|
|
|
|
class DwarfException;
|
2007-01-26 21:22:28 +00:00
|
|
|
class MachineModuleInfo;
|
2006-02-27 12:43:29 +00:00
|
|
|
class MachineFunction;
|
2009-04-15 00:10:26 +00:00
|
|
|
class MachineInstr;
|
2009-01-15 23:41:32 +00:00
|
|
|
class Value;
|
2006-02-27 12:43:29 +00:00
|
|
|
class Module;
|
2009-01-12 19:17:34 +00:00
|
|
|
class GlobalVariable;
|
2006-09-06 18:34:40 +00:00
|
|
|
class TargetAsmInfo;
|
2008-08-21 00:14:44 +00:00
|
|
|
class raw_ostream;
|
2009-04-15 00:10:26 +00:00
|
|
|
class Instruction;
|
|
|
|
class DISubprogram;
|
|
|
|
class DIVariable;
|
2006-02-27 12:43:29 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// DwarfWriter - Emits Dwarf debug and exception handling directives.
|
|
|
|
//
|
2006-01-17 17:31:53 +00:00
|
|
|
|
2009-01-08 23:40:34 +00:00
|
|
|
class DwarfWriter : public ImmutablePass {
|
2006-02-22 19:02:11 +00:00
|
|
|
private:
|
2007-01-29 18:51:14 +00:00
|
|
|
/// DD - Provides the DwarfWriter debug implementation.
|
2006-02-27 12:43:29 +00:00
|
|
|
///
|
2007-01-29 18:51:14 +00:00
|
|
|
DwarfDebug *DD;
|
|
|
|
|
|
|
|
/// DE - Provides the DwarfWriter exception implementation.
|
|
|
|
///
|
|
|
|
DwarfException *DE;
|
2009-02-24 02:35:30 +00:00
|
|
|
|
2006-02-27 12:43:29 +00:00
|
|
|
public:
|
2009-01-08 23:40:34 +00:00
|
|
|
static char ID; // Pass identification, replacement for typeid
|
|
|
|
|
|
|
|
DwarfWriter();
|
2006-02-27 12:43:29 +00:00
|
|
|
virtual ~DwarfWriter();
|
2009-03-10 20:41:52 +00:00
|
|
|
|
2006-02-27 12:43:29 +00:00
|
|
|
//===--------------------------------------------------------------------===//
|
|
|
|
// Main entry points.
|
|
|
|
//
|
|
|
|
|
|
|
|
/// BeginModule - Emit all Dwarf sections that should come prior to the
|
|
|
|
/// content.
|
2009-01-08 23:40:34 +00:00
|
|
|
void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
|
|
|
|
AsmPrinter *A, const TargetAsmInfo *T);
|
2006-02-27 12:43:29 +00:00
|
|
|
|
|
|
|
/// EndModule - Emit all Dwarf sections that should come after the content.
|
|
|
|
///
|
2006-03-23 18:07:55 +00:00
|
|
|
void EndModule();
|
2006-02-27 12:43:29 +00:00
|
|
|
|
2006-04-07 20:44:42 +00:00
|
|
|
/// BeginFunction - Gather pre-function debug information. Assumes being
|
|
|
|
/// emitted immediately after the function entry point.
|
2006-06-23 12:51:53 +00:00
|
|
|
void BeginFunction(MachineFunction *MF);
|
2006-02-27 12:43:29 +00:00
|
|
|
|
|
|
|
/// EndFunction - Gather and emit post-function debug information.
|
|
|
|
///
|
2008-09-26 00:28:12 +00:00
|
|
|
void EndFunction(MachineFunction *MF);
|
2009-01-12 19:17:34 +00:00
|
|
|
|
2009-01-15 23:41:32 +00:00
|
|
|
/// ValidDebugInfo - Return true if V represents valid debug info value.
|
2009-04-13 18:13:16 +00:00
|
|
|
bool ValidDebugInfo(Value *V, bool FastISel);
|
2009-01-12 19:17:34 +00:00
|
|
|
|
2009-01-26 07:40:13 +00:00
|
|
|
/// RecordSourceLine - Register a source line with debug info. Returns a
|
|
|
|
/// unique label ID used to generate a label and provide correspondence to
|
|
|
|
/// the source line list.
|
2009-01-12 19:17:34 +00:00
|
|
|
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
|
|
|
|
|
2009-02-25 07:04:34 +00:00
|
|
|
/// getOrCreateSourceID - Look up the source id with the given directory and
|
|
|
|
/// source file names. If none currently exists, create a new id and insert it
|
|
|
|
/// in the SourceIds map. This can update DirectoryIds and SourceFileIds maps
|
|
|
|
/// as well.
|
|
|
|
unsigned getOrCreateSourceID(const std::string &DirName,
|
|
|
|
const std::string &FileName);
|
2009-01-12 19:17:34 +00:00
|
|
|
|
|
|
|
/// RecordRegionStart - Indicate the start of a region.
|
|
|
|
unsigned RecordRegionStart(GlobalVariable *V);
|
|
|
|
|
|
|
|
/// RecordRegionEnd - Indicate the end of a region.
|
|
|
|
unsigned RecordRegionEnd(GlobalVariable *V);
|
|
|
|
|
|
|
|
/// getRecordSourceLineCount - Count source lines.
|
|
|
|
unsigned getRecordSourceLineCount();
|
|
|
|
|
2009-01-13 21:44:10 +00:00
|
|
|
/// RecordVariable - Indicate the declaration of a local variable.
|
|
|
|
///
|
2009-04-15 00:10:26 +00:00
|
|
|
void RecordVariable(GlobalVariable *GV, unsigned FrameIndex,
|
|
|
|
const MachineInstr *MI);
|
2009-01-13 21:44:10 +00:00
|
|
|
|
2009-02-20 00:44:43 +00:00
|
|
|
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
|
|
|
|
/// be emitted.
|
|
|
|
bool ShouldEmitDwarfDebug() const;
|
2009-04-13 17:02:03 +00:00
|
|
|
|
2009-04-15 00:10:26 +00:00
|
|
|
//// RecordInlinedFnStart - Indicate the start of a inlined function.
|
|
|
|
void RecordInlinedFnStart(Instruction *I, DISubprogram &SP, unsigned LabelID,
|
|
|
|
unsigned Src, unsigned Line, unsigned Col);
|
|
|
|
|
|
|
|
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
|
|
|
|
unsigned RecordInlinedFnEnd(DISubprogram &SP);
|
|
|
|
|
|
|
|
/// RecordVariableScope - Record scope for the variable declared by
|
|
|
|
/// DeclareMI. DeclareMI must describe TargetInstrInfo::DECLARE.
|
|
|
|
void RecordVariableScope(DIVariable &DV, const MachineInstr *DeclareMI);
|
2006-02-27 12:43:29 +00:00
|
|
|
};
|
2005-12-21 19:44:40 +00:00
|
|
|
|
2006-10-30 13:35:07 +00:00
|
|
|
|
2005-12-21 19:46:32 +00:00
|
|
|
} // end llvm namespace
|
2005-12-21 19:44:40 +00:00
|
|
|
|
2005-12-22 01:40:06 +00:00
|
|
|
#endif
|