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 ()

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
unsigned SubprogramCount
std::vector< CompileUnit * > CompileUnits
UniqueVector< DIEAbbrevAbbreviations
UniqueVector< std::string > StringPool
std::map< DebugInfoDesc *,
CompileUnit * > 
DescToUnitMap
std::map< DebugInfoDesc *,
DIE * > 
DescToDieMap
std::map< Type *, DIE * > TypeToDieMap
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 71 of file DwarfWriter.h.


Constructor & Destructor Documentation

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

Definition at line 2321 of file DwarfWriter.cpp.

DwarfWriter::~DwarfWriter (  )  [virtual]

Definition at line 2356 of file DwarfWriter.cpp.

References CompileUnits.


Member Function Documentation

void DwarfWriter::BeginFunction ( MachineFunction MF  ) 

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

Definition at line 2422 of file DwarfWriter.cpp.

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

Referenced by llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().

void DwarfWriter::BeginModule ( Module M  ) 

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

Definition at line 2370 of file DwarfWriter.cpp.

References EOL(), and M.

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

void DwarfWriter::EmitAlign ( unsigned  Alignment  )  const

EmitAlign - Print a align directive.

Definition at line 968 of file DwarfWriter.cpp.

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

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 1159 of file DwarfWriter.cpp.

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

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 310 of file DwarfWriter.h.

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

void DwarfWriter::EmitInt16 ( int  Value  )  const

EmitInt16 - Emit a short directive and value.

Definition at line 1060 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 1067 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 1074 of file DwarfWriter.cpp.

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

void DwarfWriter::EmitInt8 ( int  Value  )  const

EmitInt8 - Emit a byte directive and value.

Definition at line 1053 of file DwarfWriter.cpp.

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

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

EmitLabel - Emit location label for internal use by Dwarf.

Definition at line 1132 of file DwarfWriter.cpp.

References O, and PrintLabelName().

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

EmitLabel - Emit location label for internal use by Dwarf.

Definition at line 294 of file DwarfWriter.h.

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

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

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

Definition at line 1147 of file DwarfWriter.cpp.

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

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

EmitReference - Emit a reference to a label.

Definition at line 1139 of file DwarfWriter.cpp.

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

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

EmitReference - Emit a reference to a label.

Definition at line 301 of file DwarfWriter.h.

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

void DwarfWriter::EmitSLEB128Bytes ( int  Value  )  const

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

Definition at line 986 of file DwarfWriter.cpp.

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

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 1090 of file DwarfWriter.cpp.

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

void DwarfWriter::EmitULEB128Bytes ( unsigned  Value  )  const

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

Definition at line 974 of file DwarfWriter.cpp.

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

void DwarfWriter::EndFunction (  ) 

EndFunction - Gather and emit post-function debug information.

Definition at line 2437 of file DwarfWriter.cpp.

References DebugInfo, EmitLabel(), llvm::MachineDebugInfo::EndFunction(), EOL(), llvm::MachineDebugInfo::getRootScope(), and SubprogramCount.

Referenced by llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().

void DwarfWriter::EndModule (  ) 

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

Definition at line 2379 of file DwarfWriter.cpp.

References Asm, DataSection, EmitLabel(), EOL(), llvm::AsmPrinter::SwitchSection(), and TextSection.

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

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 956 of file DwarfWriter.cpp.

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

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

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

Defaults to ".data".

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

Definition at line 227 of file DwarfWriter.h.

References AddressSize.

DIE *& DwarfWriter::getDieMapSlotFor ( DebugInfoDesc DD  ) 

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

Definition at line 1235 of file DwarfWriter.cpp.

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

unsigned DwarfWriter::NewAbbreviation ( DIEAbbrev Abbrev  ) 

NewAbbreviation - Add the abbreviation to the Abbreviation vector.

Definition at line 1194 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 1200 of file DwarfWriter.cpp.

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

void DwarfWriter::PrintHex ( int  Value  )  const

DWContext.

PrintHex - Print a value as a hexidecimal value.

Definition at line 950 of file DwarfWriter.cpp.

References O.

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

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

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

Definition at line 1123 of file DwarfWriter.cpp.

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

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

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

Definition at line 287 of file DwarfWriter.h.

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

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

void DwarfWriter::PrintSLEB128 ( int  Value  )  const

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

Definition at line 1021 of file DwarfWriter.cpp.

References O, and PrintHex().

Referenced by EmitSLEB128Bytes().

void DwarfWriter::PrintULEB128 ( unsigned  Value  )  const

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

Definition at line 998 of file DwarfWriter.cpp.

References O, and PrintHex().

Referenced by EmitULEB128Bytes().

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 2364 of file DwarfWriter.cpp.

References DebugInfo.

Referenced by llvm::X86IntelAsmPrinter::runOnMachineFunction(), and llvm::X86ATTAsmPrinter::runOnMachineFunction().

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

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

Definition at line 1037 of file DwarfWriter.cpp.

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

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

Definition at line 1010 of file DwarfWriter.cpp.


Member Data Documentation

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

Abbreviations - A UniqueVector of TAG structure abbreviations.

Definition at line 123 of file DwarfWriter.h.

Referenced by NewAbbreviation().

unsigned llvm::DwarfWriter::AddressSize [protected]

AddressSize - Size of addresses used in file.

Definition at line 150 of file DwarfWriter.h.

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

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

Asm - Target of Dwarf emission.

Definition at line 85 of file DwarfWriter.h.

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

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 119 of file DwarfWriter.h.

Referenced by ~DwarfWriter().

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

Defaults to ".text".

DataSection - Section directive for standard data.

Definition at line 218 of file DwarfWriter.h.

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

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

DebugInfo - Collected debug information.

Definition at line 103 of file DwarfWriter.h.

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

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 136 of file DwarfWriter.h.

Referenced by getDieMapSlotFor().

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

UnitMap - Map debug information descriptor to compile unit.

Definition at line 132 of file DwarfWriter.h.

bool llvm::DwarfWriter::didInitial [protected]

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

Definition at line 107 of file DwarfWriter.h.

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

Defaults to false.

DwarfAbbrevSection - Section directive for Dwarf abbrev.

Definition at line 170 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 202 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 182 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 174 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 178 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 198 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 210 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 186 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 190 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 206 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 194 of file DwarfWriter.h.

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

bool llvm::DwarfWriter::hasDotFile [protected]

Defaults to false.

hasDotFile - True if target asm supports .file directives.

Definition at line 162 of file DwarfWriter.h.

bool llvm::DwarfWriter::hasDotLoc [protected]

Defaults to false.

hasDotLoc - True if target asm supports .loc directives.

Definition at line 158 of file DwarfWriter.h.

bool llvm::DwarfWriter::hasLEB128 [protected]

hasLEB128 - True if target asm supports leb128 directives.

Definition at line 154 of file DwarfWriter.h.

Referenced by EmitSLEB128Bytes(), and EmitULEB128Bytes().

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

M - Current module.

Definition at line 95 of file DwarfWriter.h.

Referenced by BeginModule().

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

MF - Current machine function.

Definition at line 99 of file DwarfWriter.h.

Referenced by BeginFunction().

bool llvm::DwarfWriter::needsSet [protected]

Defaults to false.

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

Definition at line 166 of file DwarfWriter.h.

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

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

O - Stream to .s file.

Definition at line 81 of file DwarfWriter.h.

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

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

RI - Register Information.

Definition at line 91 of file DwarfWriter.h.

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 128 of file DwarfWriter.h.

Referenced by NewString().

unsigned llvm::DwarfWriter::SubprogramCount [protected]

SubprogramCount - The running count of functions being compiled.

Definition at line 111 of file DwarfWriter.h.

Referenced by BeginFunction(), and EndFunction().

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

TD - Target data.

Definition at line 88 of file DwarfWriter.h.

Referenced by EmitInt64().

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

Defaults to ".debug_macinfo".

TextSection - Section directive for standard text.

Definition at line 214 of file DwarfWriter.h.

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

std::map<Type *, DIE *> llvm::DwarfWriter::TypeToDieMap [protected]

TypeToDieMap - Type to DIEType map.

Definition at line 141 of file DwarfWriter.h.


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