inline EmitDifference away.

llvm-svn: 100347
This commit is contained in:
Chris Lattner 2010-04-04 19:58:12 +00:00
parent 4e4549deea
commit f1429f1fe3
5 changed files with 38 additions and 45 deletions

View File

@ -285,8 +285,8 @@ void DIELabel::print(raw_ostream &O) {
/// EmitValue - Emit delta value. /// EmitValue - Emit delta value.
/// ///
void DIEDelta::EmitValue(DwarfPrinter *D, unsigned Form) const { void DIEDelta::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4; D->getAsm()->EmitLabelDifference(LabelHi, LabelLo,
D->EmitDifference(LabelHi, LabelLo, IsSmall); SizeOf(D->getTargetData(), Form));
} }
/// SizeOf - Determine size of delta value in bytes. /// SizeOf - Determine size of delta value in bytes.

View File

@ -2655,16 +2655,16 @@ void DwarfDebug::emitDebugLines() {
// Construct the section header. // Construct the section header.
Asm->OutStreamer.AddComment("Length of Source Line Info"); Asm->OutStreamer.AddComment("Length of Source Line Info");
EmitDifference(Asm->GetTempSymbol("line_end"), Asm->EmitLabelDifference(Asm->GetTempSymbol("line_end"),
Asm->GetTempSymbol("line_begin"), true); Asm->GetTempSymbol("line_begin"), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("line_begin")); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("line_begin"));
Asm->OutStreamer.AddComment("DWARF version number"); Asm->OutStreamer.AddComment("DWARF version number");
Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Prolog Length"); Asm->OutStreamer.AddComment("Prolog Length");
EmitDifference(Asm->GetTempSymbol("line_prolog_end"), Asm->EmitLabelDifference(Asm->GetTempSymbol("line_prolog_end"),
Asm->GetTempSymbol("line_prolog_begin"), true); Asm->GetTempSymbol("line_prolog_begin"), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("line_prolog_begin")); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("line_prolog_begin"));
Asm->OutStreamer.AddComment("Minimum Instruction Length"); Asm->OutStreamer.AddComment("Minimum Instruction Length");
@ -2833,8 +2833,8 @@ void DwarfDebug::emitCommonDebugFrame() {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_frame_common")); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_frame_common"));
Asm->OutStreamer.AddComment("Length of Common Information Entry"); Asm->OutStreamer.AddComment("Length of Common Information Entry");
EmitDifference(Asm->GetTempSymbol("debug_frame_common_end"), Asm->EmitLabelDifference(Asm->GetTempSymbol("debug_frame_common_end"),
Asm->GetTempSymbol("debug_frame_common_begin"), true); Asm->GetTempSymbol("debug_frame_common_begin"), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_frame_common_begin")); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_frame_common_begin"));
Asm->OutStreamer.AddComment("CIE Identifier Tag"); Asm->OutStreamer.AddComment("CIE Identifier Tag");
@ -2873,7 +2873,7 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) {
Asm->GetTempSymbol("debug_frame_begin", DebugFrameInfo.Number); Asm->GetTempSymbol("debug_frame_begin", DebugFrameInfo.Number);
MCSymbol *DebugFrameEnd = MCSymbol *DebugFrameEnd =
Asm->GetTempSymbol("debug_frame_end", DebugFrameInfo.Number); Asm->GetTempSymbol("debug_frame_end", DebugFrameInfo.Number);
EmitDifference(DebugFrameEnd, DebugFrameBegin, true); Asm->EmitLabelDifference(DebugFrameEnd, DebugFrameBegin, 4);
Asm->OutStreamer.EmitLabel(DebugFrameBegin); Asm->OutStreamer.EmitLabel(DebugFrameBegin);
@ -2889,8 +2889,8 @@ emitFunctionDebugFrame(const FunctionDebugFrameInfo &DebugFrameInfo) {
Asm->OutStreamer.AddComment("FDE address range"); Asm->OutStreamer.AddComment("FDE address range");
EmitDifference(Asm->GetTempSymbol("func_end", DebugFrameInfo.Number), Asm->EmitLabelDifference(Asm->GetTempSymbol("func_end",DebugFrameInfo.Number),
FuncBeginSym); FuncBeginSym, TD->getPointerSize());
EmitFrameMoves(FuncBeginSym, DebugFrameInfo.Moves, false); EmitFrameMoves(FuncBeginSym, DebugFrameInfo.Moves, false);
@ -2906,8 +2906,9 @@ void DwarfDebug::emitDebugPubNames() {
Asm->getObjFileLowering().getDwarfPubNamesSection()); Asm->getObjFileLowering().getDwarfPubNamesSection());
Asm->OutStreamer.AddComment("Length of Public Names Info"); Asm->OutStreamer.AddComment("Length of Public Names Info");
EmitDifference(Asm->GetTempSymbol("pubnames_end", ModuleCU->getID()), Asm->EmitLabelDifference(
Asm->GetTempSymbol("pubnames_begin", ModuleCU->getID()), true); Asm->GetTempSymbol("pubnames_end", ModuleCU->getID()),
Asm->GetTempSymbol("pubnames_begin", ModuleCU->getID()), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_begin", Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_begin",
ModuleCU->getID())); ModuleCU->getID()));
@ -2920,9 +2921,9 @@ void DwarfDebug::emitDebugPubNames() {
Asm->GetTempSymbol("section_info"), true); Asm->GetTempSymbol("section_info"), true);
Asm->OutStreamer.AddComment("Compilation Unit Length"); Asm->OutStreamer.AddComment("Compilation Unit Length");
EmitDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()), Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()),
Asm->GetTempSymbol("info_begin", ModuleCU->getID()), Asm->GetTempSymbol("info_begin", ModuleCU->getID()),
true); 4);
const StringMap<DIE*> &Globals = ModuleCU->getGlobals(); const StringMap<DIE*> &Globals = ModuleCU->getGlobals();
for (StringMap<DIE*>::const_iterator for (StringMap<DIE*>::const_iterator
@ -2949,8 +2950,9 @@ void DwarfDebug::emitDebugPubTypes() {
Asm->OutStreamer.SwitchSection( Asm->OutStreamer.SwitchSection(
Asm->getObjFileLowering().getDwarfPubTypesSection()); Asm->getObjFileLowering().getDwarfPubTypesSection());
Asm->OutStreamer.AddComment("Length of Public Types Info"); Asm->OutStreamer.AddComment("Length of Public Types Info");
EmitDifference(Asm->GetTempSymbol("pubtypes_end", ModuleCU->getID()), Asm->EmitLabelDifference(
Asm->GetTempSymbol("pubtypes_begin", ModuleCU->getID()), true); Asm->GetTempSymbol("pubtypes_end", ModuleCU->getID()),
Asm->GetTempSymbol("pubtypes_begin", ModuleCU->getID()), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubtypes_begin", Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubtypes_begin",
ModuleCU->getID())); ModuleCU->getID()));
@ -2963,9 +2965,9 @@ void DwarfDebug::emitDebugPubTypes() {
Asm->GetTempSymbol("section_info"), true); Asm->GetTempSymbol("section_info"), true);
Asm->OutStreamer.AddComment("Compilation ModuleCU Length"); Asm->OutStreamer.AddComment("Compilation ModuleCU Length");
EmitDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()), Asm->EmitLabelDifference(Asm->GetTempSymbol("info_end", ModuleCU->getID()),
Asm->GetTempSymbol("info_begin", ModuleCU->getID()), Asm->GetTempSymbol("info_begin", ModuleCU->getID()),
true); 4);
const StringMap<DIE*> &Globals = ModuleCU->getGlobalTypes(); const StringMap<DIE*> &Globals = ModuleCU->getGlobalTypes();
for (StringMap<DIE*>::const_iterator for (StringMap<DIE*>::const_iterator
@ -3079,8 +3081,8 @@ void DwarfDebug::emitDebugInlineInfo() {
Asm->getObjFileLowering().getDwarfDebugInlineSection()); Asm->getObjFileLowering().getDwarfDebugInlineSection());
Asm->OutStreamer.AddComment("Length of Debug Inlined Information Entry"); Asm->OutStreamer.AddComment("Length of Debug Inlined Information Entry");
EmitDifference(Asm->GetTempSymbol("debug_inlined_end", 1), Asm->EmitLabelDifference(Asm->GetTempSymbol("debug_inlined_end", 1),
Asm->GetTempSymbol("debug_inlined_begin", 1), true); Asm->GetTempSymbol("debug_inlined_begin", 1), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_inlined_begin", 1)); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_inlined_begin", 1));

View File

@ -80,8 +80,9 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
// Define the eh frame length. // Define the eh frame length.
Asm->OutStreamer.AddComment("Length of Common Information Entry"); Asm->OutStreamer.AddComment("Length of Common Information Entry");
EmitDifference(Asm->GetTempSymbol("eh_frame_common_end", Index), Asm->EmitLabelDifference(Asm->GetTempSymbol("eh_frame_common_end", Index),
Asm->GetTempSymbol("eh_frame_common_begin", Index), true); Asm->GetTempSymbol("eh_frame_common_begin", Index),
4);
// EH frame header. // EH frame header.
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_common_begin",Index)); Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_common_begin",Index));
@ -209,9 +210,9 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
// EH frame header. // EH frame header.
Asm->OutStreamer.AddComment("Length of Frame Information Entry"); Asm->OutStreamer.AddComment("Length of Frame Information Entry");
EmitDifference(Asm->GetTempSymbol("eh_frame_end", EHFrameInfo.Number), Asm->EmitLabelDifference(
Asm->GetTempSymbol("eh_frame_begin", EHFrameInfo.Number), Asm->GetTempSymbol("eh_frame_end", EHFrameInfo.Number),
true); Asm->GetTempSymbol("eh_frame_begin", EHFrameInfo.Number), 4);
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_begin", Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("eh_frame_begin",
EHFrameInfo.Number)); EHFrameInfo.Number));
@ -229,8 +230,9 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
EmitReference(EHFuncBeginSym, FDEEncoding); EmitReference(EHFuncBeginSym, FDEEncoding);
Asm->OutStreamer.AddComment("FDE address range"); Asm->OutStreamer.AddComment("FDE address range");
EmitDifference(Asm->GetTempSymbol("eh_func_end", EHFrameInfo.Number), Asm->EmitLabelDifference(Asm->GetTempSymbol("eh_func_end",
EHFuncBeginSym, SizeOfEncodedValue(FDEEncoding) == 4); EHFrameInfo.Number),
EHFuncBeginSym, SizeOfEncodedValue(FDEEncoding));
// If there is a personality and landing pads then point to the language // If there is a personality and landing pads then point to the language
// specific data area in the exception table. // specific data area in the exception table.
@ -810,7 +812,7 @@ void DwarfException::EmitExceptionTable() {
EmitSectionOffset(BeginLabel, EHFuncBeginSym, true, true); EmitSectionOffset(BeginLabel, EHFuncBeginSym, true, true);
Asm->OutStreamer.AddComment("Region length"); 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 // Offset of the landing pad, counted in 16-byte bundles relative to the

View File

@ -130,14 +130,6 @@ void DwarfPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const{
Asm->OutStreamer.EmitValue(Exp, SizeOfEncodedValue(Encoding), /*addrspace*/0); 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, void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
const MCSymbol *Section, const MCSymbol *Section,
bool IsSmall, bool isEH) { bool IsSmall, bool isEH) {
@ -148,7 +140,8 @@ void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
isAbsolute = MAI->isAbsoluteDebugSectionOffsets(); isAbsolute = MAI->isAbsoluteDebugSectionOffsets();
if (!isAbsolute) 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. // On COFF targets, we have to emit the weird .secrel32 directive.
if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) { if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective()) {
@ -184,7 +177,7 @@ void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel,
MCSymbol *ThisSym = Label; MCSymbol *ThisSym = Label;
if (ThisSym != BaseLabel) { if (ThisSym != BaseLabel) {
EmitCFAByte(dwarf::DW_CFA_advance_loc4); EmitCFAByte(dwarf::DW_CFA_advance_loc4);
EmitDifference(ThisSym, BaseLabel, true); Asm->EmitLabelDifference(ThisSym, BaseLabel, 4);
BaseLabel = ThisSym; BaseLabel = ThisSym;
} }
} }

View File

@ -92,10 +92,6 @@ public:
void EmitReference(const MCSymbol *Sym, unsigned Encoding) const; void EmitReference(const MCSymbol *Sym, unsigned Encoding) const;
void EmitReference(const GlobalValue *GV, 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 /// EmitSectionOffset - Emit Label-Section or use a special purpose directive
/// to emit a section offset if the target has one. /// to emit a section offset if the target has one.
void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section, void EmitSectionOffset(const MCSymbol *Label, const MCSymbol *Section,