diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp index 3a2be19d2c0..64d3789fb94 100644 --- a/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/lib/CodeGen/AsmPrinter/DIE.cpp @@ -285,8 +285,8 @@ void DIELabel::print(raw_ostream &O) { /// EmitValue - Emit delta value. /// void DIEDelta::EmitValue(DwarfPrinter *D, unsigned Form) const { - bool IsSmall = Form == dwarf::DW_FORM_data4; - D->EmitDifference(LabelHi, LabelLo, IsSmall); + D->getAsm()->EmitLabelDifference(LabelHi, LabelLo, + SizeOf(D->getTargetData(), Form)); } /// SizeOf - Determine size of delta value in bytes. diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 60ea2586364..09a4a0985a3 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2655,16 +2655,16 @@ void DwarfDebug::emitDebugLines() { // Construct the section header. Asm->OutStreamer.AddComment("Length of Source Line Info"); - EmitDifference(Asm->GetTempSymbol("line_end"), - Asm->GetTempSymbol("line_begin"), true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("line_end"), + Asm->GetTempSymbol("line_begin"), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("line_begin")); Asm->OutStreamer.AddComment("DWARF version number"); Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->OutStreamer.AddComment("Prolog Length"); - EmitDifference(Asm->GetTempSymbol("line_prolog_end"), - Asm->GetTempSymbol("line_prolog_begin"), true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("line_prolog_end"), + Asm->GetTempSymbol("line_prolog_begin"), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("line_prolog_begin")); Asm->OutStreamer.AddComment("Minimum Instruction Length"); @@ -2833,8 +2833,8 @@ void DwarfDebug::emitCommonDebugFrame() { Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_frame_common")); Asm->OutStreamer.AddComment("Length of Common Information Entry"); - EmitDifference(Asm->GetTempSymbol("debug_frame_common_end"), - Asm->GetTempSymbol("debug_frame_common_begin"), true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("debug_frame_common_end"), + Asm->GetTempSymbol("debug_frame_common_begin"), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_frame_common_begin")); Asm->OutStreamer.AddComment("CIE Identifier Tag"); @@ -2873,7 +2873,7 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) { Asm->GetTempSymbol("debug_frame_begin", DebugFrameInfo.Number); MCSymbol *DebugFrameEnd = Asm->GetTempSymbol("debug_frame_end", DebugFrameInfo.Number); - EmitDifference(DebugFrameEnd, DebugFrameBegin, true); + Asm->EmitLabelDifference(DebugFrameEnd, DebugFrameBegin, 4); Asm->OutStreamer.EmitLabel(DebugFrameBegin); @@ -2889,8 +2889,8 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) { Asm->OutStreamer.AddComment("FDE address range"); - EmitDifference(Asm->GetTempSymbol("func_end", DebugFrameInfo.Number), - FuncBeginSym); + Asm->EmitLabelDifference(Asm->GetTempSymbol("func_end",DebugFrameInfo.Number), + FuncBeginSym, TD->getPointerSize()); EmitFrameMoves(FuncBeginSym, DebugFrameInfo.Moves, false); @@ -2906,8 +2906,9 @@ void DwarfDebug::emitDebugPubNames() { Asm->getObjFileLowering().getDwarfPubNamesSection()); Asm->OutStreamer.AddComment("Length of Public Names Info"); - EmitDifference(Asm->GetTempSymbol("pubnames_end", ModuleCU->getID()), - Asm->GetTempSymbol("pubnames_begin", ModuleCU->getID()), true); + Asm->EmitLabelDifference( + Asm->GetTempSymbol("pubnames_end", ModuleCU->getID()), + Asm->GetTempSymbol("pubnames_begin", ModuleCU->getID()), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_begin", ModuleCU->getID())); @@ -2920,9 +2921,9 @@ void DwarfDebug::emitDebugPubNames() { Asm->GetTempSymbol("section_info"), true); Asm->OutStreamer.AddComment("Compilation Unit Length"); - EmitDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()), - Asm->GetTempSymbol("info_begin", ModuleCU->getID()), - true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()), + Asm->GetTempSymbol("info_begin", ModuleCU->getID()), + 4); const StringMap &Globals = ModuleCU->getGlobals(); for (StringMap::const_iterator @@ -2949,8 +2950,9 @@ void DwarfDebug::emitDebugPubTypes() { Asm->OutStreamer.SwitchSection( Asm->getObjFileLowering().getDwarfPubTypesSection()); Asm->OutStreamer.AddComment("Length of Public Types Info"); - EmitDifference(Asm->GetTempSymbol("pubtypes_end", ModuleCU->getID()), - Asm->GetTempSymbol("pubtypes_begin", ModuleCU->getID()), true); + Asm->EmitLabelDifference( + Asm->GetTempSymbol("pubtypes_end", ModuleCU->getID()), + Asm->GetTempSymbol("pubtypes_begin", ModuleCU->getID()), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubtypes_begin", ModuleCU->getID())); @@ -2963,9 +2965,9 @@ void DwarfDebug::emitDebugPubTypes() { Asm->GetTempSymbol("section_info"), true); Asm->OutStreamer.AddComment("Compilation ModuleCU Length"); - EmitDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()), - Asm->GetTempSymbol("info_begin", ModuleCU->getID()), - true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()), + Asm->GetTempSymbol("info_begin", ModuleCU->getID()), + 4); const StringMap &Globals = ModuleCU->getGlobalTypes(); for (StringMap::const_iterator @@ -3079,8 +3081,8 @@ void DwarfDebug::emitDebugInlineInfo() { Asm->getObjFileLowering().getDwarfDebugInlineSection()); Asm->OutStreamer.AddComment("Length of Debug Inlined Information Entry"); - EmitDifference(Asm->GetTempSymbol("debug_inlined_end", 1), - Asm->GetTempSymbol("debug_inlined_begin", 1), true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("debug_inlined_end", 1), + Asm->GetTempSymbol("debug_inlined_begin", 1), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_inlined_begin", 1)); diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp index 2b22905ce4d..e45f8d988d1 100644 --- a/lib/CodeGen/AsmPrinter/DwarfException.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp @@ -80,8 +80,9 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) { // Define the eh frame length. Asm->OutStreamer.AddComment("Length of Common Information Entry"); - EmitDifference(Asm->GetTempSymbol("eh_frame_common_end", Index), - Asm->GetTempSymbol("eh_frame_common_begin", Index), true); + Asm->EmitLabelDifference(Asm->GetTempSymbol("eh_frame_common_end", Index), + Asm->GetTempSymbol("eh_frame_common_begin", Index), + 4); // EH frame header. Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_common_begin",Index)); @@ -209,9 +210,9 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { // EH frame header. Asm->OutStreamer.AddComment("Length of Frame Information Entry"); - EmitDifference(Asm->GetTempSymbol("eh_frame_end", EHFrameInfo.Number), - Asm->GetTempSymbol("eh_frame_begin", EHFrameInfo.Number), - true); + Asm->EmitLabelDifference( + Asm->GetTempSymbol("eh_frame_end", EHFrameInfo.Number), + Asm->GetTempSymbol("eh_frame_begin", EHFrameInfo.Number), 4); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_begin", EHFrameInfo.Number)); @@ -229,8 +230,9 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) { EmitReference(EHFuncBeginSym, FDEEncoding); Asm->OutStreamer.AddComment("FDE address range"); - EmitDifference(Asm->GetTempSymbol("eh_func_end", EHFrameInfo.Number), - EHFuncBeginSym, SizeOfEncodedValue(FDEEncoding) == 4); + Asm->EmitLabelDifference(Asm->GetTempSymbol("eh_func_end", + EHFrameInfo.Number), + EHFuncBeginSym, SizeOfEncodedValue(FDEEncoding)); // If there is a personality and landing pads then point to the language // specific data area in the exception table. @@ -810,7 +812,7 @@ void DwarfException::EmitExceptionTable() { EmitSectionOffset(BeginLabel, EHFuncBeginSym, true, true); Asm->OutStreamer.AddComment("Region length"); - EmitDifference(EndLabel, BeginLabel, true); + Asm->EmitLabelDifference(EndLabel, BeginLabel, 4); // Offset of the landing pad, counted in 16-byte bundles relative to the diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index 333cf546275..19c3b914860 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -130,14 +130,6 @@ void DwarfPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const{ Asm->OutStreamer.EmitValue(Exp, SizeOfEncodedValue(Encoding), /*addrspace*/0); } -/// EmitDifference - Emit the difference between two labels. If this assembler -/// supports .set, we emit a .set of a temporary and then use it in the .word. -void DwarfPrinter::EmitDifference(const MCSymbol *TagHi, const MCSymbol *TagLo, - bool IsSmall) { - unsigned Size = IsSmall ? 4 : TD->getPointerSize(); - Asm->EmitLabelDifference(TagHi, TagLo, Size); -} - void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section, bool IsSmall, bool isEH) { @@ -148,7 +140,8 @@ void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label, isAbsolute = MAI->isAbsoluteDebugSectionOffsets(); if (!isAbsolute) - return EmitDifference(Label, Section, IsSmall); + return Asm->EmitLabelDifference(Label, Section, + IsSmall ? 4 : TD->getPointerSize()); // On COFF targets, we have to emit the weird .secrel32 directive. if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { @@ -184,7 +177,7 @@ void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel, MCSymbol *ThisSym = Label; if (ThisSym != BaseLabel) { EmitCFAByte(dwarf::DW_CFA_advance_loc4); - EmitDifference(ThisSym, BaseLabel, true); + Asm->EmitLabelDifference(ThisSym, BaseLabel, 4); BaseLabel = ThisSym; } } diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/lib/CodeGen/AsmPrinter/DwarfPrinter.h index c7bfd9abeb5..e132cb6eaf7 100644 --- a/lib/CodeGen/AsmPrinter/DwarfPrinter.h +++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.h @@ -92,10 +92,6 @@ public: void EmitReference(const MCSymbol *Sym, unsigned Encoding) const; void EmitReference(const GlobalValue *GV, unsigned Encoding) const; - /// EmitDifference - Emit the difference between two labels. - void EmitDifference(const MCSymbol *LabelHi, const MCSymbol *LabelLo, - bool IsSmall = false); - /// EmitSectionOffset - Emit Label-Section or use a special purpose directive /// to emit a section offset if the target has one. void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section,