From 7e1a8f882f1baa1c0d5204373d6eb4cb7fc9f3ea Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 4 Apr 2010 19:09:29 +0000 Subject: [PATCH] move uleb/sleb printing into AsmPrinter from DwarfPrinter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100344 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/AsmPrinter.h | 10 +++ lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 71 +++++++++++++++++++ .../AsmPrinter/AsmPrinterInlineAsm.cpp | 6 +- lib/CodeGen/AsmPrinter/CMakeLists.txt | 1 + lib/CodeGen/AsmPrinter/DIE.cpp | 32 ++++----- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 22 +++--- lib/CodeGen/AsmPrinter/DwarfException.cpp | 28 ++++---- lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 68 +++--------------- lib/CodeGen/AsmPrinter/DwarfPrinter.h | 10 +-- 9 files changed, 135 insertions(+), 113 deletions(-) create mode 100644 lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 2262de8f4ab..1f1528b4253 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -313,6 +313,16 @@ namespace llvm { void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const; + //===------------------------------------------------------------------===// + // Dwarf Emission Helper Routines + //===------------------------------------------------------------------===// + + /// EmitSLEB128 - emit the specified signed leb128 value. + void EmitSLEB128(int Value, const char *Desc = 0) const; + + /// EmitULEB128 - emit the specified unsigned leb128 value. + void EmitULEB128(unsigned Value, const char *Desc = 0, + unsigned PadTo = 0) const; //===------------------------------------------------------------------===// // Inline Asm Support diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp new file mode 100644 index 00000000000..187148cddbe --- /dev/null +++ b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -0,0 +1,71 @@ +//===-- AsmPrinterDwarf.cpp - AsmPrinter Dwarf Support --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the Dwarf emissions parts of AsmPrinter. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "asm-printer" +#include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" +#include "llvm/ADT/Twine.h" +using namespace llvm; + +/// EmitSLEB128 - emit the specified signed leb128 value. +void AsmPrinter::EmitSLEB128(int Value, const char *Desc) const { + if (isVerbose() && Desc) + OutStreamer.AddComment(Desc); + + if (MAI->hasLEB128()) { + // FIXME: MCize. + OutStreamer.EmitRawText("\t.sleb128\t" + Twine(Value)); + return; + } + + // If we don't have .sleb128, emit as .bytes. + int Sign = Value >> (8 * sizeof(Value) - 1); + bool IsMore; + + do { + unsigned char Byte = static_cast(Value & 0x7f); + Value >>= 7; + IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; + if (IsMore) Byte |= 0x80; + OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0); + } while (IsMore); +} + +/// EmitULEB128 - emit the specified signed leb128 value. +void AsmPrinter::EmitULEB128(unsigned Value, const char *Desc, + unsigned PadTo) const { + if (isVerbose() && Desc) + OutStreamer.AddComment(Desc); + + if (MAI->hasLEB128() && PadTo == 0) { + // FIXME: MCize. + OutStreamer.EmitRawText("\t.uleb128\t" + Twine(Value)); + return; + } + + // If we don't have .uleb128 or we want to emit padding, emit as .bytes. + do { + unsigned char Byte = static_cast(Value & 0x7f); + Value >>= 7; + if (Value || PadTo != 0) Byte |= 0x80; + OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0); + } while (Value); + + if (PadTo) { + if (PadTo > 1) + OutStreamer.EmitFill(PadTo - 1, 0x80/*fillval*/, 0/*addrspace*/); + OutStreamer.EmitFill(1, 0/*fillval*/, 0/*addrspace*/); + } +} + diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index a85e97f2e28..c58f76b41c2 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -1,4 +1,4 @@ -//===-- AsmPrinter.cpp - Common AsmPrinter code ---------------------------===// +//===-- AsmPrinterInlineAsm.cpp - AsmPrinter Inline Asm Handling ----------===// // // The LLVM Compiler Infrastructure // @@ -7,13 +7,13 @@ // //===----------------------------------------------------------------------===// // -// This file implements the AsmPrinter class. +// This file implements the inline assembler pieces of the AsmPrinter class. // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "asm-printer" -#include "llvm/InlineAsm.h" #include "llvm/CodeGen/AsmPrinter.h" +#include "llvm/InlineAsm.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCStreamer.h" diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt index 824e71e6a46..b8e24fe26f7 100644 --- a/lib/CodeGen/AsmPrinter/CMakeLists.txt +++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt @@ -1,5 +1,6 @@ add_llvm_library(LLVMAsmPrinter AsmPrinter.cpp + AsmPrinterDwarf.cpp AsmPrinterInlineAsm.cpp DIE.cpp DwarfDebug.cpp diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index e0e3ff79467..3a2be19d2c0 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -57,11 +57,11 @@ void DIEAbbrev::Profile(FoldingSetNodeID &ID) const { void DIEAbbrev::Emit(const DwarfPrinter *DP) const { // Emit its Dwarf tag type. // FIXME: Doing work even in non-asm-verbose runs. - DP->EmitULEB128(Tag, dwarf::TagString(Tag)); + DP->getAsm()->EmitULEB128(Tag, dwarf::TagString(Tag)); // Emit whether it has children DIEs. // FIXME: Doing work even in non-asm-verbose runs. - DP->EmitULEB128(ChildrenFlag, dwarf::ChildrenString(ChildrenFlag)); + DP->getAsm()->EmitULEB128(ChildrenFlag, dwarf::ChildrenString(ChildrenFlag)); // For each attribute description. for (unsigned i = 0, N = Data.size(); i < N; ++i) { @@ -69,18 +69,18 @@ void DIEAbbrev::Emit(const DwarfPrinter *DP) const { // Emit attribute type. // FIXME: Doing work even in non-asm-verbose runs. - DP->EmitULEB128(AttrData.getAttribute(), - dwarf::AttributeString(AttrData.getAttribute())); + DP->getAsm()->EmitULEB128(AttrData.getAttribute(), + dwarf::AttributeString(AttrData.getAttribute())); // Emit form type. // FIXME: Doing work even in non-asm-verbose runs. - DP->EmitULEB128(AttrData.getForm(), - dwarf::FormEncodingString(AttrData.getForm())); + DP->getAsm()->EmitULEB128(AttrData.getForm(), + dwarf::FormEncodingString(AttrData.getForm())); } // Mark end of abbreviation. - DP->EmitULEB128(0, "EOM(1)"); - DP->EmitULEB128(0, "EOM(2)"); + DP->getAsm()->EmitULEB128(0, "EOM(1)"); + DP->getAsm()->EmitULEB128(0, "EOM(2)"); } #ifndef NDEBUG @@ -201,8 +201,8 @@ void DIEInteger::EmitValue(DwarfPrinter *D, unsigned Form) const { case dwarf::DW_FORM_data4: Size = 4; break; case dwarf::DW_FORM_ref8: // Fall thru case dwarf::DW_FORM_data8: Size = 8; break; - case dwarf::DW_FORM_udata: D->EmitULEB128(Integer); return; - case dwarf::DW_FORM_sdata: D->EmitSLEB128(Integer, ""); return; + case dwarf::DW_FORM_udata: Asm->EmitULEB128(Integer); return; + case dwarf::DW_FORM_sdata: Asm->EmitSLEB128(Integer); return; default: llvm_unreachable("DIE Value form not supported yet"); } Asm->OutStreamer.EmitIntValue(Integer, Size, 0/*addrspace*/); @@ -339,11 +339,11 @@ unsigned DIEBlock::ComputeSize(const TargetData *TD) { void DIEBlock::EmitValue(DwarfPrinter *D, unsigned Form) const { const AsmPrinter *Asm = D->getAsm(); switch (Form) { - case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break; - case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break; - case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break; - case dwarf::DW_FORM_block: D->EmitULEB128(Size); break; - default: llvm_unreachable("Improper form for block"); break; + default: assert(0 && "Improper form for block"); break; + case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break; + case dwarf::DW_FORM_block2: Asm->EmitInt16(Size); break; + case dwarf::DW_FORM_block4: Asm->EmitInt32(Size); break; + case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break; } const SmallVector &AbbrevData = Abbrev.getData(); @@ -358,7 +358,7 @@ unsigned DIEBlock::SizeOf(const TargetData *TD, unsigned Form) const { case dwarf::DW_FORM_block1: return Size + sizeof(int8_t); case dwarf::DW_FORM_block2: return Size + sizeof(int16_t); case dwarf::DW_FORM_block4: return Size + sizeof(int32_t); - case dwarf::DW_FORM_block: return Size + MCAsmInfo::getULEB128Size(Size); + case dwarf::DW_FORM_block: return Size + MCAsmInfo::getULEB128Size(Size); default: llvm_unreachable("Improper form for block"); break; } return 0; diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index a0ee874bf48..740750a0a89 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2496,7 +2496,7 @@ void DwarfDebug::emitDIE(DIE *Die) { Twine::utohexstr(Die->getOffset()) + ":0x" + Twine::utohexstr(Die->getSize()) + " " + dwarf::TagString(Abbrev->getTag())); - EmitULEB128(AbbrevNumber); + Asm->EmitULEB128(AbbrevNumber); const SmallVector &Values = Die->getValues(); const SmallVector &AbbrevData = Abbrev->getData(); @@ -2596,14 +2596,14 @@ void DwarfDebug::emitAbbreviations() const { const DIEAbbrev *Abbrev = Abbreviations[i]; // Emit the abbrevations code (base 1 index.) - EmitULEB128(Abbrev->getNumber(), "Abbreviation Code"); + Asm->EmitULEB128(Abbrev->getNumber(), "Abbreviation Code"); // Emit the abbreviations data. Abbrev->Emit(this); } // Mark end of abbreviations. - EmitULEB128(0, "EOM(3)"); + Asm->EmitULEB128(0, "EOM(3)"); Asm->OutStreamer.EmitLabel(getTempLabel("abbrev_end")); } @@ -2713,9 +2713,9 @@ void DwarfDebug::emitDebugLines() { if (Asm->isVerbose()) Asm->OutStreamer.AddComment("Source"); Asm->OutStreamer.EmitBytes(StringRef(FN.c_str(), FN.size()+1), 0); - EmitULEB128(Id.first, "Directory #"); - EmitULEB128(0, "Mod date"); - EmitULEB128(0, "File size"); + Asm->EmitULEB128(Id.first, "Directory #"); + Asm->EmitULEB128(0, "Mod date"); + Asm->EmitULEB128(0, "File size"); } Asm->OutStreamer.AddComment("End of files"); @@ -2769,7 +2769,7 @@ void DwarfDebug::emitDebugLines() { Source = LineInfo.getSourceID(); Asm->OutStreamer.AddComment("DW_LNS_set_file"); Asm->EmitInt8(dwarf::DW_LNS_set_file); - EmitULEB128(Source, "New Source"); + Asm->EmitULEB128(Source, "New Source"); } // If change of line. @@ -2790,7 +2790,7 @@ void DwarfDebug::emitDebugLines() { // ... otherwise use long hand. Asm->OutStreamer.AddComment("DW_LNS_advance_line"); Asm->EmitInt8(dwarf::DW_LNS_advance_line); - EmitSLEB128(Offset, "Line Offset"); + Asm->EmitSLEB128(Offset, "Line Offset"); Asm->OutStreamer.AddComment("DW_LNS_copy"); Asm->EmitInt8(dwarf::DW_LNS_copy); } @@ -2840,8 +2840,8 @@ void DwarfDebug::emitCommonDebugFrame() { Asm->EmitInt8(dwarf::DW_CIE_VERSION); Asm->OutStreamer.AddComment("CIE Augmentation"); Asm->OutStreamer.EmitIntValue(0, 1, /*addrspace*/0); // nul terminator. - EmitULEB128(1, "CIE Code Alignment Factor"); - EmitSLEB128(stackGrowth, "CIE Data Alignment Factor"); + Asm->EmitULEB128(1, "CIE Code Alignment Factor"); + Asm->EmitSLEB128(stackGrowth, "CIE Data Alignment Factor"); Asm->OutStreamer.AddComment("CIE RA Column"); Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), false)); @@ -3102,7 +3102,7 @@ void DwarfDebug::emitDebugInlineInfo() { Asm->OutStreamer.AddComment("Function name"); EmitSectionOffset(getStringPoolEntry(Name), getTempLabel("section_str"), true); - EmitULEB128(Labels.size(), "Inline count"); + Asm->EmitULEB128(Labels.size(), "Inline count"); for (SmallVector::iterator LI = Labels.begin(), LE = Labels.end(); LI != LE; ++LI) { diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 60136cfe4a3..75e6357498c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -127,13 +127,13 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) { Asm->OutStreamer.EmitBytes(StringRef(Augmentation, strlen(Augmentation)+1),0); // Round out reader. - EmitULEB128(1, "CIE Code Alignment Factor"); - EmitSLEB128(stackGrowth, "CIE Data Alignment Factor"); + Asm->EmitULEB128(1, "CIE Code Alignment Factor"); + Asm->EmitSLEB128(stackGrowth, "CIE Data Alignment Factor"); Asm->OutStreamer.AddComment("CIE Return Address Column"); Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true)); if (Augmentation[0]) { - EmitULEB128(AugmentationSize, "Augmentation Size"); + Asm->EmitULEB128(AugmentationSize, "Augmentation Size"); // If there is a personality, we need to indicate the function's location. if (PersonalityFn) { @@ -235,7 +235,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { if (MMI->getPersonalities()[0] != NULL) { unsigned Size = SizeOfEncodedValue(LSDAEncoding); - EmitULEB128(Size, "Augmentation size"); + Asm->EmitULEB128(Size, "Augmentation size"); Asm->OutStreamer.AddComment("Language Specific Data Area"); if (EHFrameInfo.hasLandingPads) EmitReference(getDWLabel("exception", EHFrameInfo.Number),LSDAEncoding); @@ -243,7 +243,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { Asm->OutStreamer.EmitIntValue(0, Size/*size*/, 0/*addrspace*/); } else { - EmitULEB128(0, "Augmentation size"); + Asm->EmitULEB128(0, "Augmentation size"); } // Indicate locations of function specific callee saved registers in frame. @@ -730,7 +730,7 @@ void DwarfException::EmitExceptionTable() { if (HaveTTData) { // Account for any extra padding that will be added to the call site table // length. - EmitULEB128(TTypeBaseOffset, "@TType base offset", SizeAlign); + Asm->EmitULEB128(TTypeBaseOffset, "@TType base offset", SizeAlign); SizeAlign = 0; } @@ -739,7 +739,7 @@ void DwarfException::EmitExceptionTable() { EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); // Add extra padding if it wasn't added to the TType base offset. - EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); + Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); // Emit the landing pad site information. unsigned idx = 0; @@ -749,12 +749,12 @@ void DwarfException::EmitExceptionTable() { // Offset of the landing pad, counted in 16-byte bundles relative to the // @LPStart address. - EmitULEB128(idx, "Landing pad"); + Asm->EmitULEB128(idx, "Landing pad"); // Offset of the first associated action record, relative to the start of // the action table. This value is biased by 1 (1 indicates the start of // the action table), and 0 indicates that there are no actions. - EmitULEB128(S.Action, "Action"); + Asm->EmitULEB128(S.Action, "Action"); } } else { // DWARF Exception handling @@ -782,7 +782,7 @@ void DwarfException::EmitExceptionTable() { EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); // Add extra padding if it wasn't added to the TType base offset. - EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); + Asm->EmitULEB128(CallSiteTableLength, "Call site table length", SizeAlign); for (SmallVectorImpl::const_iterator I = CallSites.begin(), E = CallSites.end(); I != E; ++I) { @@ -818,7 +818,7 @@ void DwarfException::EmitExceptionTable() { // Offset of the first associated action record, relative to the start of // the action table. This value is biased by 1 (1 indicates the start of // the action table), and 0 indicates that there are no actions. - EmitULEB128(S.Action, "Action"); + Asm->EmitULEB128(S.Action, "Action"); } } @@ -838,13 +838,13 @@ void DwarfException::EmitExceptionTable() { // // Used by the runtime to match the type of the thrown exception to the // type of the catch clauses or the types in the exception specification. - EmitSLEB128(Action.ValueForTypeID, " TypeInfo index"); + Asm->EmitSLEB128(Action.ValueForTypeID, " TypeInfo index"); // Action Record // // Self-relative signed displacement in bytes of the next action record, // or 0 if there is no next action record. - EmitSLEB128(Action.NextAction, " Next action"); + Asm->EmitSLEB128(Action.NextAction, " Next action"); } // Emit the Catch TypeInfos. @@ -871,7 +871,7 @@ void DwarfException::EmitExceptionTable() { for (std::vector::const_iterator I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) { unsigned TypeID = *I; - EmitULEB128(TypeID, TypeID != 0 ? "Exception specification" : 0); + Asm->EmitULEB128(TypeID, TypeID != 0 ? "Exception specification" : 0); } Asm->EmitAlignment(2, 0, 0, false); diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index 267c41faf00..796d36e674c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -133,58 +133,6 @@ void DwarfPrinter::EmitCFAByte(unsigned Val) { Asm->OutStreamer.EmitIntValue(Val, 1, 0/*addrspace*/); } -/// EmitSLEB128 - emit the specified signed leb128 value. -void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const { - if (Asm->isVerbose() && Desc) - Asm->OutStreamer.AddComment(Desc); - - if (MAI->hasLEB128()) { - // FIXME: MCize. - Asm->OutStreamer.EmitRawText("\t.sleb128\t" + Twine(Value)); - return; - } - - // If we don't have .sleb128, emit as .bytes. - int Sign = Value >> (8 * sizeof(Value) - 1); - bool IsMore; - - do { - unsigned char Byte = static_cast(Value & 0x7f); - Value >>= 7; - IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; - if (IsMore) Byte |= 0x80; - Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0); - } while (IsMore); -} - -/// EmitULEB128 - emit the specified signed leb128 value. -void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc, - unsigned PadTo) const { - if (Asm->isVerbose() && Desc) - Asm->OutStreamer.AddComment(Desc); - - if (MAI->hasLEB128() && PadTo == 0) { - // FIXME: MCize. - Asm->OutStreamer.EmitRawText("\t.uleb128\t" + Twine(Value)); - return; - } - - // If we don't have .uleb128 or we want to emit padding, emit as .bytes. - do { - unsigned char Byte = static_cast(Value & 0x7f); - Value >>= 7; - if (Value || PadTo != 0) Byte |= 0x80; - Asm->OutStreamer.EmitIntValue(Byte, 1, /*addrspace*/0); - } while (Value); - - if (PadTo) { - if (PadTo > 1) - Asm->OutStreamer.EmitFill(PadTo - 1, 0x80/*fillval*/, 0/*addrspace*/); - Asm->OutStreamer.EmitFill(1, 0/*fillval*/, 0/*addrspace*/); - } -} - - void DwarfPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const { const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); @@ -269,11 +217,11 @@ void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel, EmitCFAByte(dwarf::DW_CFA_def_cfa_offset); } else { EmitCFAByte(dwarf::DW_CFA_def_cfa); - EmitULEB128(RI->getDwarfRegNum(Src.getReg(), isEH), "Register"); + Asm->EmitULEB128(RI->getDwarfRegNum(Src.getReg(), isEH), "Register"); } int Offset = -Src.getOffset(); - EmitULEB128(Offset, "Offset"); + Asm->EmitULEB128(Offset, "Offset"); } else { llvm_unreachable("Machine move not supported yet."); } @@ -281,7 +229,7 @@ void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel, Src.getReg() == MachineLocation::VirtualFP) { if (Dst.isReg()) { EmitCFAByte(dwarf::DW_CFA_def_cfa_register); - EmitULEB128(RI->getDwarfRegNum(Dst.getReg(), isEH), "Register"); + Asm->EmitULEB128(RI->getDwarfRegNum(Dst.getReg(), isEH), "Register"); } else { llvm_unreachable("Machine move not supported yet."); } @@ -291,15 +239,15 @@ void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel, if (Offset < 0) { EmitCFAByte(dwarf::DW_CFA_offset_extended_sf); - EmitULEB128(Reg, "Reg"); - EmitSLEB128(Offset, "Offset"); + Asm->EmitULEB128(Reg, "Reg"); + Asm->EmitSLEB128(Offset, "Offset"); } else if (Reg < 64) { EmitCFAByte(dwarf::DW_CFA_offset + Reg); - EmitULEB128(Offset, "Offset"); + Asm->EmitULEB128(Offset, "Offset"); } else { EmitCFAByte(dwarf::DW_CFA_offset_extended); - EmitULEB128(Reg, "Reg"); - EmitULEB128(Offset, "Offset"); + Asm->EmitULEB128(Reg, "Reg"); + Asm->EmitULEB128(Offset, "Offset"); } } } diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/lib/CodeGen/AsmPrinter/DwarfPrinter.h index 04355e0f86f..461ececd511 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.h +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.h @@ -94,15 +94,7 @@ public: /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value. void EmitCFAByte(unsigned Val); - - /// EmitSLEB128 - emit the specified signed leb128 value. - void EmitSLEB128(int Value, const char *Desc) const; - - /// EmitULEB128 - emit the specified unsigned leb128 value. - void EmitULEB128(unsigned Value, const char *Desc = 0, - unsigned PadTo = 0) const; - - + /// EmitReference - Emit a reference to a label. /// void EmitReference(const MCSymbol *Sym, unsigned Encoding) const; -- 2.34.1