From d85fc6e0b1750907bacf1cd7309e85e777b23a4d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 10 Mar 2010 01:17:49 +0000 Subject: [PATCH] inline away a form of IsPCRelative, eliminating the dead IsPCRel argument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98117 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DIE.cpp | 3 ++- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 16 ++++++++++++---- lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 21 --------------------- lib/CodeGen/AsmPrinter/DwarfPrinter.h | 3 --- 4 files changed, 14 insertions(+), 29 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index b9bb4af2b81..e97754e5d26 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -259,7 +259,8 @@ void DIEString::print(raw_ostream &O) { /// void DIELabel::EmitValue(DwarfPrinter *D, unsigned Form) const { bool IsSmall = Form == dwarf::DW_FORM_data4; - D->EmitReference(Label, false, IsSmall); + unsigned Size = IsSmall ? 4 : D->getTargetData()->getPointerSize(); + D->getAsm()->OutStreamer.EmitSymbolValue(Label, Size, 0/*AddrSpace*/); } /// SizeOf - Determine size of label value in bytes. diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 20cd623af64..b27be78bad8 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2493,7 +2493,9 @@ void DwarfDebug::emitEndOfLineMatrix(unsigned SectionEnd) { Asm->EmitInt8(dwarf::DW_LNE_set_address); Asm->OutStreamer.AddComment("Section end label"); - EmitReference(getDWLabel("section_end", SectionEnd)); + + Asm->OutStreamer.EmitSymbolValue(getDWLabel("section_end", SectionEnd), + TD->getPointerSize(), 0/*AddrSpace*/); // Mark end of matrix. Asm->OutStreamer.AddComment("DW_LNE_end_sequence"); @@ -2627,8 +2629,9 @@ void DwarfDebug::emitDebugLines() { Asm->EmitInt8(dwarf::DW_LNE_set_address); Asm->OutStreamer.AddComment("Location label"); - EmitReference(getDWLabel("label", LabelID)); - + Asm->OutStreamer.EmitSymbolValue(getDWLabel("label", LabelID), + TD->getPointerSize(), 0/*AddrSpace*/); + // If change of source, then switch to the new source. if (Source != LineInfo.getSourceID()) { Source = LineInfo.getSourceID(); @@ -2742,7 +2745,12 @@ DwarfDebug::emitFunctionDebugFrame(const FunctionDebugFrameInfo&DebugFrameInfo){ getTempLabel("section_debug_frame"), true, false); Asm->OutStreamer.AddComment("FDE initial location"); - EmitReference(getDWLabel("func_begin", DebugFrameInfo.Number)); + Asm->OutStreamer.EmitSymbolValue(getDWLabel("func_begin", + DebugFrameInfo.Number), + TD->getPointerSize(), 0/*AddrSpace*/); + + + Asm->OutStreamer.AddComment("FDE address range"); EmitDifference(getDWLabel("func_end", DebugFrameInfo.Number), getDWLabel("func_begin", DebugFrameInfo.Number)); diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index 878a5e7fa36..80d29072507 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -186,27 +186,6 @@ void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc, } -/// EmitReference - Emit a reference to a label. -/// -void DwarfPrinter::EmitReference(const MCSymbol *Sym, bool IsPCRelative, - bool Force32Bit) const { - unsigned Size = Force32Bit ? 4 : TD->getPointerSize(); - - if (!IsPCRelative) { - Asm->OutStreamer.EmitSymbolValue(Sym, Size, 0/*AddrSpace*/); - return; - } - - // FIXME: Need an MCExpr for ".". - // FIXME: MCize. - if (Force32Bit || TD->getPointerSize() == sizeof(int32_t)) - O << MAI->getData32bitsDirective(); - else - O << MAI->getData64bitsDirective(); - O << *Sym; - if (IsPCRelative) O << "-" << MAI->getPCSymbol(); -} - void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const { const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/lib/CodeGen/AsmPrinter/DwarfPrinter.h index 7a2eb401839..5e2d806a66a 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.h +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.h @@ -108,9 +108,6 @@ public: /// EmitReference - Emit a reference to a label. /// - void EmitReference(const MCSymbol *Label, bool IsPCRelative = false, - bool Force32Bit = false) const; - void EmitReference(const MCSymbol *Sym, unsigned Encoding) const; void EmitReference(const GlobalValue *GV, unsigned Encoding) const;