rename the dwarf class to DwarfPrinter. This matches the filename

and much more accurately describes what it is all about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94233 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-22 22:23:57 +00:00
parent 3c65335f06
commit 066c9acca3
8 changed files with 52 additions and 50 deletions

View File

@ -186,7 +186,7 @@ void DIEValue::dump() {
/// EmitValue - Emit integer of appropriate size. /// EmitValue - Emit integer of appropriate size.
/// ///
void DIEInteger::EmitValue(Dwarf *D, unsigned Form) const { void DIEInteger::EmitValue(DwarfPrinter *D, unsigned Form) const {
const AsmPrinter *Asm = D->getAsm(); const AsmPrinter *Asm = D->getAsm();
unsigned Size = ~0U; unsigned Size = ~0U;
switch (Form) { switch (Form) {
@ -239,7 +239,7 @@ void DIEInteger::print(raw_ostream &O) {
/// EmitValue - Emit string value. /// EmitValue - Emit string value.
/// ///
void DIEString::EmitValue(Dwarf *D, unsigned Form) const { void DIEString::EmitValue(DwarfPrinter *D, unsigned Form) const {
D->getAsm()->EmitString(Str); D->getAsm()->EmitString(Str);
} }
@ -255,7 +255,7 @@ void DIEString::print(raw_ostream &O) {
/// EmitValue - Emit label value. /// EmitValue - Emit label value.
/// ///
void DIEDwarfLabel::EmitValue(Dwarf *D, unsigned Form) const { void DIEDwarfLabel::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4; bool IsSmall = Form == dwarf::DW_FORM_data4;
D->EmitReference(Label, false, IsSmall); D->EmitReference(Label, false, IsSmall);
} }
@ -280,7 +280,7 @@ void DIEDwarfLabel::print(raw_ostream &O) {
/// EmitValue - Emit label value. /// EmitValue - Emit label value.
/// ///
void DIEObjectLabel::EmitValue(Dwarf *D, unsigned Form) const { void DIEObjectLabel::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4; bool IsSmall = Form == dwarf::DW_FORM_data4;
D->EmitReference(Sym, false, IsSmall); D->EmitReference(Sym, false, IsSmall);
} }
@ -304,7 +304,7 @@ void DIEObjectLabel::print(raw_ostream &O) {
/// EmitValue - Emit delta value. /// EmitValue - Emit delta value.
/// ///
void DIESectionOffset::EmitValue(Dwarf *D, unsigned Form) const { void DIESectionOffset::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4; bool IsSmall = Form == dwarf::DW_FORM_data4;
D->EmitSectionOffset(Label.getTag(), Section.getTag(), D->EmitSectionOffset(Label.getTag(), Section.getTag(),
Label.getNumber(), Section.getNumber(), Label.getNumber(), Section.getNumber(),
@ -334,7 +334,7 @@ void DIESectionOffset::print(raw_ostream &O) {
/// EmitValue - Emit delta value. /// EmitValue - Emit delta value.
/// ///
void DIEDelta::EmitValue(Dwarf *D, unsigned Form) const { void DIEDelta::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4; bool IsSmall = Form == dwarf::DW_FORM_data4;
D->EmitDifference(LabelHi, LabelLo, IsSmall); D->EmitDifference(LabelHi, LabelLo, IsSmall);
} }
@ -361,7 +361,7 @@ void DIEDelta::print(raw_ostream &O) {
/// EmitValue - Emit debug information entry offset. /// EmitValue - Emit debug information entry offset.
/// ///
void DIEEntry::EmitValue(Dwarf *D, unsigned Form) const { void DIEEntry::EmitValue(DwarfPrinter *D, unsigned Form) const {
D->getAsm()->EmitInt32(Entry->getOffset()); D->getAsm()->EmitInt32(Entry->getOffset());
} }
@ -389,7 +389,7 @@ unsigned DIEBlock::ComputeSize(const TargetData *TD) {
/// EmitValue - Emit block data. /// EmitValue - Emit block data.
/// ///
void DIEBlock::EmitValue(Dwarf *D, unsigned Form) const { void DIEBlock::EmitValue(DwarfPrinter *D, unsigned Form) const {
const AsmPrinter *Asm = D->getAsm(); const AsmPrinter *Asm = D->getAsm();
switch (Form) { switch (Form) {
case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break; case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break;

View File

@ -23,7 +23,7 @@
namespace llvm { namespace llvm {
class AsmPrinter; class AsmPrinter;
class Dwarf; class DwarfPrinter;
class TargetData; class TargetData;
class MCSymbol; class MCSymbol;
@ -222,7 +222,7 @@ namespace llvm {
/// EmitValue - Emit value via the Dwarf writer. /// EmitValue - Emit value via the Dwarf writer.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const = 0; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const = 0;
/// SizeOf - Return the size of a value in bytes. /// SizeOf - Return the size of a value in bytes.
/// ///
@ -262,7 +262,7 @@ namespace llvm {
/// EmitValue - Emit integer of appropriate size. /// EmitValue - Emit integer of appropriate size.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of integer value in bytes. /// SizeOf - Determine size of integer value in bytes.
/// ///
@ -288,7 +288,7 @@ namespace llvm {
/// EmitValue - Emit string value. /// EmitValue - Emit string value.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of string value in bytes. /// SizeOf - Determine size of string value in bytes.
/// ///
@ -315,7 +315,7 @@ namespace llvm {
/// EmitValue - Emit label value. /// EmitValue - Emit label value.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of label value in bytes. /// SizeOf - Determine size of label value in bytes.
/// ///
@ -341,7 +341,7 @@ namespace llvm {
/// EmitValue - Emit label value. /// EmitValue - Emit label value.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of label value in bytes. /// SizeOf - Determine size of label value in bytes.
/// ///
@ -374,7 +374,7 @@ namespace llvm {
/// EmitValue - Emit section offset. /// EmitValue - Emit section offset.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of section offset value in bytes. /// SizeOf - Determine size of section offset value in bytes.
/// ///
@ -403,7 +403,7 @@ namespace llvm {
/// EmitValue - Emit delta value. /// EmitValue - Emit delta value.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of delta value in bytes. /// SizeOf - Determine size of delta value in bytes.
/// ///
@ -432,7 +432,7 @@ namespace llvm {
/// EmitValue - Emit debug information entry offset. /// EmitValue - Emit debug information entry offset.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of debug information entry in bytes. /// SizeOf - Determine size of debug information entry in bytes.
/// ///
@ -474,7 +474,7 @@ namespace llvm {
/// EmitValue - Emit block data. /// EmitValue - Emit block data.
/// ///
virtual void EmitValue(Dwarf *D, unsigned Form) const; virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of block data in bytes. /// SizeOf - Determine size of block data in bytes.
/// ///

View File

@ -275,7 +275,7 @@ DbgScope::~DbgScope() {
} // end llvm namespace } // end llvm namespace
DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T) DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T)
: Dwarf(OS, A, T, "dbg"), ModuleCU(0), : DwarfPrinter(OS, A, T, "dbg"), ModuleCU(0),
AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(), AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
DIEValues(), StringPool(), DIEValues(), StringPool(),
SectionSourceLines(), didInitial(false), shouldEmit(false), SectionSourceLines(), didInitial(false), shouldEmit(false),

View File

@ -57,7 +57,7 @@ public:
unsigned getLabelID() const { return LabelID; } unsigned getLabelID() const { return LabelID; }
}; };
class DwarfDebug : public Dwarf { class DwarfDebug : public DwarfPrinter {
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// Attributes used to construct specific Dwarf sections. // Attributes used to construct specific Dwarf sections.
// //

View File

@ -38,7 +38,7 @@ using namespace llvm;
DwarfException::DwarfException(raw_ostream &OS, AsmPrinter *A, DwarfException::DwarfException(raw_ostream &OS, AsmPrinter *A,
const MCAsmInfo *T) const MCAsmInfo *T)
: Dwarf(OS, A, T, "eh"), shouldEmitTable(false), shouldEmitMoves(false), : DwarfPrinter(OS, A, T, "eh"), shouldEmitTable(false),shouldEmitMoves(false),
shouldEmitTableModule(false), shouldEmitMovesModule(false), shouldEmitTableModule(false), shouldEmitMovesModule(false),
ExceptionTimer(0) { ExceptionTimer(0) {
if (TimePassesIsEnabled) if (TimePassesIsEnabled)
@ -119,10 +119,10 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
// EH frame header. // EH frame header.
EmitLabel("eh_frame_common_begin", Index); EmitLabel("eh_frame_common_begin", Index);
if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("CIE Identifier Tag");
Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/); Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
Asm->EOL("CIE Identifier Tag"); if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("DW_CIE_VERSION");
Asm->EmitInt8(dwarf::DW_CIE_VERSION); Asm->OutStreamer.EmitIntValue(dwarf::DW_CIE_VERSION, 1/*size*/, 0/*addr*/);
Asm->EOL("CIE Version");
// The personality presence indicates that language specific information will // The personality presence indicates that language specific information will
// show up in the eh frame. Find out how we are supposed to lower the // show up in the eh frame. Find out how we are supposed to lower the

View File

@ -32,7 +32,7 @@ class raw_ostream;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// DwarfException - Emits Dwarf exception handling directives. /// DwarfException - Emits Dwarf exception handling directives.
/// ///
class DwarfException : public Dwarf { class DwarfException : public DwarfPrinter {
struct FunctionEHFrameInfo { struct FunctionEHFrameInfo {
const MCSymbol *FunctionEHSym; // L_foo.eh const MCSymbol *FunctionEHSym; // L_foo.eh
unsigned Number; unsigned Number;

View File

@ -26,13 +26,13 @@
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
using namespace llvm; using namespace llvm;
Dwarf::Dwarf(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T, DwarfPrinter::DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T,
const char *flavor) const char *flavor)
: O(OS), Asm(A), MAI(T), TD(Asm->TM.getTargetData()), : O(OS), Asm(A), MAI(T), TD(Asm->TM.getTargetData()),
RI(Asm->TM.getRegisterInfo()), M(NULL), MF(NULL), MMI(NULL), RI(Asm->TM.getRegisterInfo()), M(NULL), MF(NULL), MMI(NULL),
SubprogramCount(0), Flavor(flavor), SetCounter(1) {} SubprogramCount(0), Flavor(flavor), SetCounter(1) {}
void Dwarf::PrintRelDirective(bool Force32Bit, bool isInSection) const { void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
if (isInSection && MAI->getDwarfSectionOffsetDirective()) if (isInSection && MAI->getDwarfSectionOffsetDirective())
O << MAI->getDwarfSectionOffsetDirective(); O << MAI->getDwarfSectionOffsetDirective();
else if (Force32Bit || TD->getPointerSize() == sizeof(int32_t)) else if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
@ -43,12 +43,12 @@ void Dwarf::PrintRelDirective(bool Force32Bit, bool isInSection) const {
/// PrintLabelName - Print label name in form used by Dwarf writer. /// PrintLabelName - Print label name in form used by Dwarf writer.
/// ///
void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { void DwarfPrinter::PrintLabelName(const char *Tag, unsigned Number) const {
O << MAI->getPrivateGlobalPrefix() << Tag; O << MAI->getPrivateGlobalPrefix() << Tag;
if (Number) O << Number; if (Number) O << Number;
} }
void Dwarf::PrintLabelName(const char *Tag, unsigned Number, void DwarfPrinter::PrintLabelName(const char *Tag, unsigned Number,
const char *Suffix) const { const char *Suffix) const {
O << MAI->getPrivateGlobalPrefix() << Tag; O << MAI->getPrivateGlobalPrefix() << Tag;
if (Number) O << Number; if (Number) O << Number;
O << Suffix; O << Suffix;
@ -56,28 +56,28 @@ void Dwarf::PrintLabelName(const char *Tag, unsigned Number,
/// EmitLabel - Emit location label for internal use by Dwarf. /// EmitLabel - Emit location label for internal use by Dwarf.
/// ///
void Dwarf::EmitLabel(const char *Tag, unsigned Number) const { void DwarfPrinter::EmitLabel(const char *Tag, unsigned Number) const {
PrintLabelName(Tag, Number); PrintLabelName(Tag, Number);
O << ":\n"; O << ":\n";
} }
/// EmitReference - Emit a reference to a label. /// EmitReference - Emit a reference to a label.
/// ///
void Dwarf::EmitReference(const char *Tag, unsigned Number, void DwarfPrinter::EmitReference(const char *Tag, unsigned Number,
bool IsPCRelative, bool Force32Bit) const { bool IsPCRelative, bool Force32Bit) const {
PrintRelDirective(Force32Bit); PrintRelDirective(Force32Bit);
PrintLabelName(Tag, Number); PrintLabelName(Tag, Number);
if (IsPCRelative) O << "-" << MAI->getPCSymbol(); if (IsPCRelative) O << "-" << MAI->getPCSymbol();
} }
void Dwarf::EmitReference(const std::string &Name, bool IsPCRelative, void DwarfPrinter::EmitReference(const std::string &Name, bool IsPCRelative,
bool Force32Bit) const { bool Force32Bit) const {
PrintRelDirective(Force32Bit); PrintRelDirective(Force32Bit);
O << Name; O << Name;
if (IsPCRelative) O << "-" << MAI->getPCSymbol(); if (IsPCRelative) O << "-" << MAI->getPCSymbol();
} }
void Dwarf::EmitReference(const MCSymbol *Sym, bool IsPCRelative, void DwarfPrinter::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
bool Force32Bit) const { bool Force32Bit) const {
PrintRelDirective(Force32Bit); PrintRelDirective(Force32Bit);
O << *Sym; O << *Sym;
if (IsPCRelative) O << "-" << MAI->getPCSymbol(); if (IsPCRelative) O << "-" << MAI->getPCSymbol();
@ -86,9 +86,9 @@ void Dwarf::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
/// EmitDifference - Emit the difference between two labels. Some assemblers do /// EmitDifference - Emit the difference between two labels. Some assemblers do
/// not behave with absolute expressions with data directives, so there is an /// not behave with absolute expressions with data directives, so there is an
/// option (needsSet) to use an intermediary set expression. /// option (needsSet) to use an intermediary set expression.
void Dwarf::EmitDifference(const char *TagHi, unsigned NumberHi, void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi,
const char *TagLo, unsigned NumberLo, const char *TagLo, unsigned NumberLo,
bool IsSmall) { bool IsSmall) {
if (MAI->needsSet()) { if (MAI->needsSet()) {
O << "\t.set\t"; O << "\t.set\t";
PrintLabelName("set", SetCounter, Flavor); PrintLabelName("set", SetCounter, Flavor);
@ -109,10 +109,11 @@ void Dwarf::EmitDifference(const char *TagHi, unsigned NumberHi,
} }
} }
void Dwarf::EmitSectionOffset(const char* Label, const char* Section, void DwarfPrinter::EmitSectionOffset(const char* Label, const char* Section,
unsigned LabelNumber, unsigned SectionNumber, unsigned LabelNumber,
bool IsSmall, bool isEH, unsigned SectionNumber,
bool useSet) { bool IsSmall, bool isEH,
bool useSet) {
bool printAbsolute = false; bool printAbsolute = false;
if (isEH) if (isEH)
printAbsolute = MAI->isAbsoluteEHSectionOffsets(); printAbsolute = MAI->isAbsoluteEHSectionOffsets();
@ -147,8 +148,9 @@ void Dwarf::EmitSectionOffset(const char* Label, const char* Section,
/// EmitFrameMoves - Emit frame instructions to describe the layout of the /// EmitFrameMoves - Emit frame instructions to describe the layout of the
/// frame. /// frame.
void Dwarf::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
const std::vector<MachineMove> &Moves, bool isEH) { const std::vector<MachineMove> &Moves,
bool isEH) {
int stackGrowth = int stackGrowth =
Asm->TM.getFrameInfo()->getStackGrowthDirection() == Asm->TM.getFrameInfo()->getStackGrowthDirection() ==
TargetFrameInfo::StackGrowsUp ? TargetFrameInfo::StackGrowsUp ?

View File

@ -30,7 +30,7 @@ class TargetData;
class TargetRegisterInfo; class TargetRegisterInfo;
class MCSymbol; class MCSymbol;
class Dwarf { class DwarfPrinter {
protected: protected:
//===-------------------------------------------------------------==---===// //===-------------------------------------------------------------==---===//
// Core attributes used by the DWARF printer. // Core attributes used by the DWARF printer.
@ -70,8 +70,8 @@ protected:
/// SetCounter - A unique number for each '.set' directive. /// SetCounter - A unique number for each '.set' directive.
unsigned SetCounter; unsigned SetCounter;
Dwarf(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T, DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T,
const char *flavor); const char *flavor);
public: public:
//===------------------------------------------------------------------===// //===------------------------------------------------------------------===//
// Accessors. // Accessors.