From 066c9acca354e88c19ce740a7ff0e5910362aa7b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 22 Jan 2010 22:23:57 +0000 Subject: [PATCH] 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 --- lib/CodeGen/AsmPrinter/DIE.cpp | 16 ++++---- lib/CodeGen/AsmPrinter/DIE.h | 20 +++++----- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 +- lib/CodeGen/AsmPrinter/DwarfDebug.h | 2 +- lib/CodeGen/AsmPrinter/DwarfException.cpp | 8 ++-- lib/CodeGen/AsmPrinter/DwarfException.h | 2 +- lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 46 ++++++++++++----------- lib/CodeGen/AsmPrinter/DwarfPrinter.h | 6 +-- 8 files changed, 52 insertions(+), 50 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index 509edf4bc74..9b37963d206 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -186,7 +186,7 @@ void DIEValue::dump() { /// 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(); unsigned Size = ~0U; switch (Form) { @@ -239,7 +239,7 @@ void DIEInteger::print(raw_ostream &O) { /// EmitValue - Emit string value. /// -void DIEString::EmitValue(Dwarf *D, unsigned Form) const { +void DIEString::EmitValue(DwarfPrinter *D, unsigned Form) const { D->getAsm()->EmitString(Str); } @@ -255,7 +255,7 @@ void DIEString::print(raw_ostream &O) { /// 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; D->EmitReference(Label, false, IsSmall); } @@ -280,7 +280,7 @@ void DIEDwarfLabel::print(raw_ostream &O) { /// 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; D->EmitReference(Sym, false, IsSmall); } @@ -304,7 +304,7 @@ void DIEObjectLabel::print(raw_ostream &O) { /// 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; D->EmitSectionOffset(Label.getTag(), Section.getTag(), Label.getNumber(), Section.getNumber(), @@ -334,7 +334,7 @@ void DIESectionOffset::print(raw_ostream &O) { /// 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; D->EmitDifference(LabelHi, LabelLo, IsSmall); } @@ -361,7 +361,7 @@ void DIEDelta::print(raw_ostream &O) { /// 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()); } @@ -389,7 +389,7 @@ unsigned DIEBlock::ComputeSize(const TargetData *TD) { /// 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(); switch (Form) { case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break; diff --git a/lib/CodeGen/AsmPrinter/DIE.h b/lib/CodeGen/AsmPrinter/DIE.h index ac9370405d1..2a03dee4b1d 100644 --- a/lib/CodeGen/AsmPrinter/DIE.h +++ b/lib/CodeGen/AsmPrinter/DIE.h @@ -23,7 +23,7 @@ namespace llvm { class AsmPrinter; - class Dwarf; + class DwarfPrinter; class TargetData; class MCSymbol; @@ -222,7 +222,7 @@ namespace llvm { /// 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. /// @@ -262,7 +262,7 @@ namespace llvm { /// 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. /// @@ -288,7 +288,7 @@ namespace llvm { /// 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. /// @@ -315,7 +315,7 @@ namespace llvm { /// 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. /// @@ -341,7 +341,7 @@ namespace llvm { /// 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. /// @@ -374,7 +374,7 @@ namespace llvm { /// 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. /// @@ -403,7 +403,7 @@ namespace llvm { /// 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. /// @@ -432,7 +432,7 @@ namespace llvm { /// 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. /// @@ -474,7 +474,7 @@ namespace llvm { /// 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. /// diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 7717922305f..cd4b66fcdc6 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -275,7 +275,7 @@ DbgScope::~DbgScope() { } // end llvm namespace 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(), DIEValues(), StringPool(), SectionSourceLines(), didInitial(false), shouldEmit(false), diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index fb6cb1ce29b..e723621ce99 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -57,7 +57,7 @@ public: unsigned getLabelID() const { return LabelID; } }; -class DwarfDebug : public Dwarf { +class DwarfDebug : public DwarfPrinter { //===--------------------------------------------------------------------===// // Attributes used to construct specific Dwarf sections. // diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 7cb80a65678..9f5311401f1 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -38,7 +38,7 @@ using namespace llvm; DwarfException::DwarfException(raw_ostream &OS, AsmPrinter *A, 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), ExceptionTimer(0) { if (TimePassesIsEnabled) @@ -119,10 +119,10 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) { // EH frame header. EmitLabel("eh_frame_common_begin", Index); + if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("CIE Identifier Tag"); Asm->OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/); - Asm->EOL("CIE Identifier Tag"); - Asm->EmitInt8(dwarf::DW_CIE_VERSION); - Asm->EOL("CIE Version"); + if (Asm->VerboseAsm) Asm->OutStreamer.AddComment("DW_CIE_VERSION"); + Asm->OutStreamer.EmitIntValue(dwarf::DW_CIE_VERSION, 1/*size*/, 0/*addr*/); // The personality presence indicates that language specific information will // show up in the eh frame. Find out how we are supposed to lower the diff --git a/lib/CodeGen/AsmPrinter/DwarfException.h b/lib/CodeGen/AsmPrinter/DwarfException.h index c674fe590c9..143e0e02d5f 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.h +++ b/lib/CodeGen/AsmPrinter/DwarfException.h @@ -32,7 +32,7 @@ class raw_ostream; //===----------------------------------------------------------------------===// /// DwarfException - Emits Dwarf exception handling directives. /// -class DwarfException : public Dwarf { +class DwarfException : public DwarfPrinter { struct FunctionEHFrameInfo { const MCSymbol *FunctionEHSym; // L_foo.eh unsigned Number; diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index d0501c9570b..f50c684e352 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -26,13 +26,13 @@ #include "llvm/Support/ErrorHandling.h" using namespace llvm; -Dwarf::Dwarf(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T, - const char *flavor) +DwarfPrinter::DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T, + const char *flavor) : O(OS), Asm(A), MAI(T), TD(Asm->TM.getTargetData()), RI(Asm->TM.getRegisterInfo()), M(NULL), MF(NULL), MMI(NULL), 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()) O << MAI->getDwarfSectionOffsetDirective(); 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. /// -void Dwarf::PrintLabelName(const char *Tag, unsigned Number) const { +void DwarfPrinter::PrintLabelName(const char *Tag, unsigned Number) const { O << MAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; } -void Dwarf::PrintLabelName(const char *Tag, unsigned Number, - const char *Suffix) const { +void DwarfPrinter::PrintLabelName(const char *Tag, unsigned Number, + const char *Suffix) const { O << MAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; O << Suffix; @@ -56,28 +56,28 @@ void Dwarf::PrintLabelName(const char *Tag, unsigned Number, /// 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); O << ":\n"; } /// EmitReference - Emit a reference to a label. /// -void Dwarf::EmitReference(const char *Tag, unsigned Number, - bool IsPCRelative, bool Force32Bit) const { +void DwarfPrinter::EmitReference(const char *Tag, unsigned Number, + bool IsPCRelative, bool Force32Bit) const { PrintRelDirective(Force32Bit); PrintLabelName(Tag, Number); if (IsPCRelative) O << "-" << MAI->getPCSymbol(); } -void Dwarf::EmitReference(const std::string &Name, bool IsPCRelative, - bool Force32Bit) const { +void DwarfPrinter::EmitReference(const std::string &Name, bool IsPCRelative, + bool Force32Bit) const { PrintRelDirective(Force32Bit); O << Name; if (IsPCRelative) O << "-" << MAI->getPCSymbol(); } -void Dwarf::EmitReference(const MCSymbol *Sym, bool IsPCRelative, - bool Force32Bit) const { +void DwarfPrinter::EmitReference(const MCSymbol *Sym, bool IsPCRelative, + bool Force32Bit) const { PrintRelDirective(Force32Bit); O << *Sym; 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 /// not behave with absolute expressions with data directives, so there is an /// option (needsSet) to use an intermediary set expression. -void Dwarf::EmitDifference(const char *TagHi, unsigned NumberHi, - const char *TagLo, unsigned NumberLo, - bool IsSmall) { +void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi, + const char *TagLo, unsigned NumberLo, + bool IsSmall) { if (MAI->needsSet()) { O << "\t.set\t"; 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, - unsigned LabelNumber, unsigned SectionNumber, - bool IsSmall, bool isEH, - bool useSet) { +void DwarfPrinter::EmitSectionOffset(const char* Label, const char* Section, + unsigned LabelNumber, + unsigned SectionNumber, + bool IsSmall, bool isEH, + bool useSet) { bool printAbsolute = false; if (isEH) 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 /// frame. -void Dwarf::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, - const std::vector &Moves, bool isEH) { +void DwarfPrinter::EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, + const std::vector &Moves, + bool isEH) { int stackGrowth = Asm->TM.getFrameInfo()->getStackGrowthDirection() == TargetFrameInfo::StackGrowsUp ? diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/lib/CodeGen/AsmPrinter/DwarfPrinter.h index 007df29ed2c..78b80d9a250 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.h +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.h @@ -30,7 +30,7 @@ class TargetData; class TargetRegisterInfo; class MCSymbol; -class Dwarf { +class DwarfPrinter { protected: //===-------------------------------------------------------------==---===// // Core attributes used by the DWARF printer. @@ -70,8 +70,8 @@ protected: /// SetCounter - A unique number for each '.set' directive. unsigned SetCounter; - Dwarf(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T, - const char *flavor); + DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T, + const char *flavor); public: //===------------------------------------------------------------------===// // Accessors.