LLVM API Documentation

llvm::DwarfWriter Class Reference

#include <DwarfWriter.h>

Inheritance diagram for llvm::DwarfWriter:

Inheritance graph
[legend]
Collaboration diagram for llvm::DwarfWriter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

unsigned getAddressSize () const
 Defaults to ".data".
void PrintHex (int Value) const
 DWContext.
void EOL (const std::string &Comment) const
void EmitAlign (unsigned Alignment) const
void EmitULEB128Bytes (unsigned Value) const
void EmitSLEB128Bytes (int Value) const
void PrintULEB128 (unsigned Value) const
void PrintSLEB128 (int Value) const
void EmitInt8 (int Value) const
void EmitInt16 (int Value) const
void EmitInt32 (int Value) const
void EmitInt64 (uint64_t Value) const
void EmitString (const std::string &String) const
void PrintLabelName (DWLabel Label) const
void PrintLabelName (const char *Tag, unsigned Number) const
void EmitLabel (DWLabel Label) const
void EmitLabel (const char *Tag, unsigned Number) const
void EmitReference (DWLabel Label) const
void EmitReference (const char *Tag, unsigned Number) const
void EmitReference (const std::string &Name) const
void EmitDifference (DWLabel LabelHi, DWLabel LabelLo) const
void EmitDifference (const char *TagHi, unsigned NumberHi, const char *TagLo, unsigned NumberLo) const
unsigned NewAbbreviation (DIEAbbrev *Abbrev)
DWLabel NewString (const std::string &String)
DIE *& getDieMapSlotFor (DebugInfoDesc *DD)
 DwarfWriter (std::ostream &OS, AsmPrinter *A)
virtual ~DwarfWriter ()
void SetDebugInfo (MachineDebugInfo *DI)
void BeginModule (Module *M)
void EndModule ()
void BeginFunction (MachineFunction *MF)
void EndFunction ()
void NonFunction ()

Static Public Member Functions

static unsigned SizeULEB128 (unsigned Value)
static unsigned SizeSLEB128 (int Value)

Protected Attributes

std::ostream & O
AsmPrinterAsm
const TargetDataTD
 TD - Target data.
const MRegisterInfoRI
 RI - Register Information.
ModuleM
MachineFunctionMF
MachineDebugInfoDebugInfo
bool didInitial
bool shouldEmit
unsigned SubprogramCount
std::vector< CompileUnit * > CompileUnits
UniqueVector< DIEAbbrevAbbreviations
UniqueVector< std::string > StringPool
std::map< DebugInfoDesc *,
CompileUnit * > 
DescToUnitMap
std::map< DebugInfoDesc *,
DIE * > 
DescToDieMap
UniqueVector< std::string > SectionMap
std::vector< std::vector<
SourceLineInfo * > > 
SectionSourceLines
unsigned AddressSize
bool hasLEB128
bool hasDotLoc
 Defaults to false.
bool hasDotFile
 Defaults to false.
bool needsSet
 Defaults to false.
const char * DwarfAbbrevSection
 Defaults to false.
const char * DwarfInfoSection
 Defaults to ".debug_abbrev".
const char * DwarfLineSection
 Defaults to ".debug_info".
const char * DwarfFrameSection
 Defaults to ".debug_line".
const char * DwarfPubNamesSection
 Defaults to ".debug_frame".
const char * DwarfPubTypesSection
 Defaults to ".debug_pubnames".
const char * DwarfStrSection
 Defaults to ".debug_pubtypes".
const char * DwarfLocSection
 Defaults to ".debug_str".
const char * DwarfARangesSection
 Defaults to ".debug_loc".
const char * DwarfRangesSection
 Defaults to ".debug_aranges".
const char * DwarfMacInfoSection
 Defaults to ".debug_ranges".
const char * TextSection
 Defaults to ".debug_macinfo".
const char * DataSection
 Defaults to ".text".

Detailed Description

Definition at line 72 of file DwarfWriter.h.


Constructor & Destructor Documentation

DwarfWriter::DwarfWriter ( std::ostream &  OS,
AsmPrinter A 
)

Definition at line 2345 of file DwarfWriter.cpp.

DwarfWriter::~DwarfWriter (  )  [virtual]

Definition at line 2382 of file DwarfWriter.cpp.

References CompileUnits.


Member Function Documentation

unsigned llvm::DwarfWriter::getAddressSize (  )  const [inline]

Defaults to ".data".

getAddressSize - Return the size of a target address in bytes.

Definition at line 235 of file DwarfWriter.h.

References AddressSize.

void DwarfWriter::PrintHex ( int  Value  )  const

DWContext.

PrintHex - Print a value as a hexidecimal value.

Definition at line 951 of file DwarfWriter.cpp.

References O.

Referenced by EmitInt16(), EmitInt32(), EmitInt8(), PrintSLEB128(), and PrintULEB128().

void DwarfWriter::EOL ( const std::string &  Comment  )  const

EOL - Print a newline character to asm stream. If a comment is present then it will be printed first. Comments should not contain '
'.

Definition at line 957 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::CommentString, DwarfVerbose, and O.

Referenced by BeginFunction(), BeginModule(), EndFunction(), and EndModule().

void DwarfWriter::EmitAlign ( unsigned  Alignment  )  const

EmitAlign - Print a align directive.

Definition at line 969 of file DwarfWriter.cpp.

References llvm::AsmPrinter::AlignDirective, Asm, and O.

void DwarfWriter::EmitULEB128Bytes ( unsigned  Value  )  const

EmitULEB128Bytes - Emit an assembler byte data directive to compose an unsigned leb128 value.

Definition at line 975 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::Data8bitsDirective, hasLEB128, O, and PrintULEB128().

void DwarfWriter::EmitSLEB128Bytes ( int  Value  )  const

EmitSLEB128Bytes - print an assembler byte data directive to compose a signed leb128 value.

Definition at line 987 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::Data8bitsDirective, hasLEB128, O, and PrintSLEB128().

void DwarfWriter::PrintULEB128 ( unsigned  Value  )  const

PrintULEB128 - Print a series of hexidecimal values (separated by commas) representing an unsigned leb128 value.

Definition at line 999 of file DwarfWriter.cpp.

References O, and PrintHex().

Referenced by EmitULEB128Bytes().

unsigned DwarfWriter::SizeULEB128 ( unsigned  Value  )  [static]

SizeULEB128 - Compute the number of bytes required for an unsigned leb128 value.

Definition at line 1011 of file DwarfWriter.cpp.

void DwarfWriter::PrintSLEB128 ( int  Value  )  const

PrintSLEB128 - Print a series of hexidecimal values (separated by commas) representing a signed leb128 value.

Definition at line 1022 of file DwarfWriter.cpp.

References O, and PrintHex().

Referenced by EmitSLEB128Bytes().

unsigned DwarfWriter::SizeSLEB128 ( int  Value  )  [static]

SizeSLEB128 - Compute the number of bytes required for a signed leb128 value.

Definition at line 1038 of file DwarfWriter.cpp.

void DwarfWriter::EmitInt8 ( int  Value  )  const

EmitInt8 - Emit a byte directive and value.

Definition at line 1054 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::Data8bitsDirective, O, and PrintHex().

void DwarfWriter::EmitInt16 ( int  Value  )  const

EmitInt16 - Emit a short directive and value.

Definition at line 1061 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::Data16bitsDirective, O, and PrintHex().

void DwarfWriter::EmitInt32 ( int  Value  )  const

EmitInt32 - Emit a long directive and value.

Definition at line 1068 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::Data32bitsDirective, O, and PrintHex().

Referenced by EmitInt64().

void DwarfWriter::EmitInt64 ( uint64_t  Value  )  const

EmitInt64 - Emit a long long directive and value.

Definition at line 1075 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::Data64bitsDirective, EmitInt32(), llvm::TargetData::isBigEndian(), O, and TD.

void DwarfWriter::EmitString ( const std::string &  String  )  const

EmitString - Emit a string with quotes and a null terminator. Special characters are emitted properly. (Eg. '')

Definition at line 1091 of file DwarfWriter.cpp.

References llvm::AsmPrinter::AsciiDirective, Asm, C, and O.

void llvm::DwarfWriter::PrintLabelName ( DWLabel  Label  )  const [inline]

PrintLabelName - Print label name in form used by Dwarf writer.

Definition at line 296 of file DwarfWriter.h.

References llvm::DWLabel::Number, and llvm::DWLabel::Tag.

Referenced by EmitDifference(), EmitLabel(), and EmitReference().

void DwarfWriter::PrintLabelName ( const char *  Tag,
unsigned  Number 
) const

PrintLabelName - Print label name in form used by Dwarf writer.

Definition at line 1124 of file DwarfWriter.cpp.

References Asm, O, and llvm::AsmPrinter::PrivateGlobalPrefix.

void llvm::DwarfWriter::EmitLabel ( DWLabel  Label  )  const [inline]

EmitLabel - Emit location label for internal use by Dwarf.

Definition at line 303 of file DwarfWriter.h.

References llvm::DWLabel::Number, and llvm::DWLabel::Tag.

Referenced by BeginFunction(), EndFunction(), and EndModule().

void DwarfWriter::EmitLabel ( const char *  Tag,
unsigned  Number 
) const

EmitLabel - Emit location label for internal use by Dwarf.

Definition at line 1133 of file DwarfWriter.cpp.

References O, and PrintLabelName().

void llvm::DwarfWriter::EmitReference ( DWLabel  Label  )  const [inline]

EmitReference - Emit a reference to a label.

Definition at line 310 of file DwarfWriter.h.

References llvm::DWLabel::Number, and llvm::DWLabel::Tag.

void DwarfWriter::EmitReference ( const char *  Tag,
unsigned  Number 
) const

EmitReference - Emit a reference to a label.

Definition at line 1140 of file DwarfWriter.cpp.

References AddressSize, Asm, llvm::AsmPrinter::Data32bitsDirective, llvm::AsmPrinter::Data64bitsDirective, O, and PrintLabelName().

void DwarfWriter::EmitReference ( const std::string &  Name  )  const

Definition at line 1148 of file DwarfWriter.cpp.

References AddressSize, Asm, llvm::AsmPrinter::Data32bitsDirective, llvm::AsmPrinter::Data64bitsDirective, and O.

void llvm::DwarfWriter::EmitDifference ( DWLabel  LabelHi,
DWLabel  LabelLo 
) const [inline]

EmitDifference - Emit the difference between two labels. Some assemblers do not behave with absolute expressions with data directives, so there is an option (needsSet) to use an intermediary set expression.

Definition at line 319 of file DwarfWriter.h.

References llvm::DWLabel::Number, and llvm::DWLabel::Tag.

void DwarfWriter::EmitDifference ( const char *  TagHi,
unsigned  NumberHi,
const char *  TagLo,
unsigned  NumberLo 
) const

EmitDifference - Emit an label difference as sizeof(pointer) value. Some assemblers do not accept absolute expressions with data directives, so there is an option (needsSet) to use an intermediary 'set' expression.

Definition at line 1160 of file DwarfWriter.cpp.

References AddressSize, Asm, llvm::AsmPrinter::Data32bitsDirective, llvm::AsmPrinter::Data64bitsDirective, needsSet, O, and PrintLabelName().

unsigned DwarfWriter::NewAbbreviation ( DIEAbbrev Abbrev  ) 

NewAbbreviation - Add the abbreviation to the Abbreviation vector.

Definition at line 1195 of file DwarfWriter.cpp.

References Abbreviations.

DWLabel DwarfWriter::NewString ( const std::string &  String  ) 

NewString - Add a string to the constant pool and returns a label.

Definition at line 1201 of file DwarfWriter.cpp.

References llvm::UniqueVector< T >::insert(), and StringPool.

DIE *& DwarfWriter::getDieMapSlotFor ( DebugInfoDesc DD  ) 

getDieMapSlotFor - Returns the debug information entry map slot for the specified debug descriptor.

Definition at line 1236 of file DwarfWriter.cpp.

References llvm::X86II::DD, and DescToDieMap.

void DwarfWriter::SetDebugInfo ( MachineDebugInfo DI  ) 

SetDebugInfo - Set DebugInfo when it's known that pass manager has created it. Set by the target AsmPrinter.

Definition at line 2390 of file DwarfWriter.cpp.

References DebugInfo, llvm::MachineDebugInfo::hasInfo(), llvm::UniqueVector< T >::insert(), SectionMap, shouldEmit, and TextSection.

Referenced by llvm::X86ATTAsmPrinter::runOnMachineFunction().

void DwarfWriter::BeginModule ( Module M  ) 

BeginModule - Emit all Dwarf sections that should come prior to the content.

Definition at line 2415 of file DwarfWriter.cpp.

References EOL(), and M.

Referenced by llvm::X86SharedAsmPrinter::doInitialization().

void DwarfWriter::EndModule (  ) 

EndModule - Emit all Dwarf sections that should come after the content.

Definition at line 2424 of file DwarfWriter.cpp.

References Asm, DataSection, EmitLabel(), EOL(), SectionMap, llvm::UniqueVector< T >::size(), llvm::AsmPrinter::SwitchToDataSection(), llvm::AsmPrinter::SwitchToTextSection(), and TextSection.

Referenced by llvm::X86SharedAsmPrinter::doFinalization().

void DwarfWriter::BeginFunction ( MachineFunction MF  ) 

BeginFunction - Gather pre-function debug information. Assumes being emitted immediately after the function entry point.

Definition at line 2473 of file DwarfWriter.cpp.

References llvm::MachineDebugInfo::BeginFunction(), DebugInfo, EmitLabel(), EOL(), MF, and SubprogramCount.

Referenced by llvm::X86ATTAsmPrinter::runOnMachineFunction().

void DwarfWriter::EndFunction (  ) 

EndFunction - Gather and emit post-function debug information.

Definition at line 2488 of file DwarfWriter.cpp.

References Asm, llvm::AsmPrinter::CurrentSection, DebugInfo, EmitLabel(), llvm::MachineDebugInfo::EndFunction(), EOL(), llvm::MachineDebugInfo::getRootScope(), llvm::MachineDebugInfo::getSourceLines(), llvm::UniqueVector< T >::insert(), SectionMap, SectionSourceLines, and SubprogramCount.

Referenced by llvm::X86ATTAsmPrinter::runOnMachineFunction().

void llvm::DwarfWriter::NonFunction (  ) 

NonFunction - Function does not have a true body.


Member Data Documentation

std::ostream& llvm::DwarfWriter::O [protected]

O - Stream to .s file.

Definition at line 82 of file DwarfWriter.h.

Referenced by EmitAlign(), EmitDifference(), EmitInt16(), EmitInt32(), EmitInt64(), EmitInt8(), EmitLabel(), EmitReference(), EmitSLEB128Bytes(), EmitString(), EmitULEB128Bytes(), EOL(), PrintHex(), PrintLabelName(), PrintSLEB128(), and PrintULEB128().

AsmPrinter* llvm::DwarfWriter::Asm [protected]

Asm - Target of Dwarf emission.

Definition at line 86 of file DwarfWriter.h.

Referenced by EmitAlign(), EmitDifference(), EmitInt16(), EmitInt32(), EmitInt64(), EmitInt8(), EmitReference(), EmitSLEB128Bytes(), EmitString(), EmitULEB128Bytes(), EndFunction(), EndModule(), EOL(), and PrintLabelName().

const TargetData* llvm::DwarfWriter::TD [protected]

TD - Target data.

Definition at line 89 of file DwarfWriter.h.

Referenced by EmitInt64().

const MRegisterInfo* llvm::DwarfWriter::RI [protected]

RI - Register Information.

Definition at line 92 of file DwarfWriter.h.

Module* llvm::DwarfWriter::M [protected]

M - Current module.

Definition at line 96 of file DwarfWriter.h.

Referenced by BeginModule().

MachineFunction* llvm::DwarfWriter::MF [protected]

MF - Current machine function.

Definition at line 100 of file DwarfWriter.h.

Referenced by BeginFunction().

MachineDebugInfo* llvm::DwarfWriter::DebugInfo [protected]

DebugInfo - Collected debug information.

Definition at line 104 of file DwarfWriter.h.

Referenced by BeginFunction(), EndFunction(), and SetDebugInfo().

bool llvm::DwarfWriter::didInitial [protected]

didInitial - Flag to indicate if initial emission has been done.

Definition at line 108 of file DwarfWriter.h.

bool llvm::DwarfWriter::shouldEmit [protected]

shouldEmit - Flag to indicate if debug information should be emitted.

Definition at line 112 of file DwarfWriter.h.

Referenced by SetDebugInfo().

unsigned llvm::DwarfWriter::SubprogramCount [protected]

SubprogramCount - The running count of functions being compiled.

Definition at line 116 of file DwarfWriter.h.

Referenced by BeginFunction(), and EndFunction().

std::vector<CompileUnit *> llvm::DwarfWriter::CompileUnits [protected]

CompileUnits - All the compile units involved in this build. The index of each entry in this vector corresponds to the sources in DebugInfo.

Definition at line 124 of file DwarfWriter.h.

Referenced by ~DwarfWriter().

UniqueVector<DIEAbbrev> llvm::DwarfWriter::Abbreviations [protected]

Abbreviations - A UniqueVector of TAG structure abbreviations.

Definition at line 128 of file DwarfWriter.h.

Referenced by NewAbbreviation().

UniqueVector<std::string> llvm::DwarfWriter::StringPool [protected]

StringPool - A UniqueVector of strings used by indirect references. UnitMap - Map debug information descriptor to compile unit.

Definition at line 133 of file DwarfWriter.h.

Referenced by NewString().

std::map<DebugInfoDesc *, CompileUnit *> llvm::DwarfWriter::DescToUnitMap [protected]

UnitMap - Map debug information descriptor to compile unit.

Definition at line 137 of file DwarfWriter.h.

std::map<DebugInfoDesc *, DIE *> llvm::DwarfWriter::DescToDieMap [protected]

DescToDieMap - Tracks the mapping of top level debug informaton descriptors to debug information entries.

Definition at line 141 of file DwarfWriter.h.

Referenced by getDieMapSlotFor().

UniqueVector<std::string> llvm::DwarfWriter::SectionMap [protected]

SectionMap - Provides a unique id per text section.

Definition at line 145 of file DwarfWriter.h.

Referenced by EndFunction(), EndModule(), and SetDebugInfo().

std::vector<std::vector<SourceLineInfo *> > llvm::DwarfWriter::SectionSourceLines [protected]

SectionSourceLines - Tracks line numbers per text section.

Definition at line 149 of file DwarfWriter.h.

Referenced by EndFunction().

unsigned llvm::DwarfWriter::AddressSize [protected]

AddressSize - Size of addresses used in file.

Definition at line 158 of file DwarfWriter.h.

Referenced by EmitDifference(), EmitReference(), and getAddressSize().

bool llvm::DwarfWriter::hasLEB128 [protected]

hasLEB128 - True if target asm supports leb128 directives.

Definition at line 162 of file DwarfWriter.h.

Referenced by EmitSLEB128Bytes(), and EmitULEB128Bytes().

bool llvm::DwarfWriter::hasDotLoc [protected]

Defaults to false.

hasDotLoc - True if target asm supports .loc directives.

Definition at line 166 of file DwarfWriter.h.

bool llvm::DwarfWriter::hasDotFile [protected]

Defaults to false.

hasDotFile - True if target asm supports .file directives.

Definition at line 170 of file DwarfWriter.h.

bool llvm::DwarfWriter::needsSet [protected]

Defaults to false.

needsSet - True if target asm can't compute addresses on data directives.

Definition at line 174 of file DwarfWriter.h.

Referenced by EmitDifference(), and llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfAbbrevSection [protected]

Defaults to false.

DwarfAbbrevSection - Section directive for Dwarf abbrev.

Definition at line 178 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfInfoSection [protected]

Defaults to ".debug_abbrev".

DwarfInfoSection - Section directive for Dwarf info.

Definition at line 182 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfLineSection [protected]

Defaults to ".debug_info".

DwarfLineSection - Section directive for Dwarf info.

Definition at line 186 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfFrameSection [protected]

Defaults to ".debug_line".

DwarfFrameSection - Section directive for Dwarf info.

Definition at line 190 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfPubNamesSection [protected]

Defaults to ".debug_frame".

DwarfPubNamesSection - Section directive for Dwarf info.

Definition at line 194 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfPubTypesSection [protected]

Defaults to ".debug_pubnames".

DwarfPubTypesSection - Section directive for Dwarf info.

Definition at line 198 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfStrSection [protected]

Defaults to ".debug_pubtypes".

DwarfStrSection - Section directive for Dwarf info.

Definition at line 202 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfLocSection [protected]

Defaults to ".debug_str".

DwarfLocSection - Section directive for Dwarf info.

Definition at line 206 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfARangesSection [protected]

Defaults to ".debug_loc".

DwarfARangesSection - Section directive for Dwarf info.

Definition at line 210 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfRangesSection [protected]

Defaults to ".debug_aranges".

DwarfRangesSection - Section directive for Dwarf info.

Definition at line 214 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DwarfMacInfoSection [protected]

Defaults to ".debug_ranges".

DwarfMacInfoSection - Section directive for Dwarf info.

Definition at line 218 of file DwarfWriter.h.

Referenced by llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::TextSection [protected]

Defaults to ".debug_macinfo".

TextSection - Section directive for standard text.

Definition at line 222 of file DwarfWriter.h.

Referenced by EndModule(), SetDebugInfo(), and llvm::X86DwarfWriter::X86DwarfWriter().

const char* llvm::DwarfWriter::DataSection [protected]

Defaults to ".text".

DataSection - Section directive for standard data.

Definition at line 226 of file DwarfWriter.h.

Referenced by EndModule(), and llvm::X86DwarfWriter::X86DwarfWriter().


The documentation for this class was generated from the following files: